[PATCH] D116833: [clang] Introduce support for disabling warnings in system macros

Carlos Galvez via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 10 22:49:42 PST 2022


carlosgalvezp added a comment.

In D116833#3232739 <https://reviews.llvm.org/D116833#3232739>, @efriedma wrote:

> I'll just note here that doing this globally is likely to have unexpected results... consider, for example:
>
>   #include <math.h>
>   void f() { long x = M_PI; }
>
> Currently, the implicit conversion warning points into math.h.
>
> That said, I don't see any problem with the current implementation.

Yes, at first I set the default to "disable globally" and got around ~15 failed tests similar to your example. I don't have a good enough picture of all the existing warnings to determine what's preferred here, but I think we can take it in a separate patch. I get a much better insight now about why this has not been tackled before and why some warnings from system macros are needed!

I can also mention that we have recently merged a patch to disable clang-tidy warnings from system macros:
https://reviews.llvm.org/D116378


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D116833



More information about the cfe-commits mailing list