Skip to content

Commit

Permalink
Fix exceptions mismatch.
Browse files Browse the repository at this point in the history
  • Loading branch information
tritao committed Oct 27, 2024
1 parent 5e6fd48 commit b26e315
Show file tree
Hide file tree
Showing 10 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/CLI/Generator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
Original file line number Diff line number Diff line change
@@ -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 <string>
#include <new>
Expand Down
Original file line number Diff line number Diff line change
@@ -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 <string>
#include <new>
Expand Down
Original file line number Diff line number Diff line change
@@ -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 <string>
#include <new>
Expand Down
Original file line number Diff line number Diff line change
@@ -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 <string>
#include <new>
Expand Down
Original file line number Diff line number Diff line change
@@ -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 <string>
#include <new>
Expand Down
1 change: 1 addition & 0 deletions src/CppParser/ParserGen/ParserGen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions src/CppParser/premake5.lua
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ project "Std-symbols"
language "C++"
SetupNativeProject()
rtti "Off"
exceptionhandling "Off"

defines { "DLL_EXPORT" }

filter { "toolset:msc*" }
Expand Down
2 changes: 2 additions & 0 deletions src/Generator/Passes/SymbolsCodeGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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 <string>");
}
Expand Down
4 changes: 4 additions & 0 deletions src/Parser/ParserOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -375,6 +376,9 @@ private void SetupArguments(TargetPlatform targetPlatform)

if (!EnableRTTI)
AddArguments("-fno-rtti");

if (EnableExceptions)
AddArguments("-fexceptions");
}

internal string BuiltinsDirBasePath
Expand Down

0 comments on commit b26e315

Please sign in to comment.