We use the following code to determine if -fsanitize=address
has been specified at compile time for clang and gcc. How do we determine if -fsanitize=undefined
has been specified?
bool isSanitized = false;
#if defined(__has_feature)
#if __has_feature(address_sanitizer)
isSanitized = true;
#endif
#elif defined(__SANITIZE_ADDRESS__)
isSanitized = true;
#endif
I suggest you file this as a bug to ASan github (or GCC bugzilla) about this (we already have defined for ASan and TSan so it makes sense to cook one for UBSan as well). For now it seems your only option is to pass a custom define together with -fsanitize-undefined
in a Makefile.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With