From 6f26cfbbfdaabed0b278f535d90ec2b49cd6e703 Mon Sep 17 00:00:00 2001 From: Joao Matos Date: Sun, 27 Oct 2024 18:14:57 +0000 Subject: [PATCH] Fix exceptions mismatch. --- .../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/Parser/ParserOptions.cs | 5 +++-- 5 files changed, 6 insertions(+), 4 deletions(-) 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 9616de95ae..7921ab0e43 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 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/Parser/ParserOptions.cs b/src/Parser/ParserOptions.cs index 511709449f..686fc56545 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( @@ -373,8 +374,8 @@ private void SetupArguments(TargetPlatform targetPlatform) break; } - if (!EnableRTTI) - AddArguments("-fno-rtti"); + AddArguments(EnableRTTI ? "-frtti" : "-fno-rtti"); + AddArguments(EnableExceptions ? "-fexceptions" : "-fno-exceptions"); } internal string BuiltinsDirBasePath