googletest
googletest copied to clipboard
Getting googletest code can be compiled with -Wundef option
The windows CI also fixed by this MR
- This contains changes beyond the minimal code required to enable -Wundef (e.g. edits to build files, adding underscores to struct fields, etc.). Could we reduce it to just change the spurious macros?
- Since we use the pattern
#if defined(__FOO) && __FOOfor external macros, could we use it for googletest macros as well? Instead of attempting to define them to 0.
- This contains changes beyond the minimal code required to enable -Wundef (e.g. edits to build files, adding underscores to struct fields, etc.). Could we reduce it to just change the spurious macros?
- Since we use the pattern
#if defined(__FOO) && __FOOfor external macros, could we use it for googletest macros as well? Instead of attempting to define them to 0.
define them to 0 is better than #if defined(__FOO) && __FOO because we can use -Wundef to detect if the invalid macro are used
@thughes @martijnvels Please take a look at this MR
cc @dinord
This should now be fixed as of commit d92a270d2d9d6bb7ed3bf7dc3f698028550a65ef.
@thughes There is an issue, the bazel didn't guard -Wundef option # Enable Warn if an undefined identifier is evaluated in an #if directive. Such identifiers are replaced with zero. "//:msvc_compiler": [], "//conditions:default": ["-Wundef"],
@lygstate Should be fixed in commit 678c1c73de2cf004d58f5dbbef299083997d924a and a798c2f10200b6293a5cc236b5f41b26c1ae7378.