<div dir="ltr"><div dir="ltr">Perhaps a lint rule triggering on "#pragma GCC diagnostic warning", saying "We don't allow warnings, please use `#pragma GCC diagnostic error` (or ignored)" would solve the problem sufficiently.<div><br></div><div>Separately, I note that "#pragma GCC diagnostic error" allows errors to bypass -Wfatal-errors. That certainly seems to serve no useful purpose and could be removed.</div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail-m_-3772490601607342788gmail_attr">On Thu, Jan 24, 2019 at 11:20 AM Nico Weber <<a href="mailto:thakis@chromium.org" target="_blank">thakis@chromium.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"><div dir="ltr"><div dir="ltr"></div>On Thu, Jan 24, 2019 at 11:12 AM James Y Knight <<a href="mailto:jyknight@google.com" target="_blank">jyknight@google.com</a>> wrote:<div><div class="gmail_quote"><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">I don't think we should have such a flag. The explicit intent of '#pragma gcc diagnostic warning' is to allow downgrading an error to a warning, while still allowing it to be emitted.<div><br></div><div>Perhaps a new value for pragma diagnostic which emits an upgradeable warning would be reasonable.</div></div></blockquote><div><br></div><div>The use case here is that we don't allow non-error diagnostics in chrome. Some subproject used `#pragma GCC diagnostic warning` because they wanted to configure warning flags in cc files instead of in build files for some reason. They didn't expect this to trigger a warning instead of an error. A new pragma would meet that use case, but I don't want source code to be able to opt out of -Werror. In my experience, once it's known that such an option exist, someone will use it. So we do need some kind of "_all_ warnings are errors" toggle.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br><div class="gmail_quote"><div dir="ltr" class="gmail-m_-3772490601607342788gmail-m_1544539666459572431gmail-m_6419948743603378591gmail_attr">On Thu, Jan 24, 2019 at 9:56 AM Nico Weber 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"><div dir="ltr">Re "intentional?", it matches gcc which explicitly documents on <a href="https://gcc.gnu.org/onlinedocs/gcc/Diagnostic-Pragmas.html" target="_blank">https://gcc.gnu.org/onlinedocs/gcc/Diagnostic-Pragmas.html</a> that the pragma wins over -Werror.</div><div dir="ltr"><br></div><div>Does anyone know if there's a flag that says "I want all warnings to be errors, not just most of them"?</div><div><br></div><div>If there isn't one yet, what would be a good UI for that?</div></div><br><div class="gmail_quote"><div dir="ltr">On Wed, Jan 23, 2019 at 11:11 PM Nico Weber <<a href="mailto:thakis@chromium.org" target="_blank">thakis@chromium.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"><div dir="ltr"><div>Consider:</div><div><br></div><div>$ cat test.cc</div><div>#pragma GCC diagnostic warning "-Wsign-compare"</div><div><br></div><div>bool f(int a, unsigned b) {</div><div> return a != b;</div><div>}</div><div>$ out/gn/bin/clang -c test.cc -Werror</div><div>test.cc:4:12: warning: comparison of integers of different signs: 'int' and 'unsigned int' [-Wsign-compare]</div><div> return a != b;</div><div> ~ ^ ~</div><div>1 warning generated.</div><div><br></div><div><br></div><div>I found it surprising that this is emitted as a warning, not as an error. If this is intentional, is there some other way to say "I want my compiler warnings to always be errors"?</div><div><br>Thanks,</div><div>Nico</div></div></div>
</blockquote></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></div></div></div>
</blockquote></div>