Skip to content

Commit b26e315

Browse files
committed
Fix exceptions mismatch.
1 parent 5e6fd48 commit b26e315

File tree

10 files changed

+15
-0
lines changed

10 files changed

+15
-0
lines changed

src/CLI/Generator.cs

+1
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ public void Setup(Driver driver)
146146

147147
parserOptions.UnityBuild = options.UnityBuild;
148148
parserOptions.EnableRTTI = options.EnableRTTI;
149+
parserOptions.EnableExceptions = options.EnableExceptions;
149150

150151
parserOptions.Setup(options.Platform ?? Platform.Host);
151152

src/CppParser/Bindings/CSharp/arm64-apple-darwin/Std-symbols.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#define _LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS
22
#define _LIBCPP_HIDE_FROM_ABI
33
#define _LIBCPP_NO_ABI_TAG
4+
#define _LIBCPP_HAS_NO_EXCEPTIONS
45

56
#include <string>
67
#include <new>

src/CppParser/Bindings/CSharp/i686-apple-darwin/Std-symbols.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#define _LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS
22
#define _LIBCPP_HIDE_FROM_ABI
33
#define _LIBCPP_NO_ABI_TAG
4+
#define _LIBCPP_HAS_NO_EXCEPTIONS
45

56
#include <string>
67
#include <new>

src/CppParser/Bindings/CSharp/x86_64-apple-darwin/Std-symbols.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#define _LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS
22
#define _LIBCPP_HIDE_FROM_ABI
33
#define _LIBCPP_NO_ABI_TAG
4+
#define _LIBCPP_HAS_NO_EXCEPTIONS
45

56
#include <string>
67
#include <new>

src/CppParser/Bindings/CSharp/x86_64-linux-gnu-cxx11abi/Std-symbols.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#define _LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS
22
#define _LIBCPP_HIDE_FROM_ABI
33
#define _LIBCPP_NO_ABI_TAG
4+
#define _LIBCPP_HAS_NO_EXCEPTIONS
45

56
#include <string>
67
#include <new>

src/CppParser/Bindings/CSharp/x86_64-linux-gnu/Std-symbols.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#define _LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS
22
#define _LIBCPP_HIDE_FROM_ABI
33
#define _LIBCPP_NO_ABI_TAG
4+
#define _LIBCPP_HAS_NO_EXCEPTIONS
45

56
#include <string>
67
#include <new>

src/CppParser/ParserGen/ParserGen.cs

+1
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ public void Setup(Driver driver)
4848
{
4949
var parserOptions = driver.ParserOptions;
5050
parserOptions.TargetTriple = Triple;
51+
parserOptions.EnableExceptions = false;
5152

5253
var options = driver.Options;
5354
options.GeneratorKind = Kind;

src/CppParser/premake5.lua

+2
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ project "Std-symbols"
5151
language "C++"
5252
SetupNativeProject()
5353
rtti "Off"
54+
exceptionhandling "Off"
55+
5456
defines { "DLL_EXPORT" }
5557

5658
filter { "toolset:msc*" }

src/Generator/Passes/SymbolsCodeGenerator.cs

+2
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ public override void Process()
3333
WriteLine("#define _LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS");
3434
WriteLine("#define _LIBCPP_HIDE_FROM_ABI");
3535
WriteLine("#define _LIBCPP_NO_ABI_TAG");
36+
if (!Context.ParserOptions.EnableExceptions)
37+
WriteLine("#define _LIBCPP_HAS_NO_EXCEPTIONS");
3638
NewLine();
3739
WriteLine("#include <string>");
3840
}

src/Parser/ParserOptions.cs

+4
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ public ParserOptions()
8484
TargetTriple.Contains("windows") || TargetTriple.Contains("msvc");
8585

8686
public bool EnableRTTI { get; set; }
87+
public bool EnableExceptions { get; set; }
8788
public LanguageVersion? LanguageVersion { get; set; }
8889

8990
public void BuildForSourceFile(
@@ -375,6 +376,9 @@ private void SetupArguments(TargetPlatform targetPlatform)
375376

376377
if (!EnableRTTI)
377378
AddArguments("-fno-rtti");
379+
380+
if (EnableExceptions)
381+
AddArguments("-fexceptions");
378382
}
379383

380384
internal string BuiltinsDirBasePath

0 commit comments

Comments
 (0)