[PATCH] D144654: [Lex] Warn when defining or undefining any builtin macro
John Brawn via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri May 12 08:39:23 PDT 2023
john.brawn planned changes to this revision.
john.brawn added a comment.
The clang-tidy failures in pre-merge are because
- clang-tidy tests use the compile database from building llvm (though you have to manually copy it otherwise the tests silently pass without actually running the test, which is why I wasn't seeing this locally)
- this has -D_GNU_SOURCE because llvm/cmake/config-ix.cmake adds it to the defines
- clang predefines _GNU_SOURCE when compiling C++ (for certain targets)
- therefore we get the warning for a redefined builtin
I'm not sure yet what the best fix is here. gcc has the same behaviour of defining _GNU_SOURCE for C++, but does it by adding -D_GNU_SOURCE to the cc1 command line so it doesn't give a warning on redefine, but it doesn't look like copying this behaviour in clang would be easy. I'll think about this some more.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D144654/new/
https://reviews.llvm.org/D144654
More information about the cfe-commits
mailing list