Skip to content

Commit b5bb2e4

Browse files
jedludlowtwiecki
authored andcommitted
Disable C++ exception handling
Update GCC compiler options to disable C++ exception handling altogether. Also disable the create of stack unwinding tables since these will not be required without exceptions enabled.
1 parent a585c72 commit b5bb2e4

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

pymc3/__init__.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,16 @@ def __set_compiler_flags():
8282
# Workarounds for Theano compiler problems on various platforms
8383
current = theano.config.gcc__cxxflags
8484
augmented = f"{current} -Wno-c++11-narrowing"
85+
8586
# Work around compiler bug in GCC < 8.4 related to structured exception
8687
# handling registers on Windows.
8788
# See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65782 for details.
88-
augmented = f"{augmented} -fno-asynchronous-unwind-tables"
89+
# First disable C++ exception handling altogether since it's not needed
90+
# for the C extensions that we generate.
91+
augmented = f"{augmented} -fno-exceptions"
92+
# Now disable the generation of stack unwinding tables.
93+
augmented = f"{augmented} -fno-unwind-tables -fno-asynchronous-unwind-tables"
94+
8995
theano.config.gcc__cxxflags = augmented
9096

9197

0 commit comments

Comments
 (0)