makepanda: Fix clang crash on macOS when compiling Objective-C++ code

This commit is contained in:
rdb 2021-12-26 12:29:03 +01:00
parent c2635d2498
commit 987f2f036b

View File

@ -1602,14 +1602,17 @@ def CompileCxx(obj,src,opts):
# Needed by both Python, Panda, Eigen, all of which break aliasing rules. # Needed by both Python, Panda, Eigen, all of which break aliasing rules.
cmd += " -fno-strict-aliasing" cmd += " -fno-strict-aliasing"
if optlevel >= 3: # Certain clang versions crash when passing these math flags while
cmd += " -ffast-math -fno-stack-protector" # compiling Objective-C++ code
if optlevel == 3: if not src.endswith(".m") and not src.endswith(".mm"):
# Fast math is nice, but we'd like to see NaN in dev builds. if optlevel >= 3:
cmd += " -fno-finite-math-only" cmd += " -ffast-math -fno-stack-protector"
if optlevel == 3:
# Fast math is nice, but we'd like to see NaN in dev builds.
cmd += " -fno-finite-math-only"
# Make sure this is off to avoid GCC/Eigen bug (see GitHub #228) # Make sure this is off to avoid GCC/Eigen bug (see GitHub #228)
cmd += " -fno-unsafe-math-optimizations" cmd += " -fno-unsafe-math-optimizations"
if (optlevel==1): cmd += " -ggdb -D_DEBUG" if (optlevel==1): cmd += " -ggdb -D_DEBUG"
if (optlevel==2): cmd += " -O1 -D_DEBUG" if (optlevel==2): cmd += " -O1 -D_DEBUG"