From 49264706ef7d8c045f0b1253799d424c57dba414 Mon Sep 17 00:00:00 2001 From: Joao Matos Date: Tue, 29 Oct 2024 11:41:37 +0000 Subject: [PATCH] Fix exceptions mismatch. --- src/CLI/Generator.cs | 1 + .../Bindings/CSharp/arm64-apple-darwin/Std-symbols.cpp | 1 - .../Bindings/CSharp/i686-apple-darwin/Std-symbols.cpp | 1 - .../Bindings/CSharp/x86_64-apple-darwin/Std-symbols.cpp | 1 - .../Bindings/CSharp/x86_64-linux-gnu-cxx11abi/Std-symbols.cpp | 1 - .../Bindings/CSharp/x86_64-linux-gnu/Std-symbols.cpp | 1 - src/CppParser/ParserGen/ParserGen.cs | 1 + src/CppParser/premake5.lua | 2 ++ src/Generator/Passes/SymbolsCodeGenerator.cs | 2 ++ src/Parser/ParserOptions.cs | 4 ++++ 10 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/CLI/Generator.cs b/src/CLI/Generator.cs index ab90cf9b67..c49a574115 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 c4b4b67673..26e5ae1647 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,5 @@ #define _LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS #define _LIBCPP_HIDE_FROM_ABI -#define _LIBCPP_NO_ABI_TAG #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 c4b4b67673..26e5ae1647 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,5 @@ #define _LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS #define _LIBCPP_HIDE_FROM_ABI -#define _LIBCPP_NO_ABI_TAG #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 c4b4b67673..26e5ae1647 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,5 @@ #define _LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS #define _LIBCPP_HIDE_FROM_ABI -#define _LIBCPP_NO_ABI_TAG #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 72fe7671ef..3da0107115 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,5 @@ #define _LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS #define _LIBCPP_HIDE_FROM_ABI -#define _LIBCPP_NO_ABI_TAG #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 e2d84a3115..fc98a8528f 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,5 @@ #define _LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS #define _LIBCPP_HIDE_FROM_ABI -#define _LIBCPP_NO_ABI_TAG #include #include diff --git a/src/CppParser/ParserGen/ParserGen.cs b/src/CppParser/ParserGen/ParserGen.cs index 5c9b0703a7..f70d6c7ff7 100644 --- a/src/CppParser/ParserGen/ParserGen.cs +++ b/src/CppParser/ParserGen/ParserGen.cs @@ -49,6 +49,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 a668f77427..4fabca615a 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 62c2bf846c..f7d75bbaaf 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 511709449f..b1218f4ec7 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