Page MenuHome

ASan/macOS: fix incomplete C/CXX compiler flags.

Authored by Ankit Meel (ankitm) on Sat, Sep 12, 5:28 PM.



While testing for rB40dcf686f04f: Support ASan library on macOS for all generators., compiler flags got mixed up and
non-working ASan configuration was committed.

Platform file, which is included after the CMAKE_C_FLAGS_DEBUG etc.,
are set, overwrites those flags instead of appending to them. To fix this,
PLATFORM_CFLAGS is used to pass the -fsanitize=* flags to the C/C++

Tested on fresh build using both Xcode and Ninja, with & without ccache.

Also silence a clang warning for multi-config generators:
the object size sanitizer has no effect at -O0, but is explicitly
enabled: -fsanitize=object-size [-Winvalid-command-line-argument]

Diff Detail

rB Blender

Event Timeline

Ankit Meel (ankitm) requested review of this revision.Sat, Sep 12, 5:28 PM
Ankit Meel (ankitm) created this revision.
Ankit Meel (ankitm) edited the summary of this revision. (Show Details)Sun, Sep 13, 8:15 AM
  • Fix trailing white-space.
Ankit Meel (ankitm) edited the summary of this revision. (Show Details)Mon, Sep 14, 6:35 PM

Can we make platform_apple.cmake not overwrite all CMAKE_C and CMAKE_CXX flags?

That seems like a mistake, we don't do this on Linux and Windows I think.

Ankit Meel (ankitm) added a comment.EditedMon, Sep 14, 7:48 PM

I tried using CMAKE_CXX_FLAGS_DEBUG** for these ASan flags and appending to it in platform_apple.cmake file, but all the ADD_CHECK_C{XX}_COMPILER_FLAG tests failed$1477-1485
so dropped the idea of making that correction.

This revision is now accepted and ready to land.Tue, Sep 15, 4:13 PM