[PATCH] D144654: [Lex] Warn when defining or undefining any builtin macro

Carlos Eduardo Seo via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 1 05:54:06 PDT 2023


cseo added a comment.

In D144654#4381893 <https://reviews.llvm.org/D144654#4381893>, @nickdesaulniers wrote:

> In D144654#4380488 <https://reviews.llvm.org/D144654#4380488>, @john.brawn wrote:
>
>> gcc has the same warning so I wasn't expecting this cause to change problems, but looking more closely at gcc's behaviour it looks like it only warns for some builtin macros and not others (though glancing over the gcc source code it's not clear which macros and for what reason).
>>
>> I'll look at this some more and see if I can improve the behaviour.
>
> Based on
> https://lore.kernel.org/llvm/6475a837.170a0220.77d4a.116a@mx.google.com/T/#u
> I think the following macros aren't warned on: https://godbolt.org/z/dfqnG7bae
>
>   #undef __INT32_TYPE__
>   #undef __UINT32_TYPE__
>   #undef __UINTPTR_TYPE__
>   #undef __i386__
>   #undef __UINT64_TYPE__
>   #undef __INT64_TYPE__

glibc build also fails because of

#undef  __OPTIMIZE__


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D144654/new/

https://reviews.llvm.org/D144654



More information about the cfe-commits mailing list