mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-20 11:30:18 +00:00
disable rtti
Update main.yml up
This commit is contained in:
parent
02d609b2f7
commit
af776bb4aa
4
.github/workflows/main.yml
vendored
4
.github/workflows/main.yml
vendored
@ -9,9 +9,9 @@ jobs:
|
||||
- name: Compiling
|
||||
shell: bash
|
||||
run: |
|
||||
CL -std:c++17 -utf-8 -O2 -EHsc -Fe:pocketpy src/main.cpp
|
||||
CL -std:c++17 -GR- -EHsc -O2 -Fe:pocketpy src/main.cpp
|
||||
mv src/pocketpy.h src/pocketpy.cpp
|
||||
CL -std:c++17 -utf-8 -O2 -EHsc -LD -Fe:pocketpy src/pocketpy.cpp
|
||||
CL -std:c++17 -GR- -EHsc -O2 -LD -Fe:pocketpy src/pocketpy.cpp
|
||||
mkdir -p output/windows/x86_64
|
||||
mv pocketpy.exe output/windows/x86_64
|
||||
mv pocketpy.dll output/windows/x86_64
|
||||
|
@ -1 +1 @@
|
||||
g++ -o pocketpy src/main.cpp --std=c++17 -O1 -pthread -Wall -Wno-sign-compare -Wno-unused-variable
|
||||
g++ -o pocketpy src/main.cpp --std=c++17 -O1 -pthread -Wall -Wno-sign-compare -Wno-unused-variable -fno-rtti
|
@ -1,3 +1,3 @@
|
||||
rm -rf web/lib/
|
||||
mkdir -p web/lib/
|
||||
em++ src/main.cpp -fexceptions -sEXIT_RUNTIME -O3 -sEXPORTED_FUNCTIONS=_repl_input,_repl_start -sEXPORTED_RUNTIME_METHODS=ccall -o web/lib/pocketpy.js
|
||||
em++ src/main.cpp -fno-rtti -fexceptions -sEXIT_RUNTIME -O3 -sEXPORTED_FUNCTIONS=_repl_input,_repl_start -sEXPORTED_RUNTIME_METHODS=ccall -o web/lib/pocketpy.js
|
@ -30,7 +30,7 @@ class JsonRpcServer {
|
||||
this.onPostDispatch,
|
||||
this.enableFileAccess = false}) {
|
||||
if (!enableFileAccess) return;
|
||||
registerOS(this);
|
||||
_registerOS(this);
|
||||
}
|
||||
|
||||
/// Register a JSONRPC handler.
|
||||
@ -87,7 +87,7 @@ class JsonRpcServer {
|
||||
int _fileId = 0;
|
||||
final Map<int, File> _files = {};
|
||||
|
||||
void registerOS(JsonRpcServer rpcServer) {
|
||||
void _registerOS(JsonRpcServer rpcServer) {
|
||||
rpcServer.register("fopen", (params) {
|
||||
var path = params[0];
|
||||
//var mode = params[1];
|
||||
|
@ -13,7 +13,11 @@ add_library(pocketpy SHARED
|
||||
"pocketpy.cpp"
|
||||
)
|
||||
|
||||
add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/utf-8>")
|
||||
if (NOT MSVC)
|
||||
target_compile_options(pocketpy PRIVATE -fno-rtti)
|
||||
else()
|
||||
target_compile_options(pocketpy PRIVATE /GR- /EHsc)
|
||||
endif()
|
||||
|
||||
set_target_properties(pocketpy PROPERTIES
|
||||
PUBLIC_HEADER pocketpy.h
|
||||
|
@ -1027,13 +1027,11 @@ _Code compile(VM* vm, const char* source, _Str filename, CompileMode mode=EXEC_M
|
||||
if(!noThrow) return compiler.__fillCode();
|
||||
try{
|
||||
return compiler.__fillCode();
|
||||
}catch(std::exception& e){
|
||||
if(dynamic_cast<const _Error*>(&e)){
|
||||
}catch(_Error& e){
|
||||
(*vm->_stderr) << e.what() << '\n';
|
||||
}else{
|
||||
}catch(std::exception& e){
|
||||
auto ce = CompileError("UnexpectedError", e.what(), compiler.getLineSnapshot());
|
||||
(*vm->_stderr) << ce.what() << '\n';
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
}
|
@ -852,8 +852,8 @@ extern "C" {
|
||||
/// Return a json representing the result.
|
||||
char* pkpy_vm_read_output(VM* vm){
|
||||
if(vm->use_stdio) return nullptr;
|
||||
_StrStream* s_out = dynamic_cast<_StrStream*>(vm->_stdout);
|
||||
_StrStream* s_err = dynamic_cast<_StrStream*>(vm->_stderr);
|
||||
_StrStream* s_out = (_StrStream*)(vm->_stdout);
|
||||
_StrStream* s_err = (_StrStream*)(vm->_stderr);
|
||||
_Str _stdout = s_out->str();
|
||||
_Str _stderr = s_err->str();
|
||||
_StrStream ss;
|
||||
|
6
src/vm.h
6
src/vm.h
@ -547,16 +547,14 @@ public:
|
||||
if(_module == nullptr) _module = _main;
|
||||
try {
|
||||
return _exec(code, _module, {});
|
||||
} catch (const std::exception& e) {
|
||||
if(dynamic_cast<const _Error*>(&e)){
|
||||
}catch (const _Error& e){
|
||||
*_stderr << e.what() << '\n';
|
||||
}else{
|
||||
}catch (const std::exception& e) {
|
||||
auto re = RuntimeError("UnexpectedError", e.what(), _cleanErrorAndGetSnapshots());
|
||||
*_stderr << re.what() << '\n';
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
virtual void execAsync(const _Code& code) {
|
||||
exec(code);
|
||||
|
Loading…
x
Reference in New Issue
Block a user