<div dir="ltr">Thanks for the response! I went ahead and put up a <a href="https://reviews.llvm.org/D116833">patch</a> to introduce support for disabling warnings from macros on a per-warning level. It's implemented following the great feedback I received and works for my concrete use case (disable a particular warning). After it's merged people should be able to suppress other warnings if they see fit. However, as I said in the comments, I believe this behavior should be consistent with "ShowInSystemHeader", i.e. explicitly opt-in to get warnings from macros instead of opt-out. But that's not up to me to decide, I'm keeping current behavior (all warnings on by default) :) <div><br></div><div>/Carlos<br></div><div><div><br></div><div><br></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jan 10, 2022 at 8:23 PM David Blaikie <<a href="mailto:dblaikie@gmail.com">dblaikie@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">+Some folks who have some interest in clang diagnostic quality.<br><br>I'm guessing there isn't an existing solution to this in clang - but maybe it's possible if you wanted to work on an improvement/patch to Clang? Though it might be difficult to check that all the relevant code properties came from the macro and not some from the macro, some from macro arguments, some from the context the macro was used in, etc.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Dec 26, 2021 at 2:29 PM Carlos Galvez via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi!<div><br></div><div>I've asked this question in <a href="https://stackoverflow.com/questions/70488470/how-to-ignore-compiler-warnings-for-macros-defined-in-third-party-headers" target="_blank">StackOverflow</a> without much success so I thought I'd come closer to the source and ask here.</div><div><br></div><div>My use case is simple: ignore compiler warnings from 3rd-party headers that I have no control over. The standard approach for this is simple - include them as "system headers" via "-isystem". That works pretty well, except for one bit - <b>macros</b>. Clang (and GCC) will still report warnings if I use problematic macros each time I use them in my code. Why is that? Clang knows where the macro comes from, shouldn't it be able to ignore the warning? Is there a good way to achieve what I want, without using pragmas or re-creating the third-party code myself? </div><div><br></div><div>Thanks!</div><div>/Carlos</div></div>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
</blockquote></div>
</blockquote></div>