diff --git a/src/CLI/Generator.cs b/src/CLI/Generator.cs index ab90cf9b6..c49a57411 100644 --- a/src/CLI/Generator.cs +++ b/src/CLI/Generator.cs @@ -146,6 +146,7 @@ public void Setup(Driver driver) parserOptions.UnityBuild = options.UnityBuild; parserOptions.EnableRTTI = options.EnableRTTI; + parserOptions.EnableExceptions = options.EnableExceptions; parserOptions.Setup(options.Platform ?? Platform.Host); diff --git a/src/CppParser/Bindings/CSharp/arm64-apple-darwin/Std-symbols.cpp b/src/CppParser/Bindings/CSharp/arm64-apple-darwin/Std-symbols.cpp index c4b4b6767..c200261ab 100644 --- a/src/CppParser/Bindings/CSharp/arm64-apple-darwin/Std-symbols.cpp +++ b/src/CppParser/Bindings/CSharp/arm64-apple-darwin/Std-symbols.cpp @@ -1,6 +1,7 @@ #define _LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS #define _LIBCPP_HIDE_FROM_ABI #define _LIBCPP_NO_ABI_TAG +#define _LIBCPP_HAS_NO_EXCEPTIONS #include #include diff --git a/src/CppParser/Bindings/CSharp/i686-apple-darwin/Std-symbols.cpp b/src/CppParser/Bindings/CSharp/i686-apple-darwin/Std-symbols.cpp index c4b4b6767..c200261ab 100644 --- a/src/CppParser/Bindings/CSharp/i686-apple-darwin/Std-symbols.cpp +++ b/src/CppParser/Bindings/CSharp/i686-apple-darwin/Std-symbols.cpp @@ -1,6 +1,7 @@ #define _LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS #define _LIBCPP_HIDE_FROM_ABI #define _LIBCPP_NO_ABI_TAG +#define _LIBCPP_HAS_NO_EXCEPTIONS #include #include diff --git a/src/CppParser/Bindings/CSharp/x86_64-apple-darwin/Std-symbols.cpp b/src/CppParser/Bindings/CSharp/x86_64-apple-darwin/Std-symbols.cpp index c4b4b6767..c200261ab 100644 --- a/src/CppParser/Bindings/CSharp/x86_64-apple-darwin/Std-symbols.cpp +++ b/src/CppParser/Bindings/CSharp/x86_64-apple-darwin/Std-symbols.cpp @@ -1,6 +1,7 @@ #define _LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS #define _LIBCPP_HIDE_FROM_ABI #define _LIBCPP_NO_ABI_TAG +#define _LIBCPP_HAS_NO_EXCEPTIONS #include #include diff --git a/src/CppParser/Bindings/CSharp/x86_64-linux-gnu-cxx11abi/Std-symbols.cpp b/src/CppParser/Bindings/CSharp/x86_64-linux-gnu-cxx11abi/Std-symbols.cpp index 72fe7671e..60929cf6f 100644 --- a/src/CppParser/Bindings/CSharp/x86_64-linux-gnu-cxx11abi/Std-symbols.cpp +++ b/src/CppParser/Bindings/CSharp/x86_64-linux-gnu-cxx11abi/Std-symbols.cpp @@ -1,6 +1,7 @@ #define _LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS #define _LIBCPP_HIDE_FROM_ABI #define _LIBCPP_NO_ABI_TAG +#define _LIBCPP_HAS_NO_EXCEPTIONS #include #include diff --git a/src/CppParser/Bindings/CSharp/x86_64-linux-gnu/Std-symbols.cpp b/src/CppParser/Bindings/CSharp/x86_64-linux-gnu/Std-symbols.cpp index e2d84a311..bc86a88e4 100644 --- a/src/CppParser/Bindings/CSharp/x86_64-linux-gnu/Std-symbols.cpp +++ b/src/CppParser/Bindings/CSharp/x86_64-linux-gnu/Std-symbols.cpp @@ -1,6 +1,7 @@ #define _LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS #define _LIBCPP_HIDE_FROM_ABI #define _LIBCPP_NO_ABI_TAG +#define _LIBCPP_HAS_NO_EXCEPTIONS #include #include diff --git a/src/CppParser/ParserGen/ParserGen.cs b/src/CppParser/ParserGen/ParserGen.cs index 9616de95a..7921ab0e4 100644 --- a/src/CppParser/ParserGen/ParserGen.cs +++ b/src/CppParser/ParserGen/ParserGen.cs @@ -48,6 +48,7 @@ public void Setup(Driver driver) { var parserOptions = driver.ParserOptions; parserOptions.TargetTriple = Triple; + parserOptions.EnableExceptions = false; var options = driver.Options; options.GeneratorKind = Kind; diff --git a/src/CppParser/premake5.lua b/src/CppParser/premake5.lua index a668f7742..4fabca615 100644 --- a/src/CppParser/premake5.lua +++ b/src/CppParser/premake5.lua @@ -51,6 +51,8 @@ project "Std-symbols" language "C++" SetupNativeProject() rtti "Off" + exceptionhandling "Off" + defines { "DLL_EXPORT" } filter { "toolset:msc*" } diff --git a/src/Generator/Passes/SymbolsCodeGenerator.cs b/src/Generator/Passes/SymbolsCodeGenerator.cs index 62c2bf846..f7d75bbaa 100644 --- a/src/Generator/Passes/SymbolsCodeGenerator.cs +++ b/src/Generator/Passes/SymbolsCodeGenerator.cs @@ -33,6 +33,8 @@ public override void Process() WriteLine("#define _LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS"); WriteLine("#define _LIBCPP_HIDE_FROM_ABI"); WriteLine("#define _LIBCPP_NO_ABI_TAG"); + if (!Context.ParserOptions.EnableExceptions) + WriteLine("#define _LIBCPP_HAS_NO_EXCEPTIONS"); NewLine(); WriteLine("#include "); } diff --git a/src/Parser/ParserOptions.cs b/src/Parser/ParserOptions.cs index 511709449..b1218f4ec 100644 --- a/src/Parser/ParserOptions.cs +++ b/src/Parser/ParserOptions.cs @@ -84,6 +84,7 @@ public ParserOptions() TargetTriple.Contains("windows") || TargetTriple.Contains("msvc"); public bool EnableRTTI { get; set; } + public bool EnableExceptions { get; set; } public LanguageVersion? LanguageVersion { get; set; } public void BuildForSourceFile( @@ -375,6 +376,9 @@ private void SetupArguments(TargetPlatform targetPlatform) if (!EnableRTTI) AddArguments("-fno-rtti"); + + if (EnableExceptions) + AddArguments("-fexceptions"); } internal string BuiltinsDirBasePath