https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70477
Manuel López-Ibáñez <manu at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |manu at gcc dot gnu.org --- Comment #6 from Manuel López-Ibáñez <manu at gcc dot gnu.org> --- (In reply to ecloud from comment #5) > If a macro exists in order to test something and generate different code > depending on the test result, then in any given use case of the macro, we > can say that the test inside the macro is a tautology, right? But that > shouldn't mean that doing tests inside macros is bad. We want to avoid warning for macros in general because of that, and we already avoid some cases. However, GCC can only detect that something comes from a macro if it expands to something for which GCC tracks locations. GCC currently does not track locations for constants (0), variable-uses (x) and some simple expressions that may get folded too early. So if you have !!0 or 0 != 1, GCC right now cannot tell whether this is the result of macro expansion (at the point of warning). It is not likely that the bug will get fixed in the near term, so if you think that you may still want this warning in general, a work-around is to disable this warning for the relevant line using #pragma GCC diagnostic.