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
|
- name: Compiling
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
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
|
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
|
mkdir -p output/windows/x86_64
|
||||||
mv pocketpy.exe output/windows/x86_64
|
mv pocketpy.exe output/windows/x86_64
|
||||||
mv pocketpy.dll 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/
|
rm -rf web/lib/
|
||||||
mkdir -p 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.onPostDispatch,
|
||||||
this.enableFileAccess = false}) {
|
this.enableFileAccess = false}) {
|
||||||
if (!enableFileAccess) return;
|
if (!enableFileAccess) return;
|
||||||
registerOS(this);
|
_registerOS(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Register a JSONRPC handler.
|
/// Register a JSONRPC handler.
|
||||||
@ -87,7 +87,7 @@ class JsonRpcServer {
|
|||||||
int _fileId = 0;
|
int _fileId = 0;
|
||||||
final Map<int, File> _files = {};
|
final Map<int, File> _files = {};
|
||||||
|
|
||||||
void registerOS(JsonRpcServer rpcServer) {
|
void _registerOS(JsonRpcServer rpcServer) {
|
||||||
rpcServer.register("fopen", (params) {
|
rpcServer.register("fopen", (params) {
|
||||||
var path = params[0];
|
var path = params[0];
|
||||||
//var mode = params[1];
|
//var mode = params[1];
|
||||||
|
@ -13,7 +13,11 @@ add_library(pocketpy SHARED
|
|||||||
"pocketpy.cpp"
|
"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
|
set_target_properties(pocketpy PROPERTIES
|
||||||
PUBLIC_HEADER pocketpy.h
|
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();
|
if(!noThrow) return compiler.__fillCode();
|
||||||
try{
|
try{
|
||||||
return compiler.__fillCode();
|
return compiler.__fillCode();
|
||||||
|
}catch(_Error& e){
|
||||||
|
(*vm->_stderr) << e.what() << '\n';
|
||||||
}catch(std::exception& e){
|
}catch(std::exception& e){
|
||||||
if(dynamic_cast<const _Error*>(&e)){
|
auto ce = CompileError("UnexpectedError", e.what(), compiler.getLineSnapshot());
|
||||||
(*vm->_stderr) << e.what() << '\n';
|
(*vm->_stderr) << ce.what() << '\n';
|
||||||
}else{
|
|
||||||
auto ce = CompileError("UnexpectedError", e.what(), compiler.getLineSnapshot());
|
|
||||||
(*vm->_stderr) << ce.what() << '\n';
|
|
||||||
}
|
|
||||||
return nullptr;
|
|
||||||
}
|
}
|
||||||
|
return nullptr;
|
||||||
}
|
}
|
@ -852,8 +852,8 @@ extern "C" {
|
|||||||
/// Return a json representing the result.
|
/// Return a json representing the result.
|
||||||
char* pkpy_vm_read_output(VM* vm){
|
char* pkpy_vm_read_output(VM* vm){
|
||||||
if(vm->use_stdio) return nullptr;
|
if(vm->use_stdio) return nullptr;
|
||||||
_StrStream* s_out = dynamic_cast<_StrStream*>(vm->_stdout);
|
_StrStream* s_out = (_StrStream*)(vm->_stdout);
|
||||||
_StrStream* s_err = dynamic_cast<_StrStream*>(vm->_stderr);
|
_StrStream* s_err = (_StrStream*)(vm->_stderr);
|
||||||
_Str _stdout = s_out->str();
|
_Str _stdout = s_out->str();
|
||||||
_Str _stderr = s_err->str();
|
_Str _stderr = s_err->str();
|
||||||
_StrStream ss;
|
_StrStream ss;
|
||||||
|
14
src/vm.h
14
src/vm.h
@ -547,15 +547,13 @@ public:
|
|||||||
if(_module == nullptr) _module = _main;
|
if(_module == nullptr) _module = _main;
|
||||||
try {
|
try {
|
||||||
return _exec(code, _module, {});
|
return _exec(code, _module, {});
|
||||||
} catch (const std::exception& e) {
|
}catch (const _Error& e){
|
||||||
if(dynamic_cast<const _Error*>(&e)){
|
*_stderr << e.what() << '\n';
|
||||||
*_stderr << e.what() << '\n';
|
}catch (const std::exception& e) {
|
||||||
}else{
|
auto re = RuntimeError("UnexpectedError", e.what(), _cleanErrorAndGetSnapshots());
|
||||||
auto re = RuntimeError("UnexpectedError", e.what(), _cleanErrorAndGetSnapshots());
|
*_stderr << re.what() << '\n';
|
||||||
*_stderr << re.what() << '\n';
|
|
||||||
}
|
|
||||||
return nullptr;
|
|
||||||
}
|
}
|
||||||
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void execAsync(const _Code& code) {
|
virtual void execAsync(const _Code& code) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user