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

Nick Desaulniers via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 30 12:10:14 PDT 2023


nickdesaulniers added a comment.

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__


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