<div dir="ltr">I would love to see this merged. It would make it easier to write libc++ tests if the tests didn't have to worry about the old 4.0 behavior.<div><br></div><div>CC'ing Richard: Would merging this be OK?</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jan 13, 2017 at 3:46 PM, George Burgess IV <span dir="ltr"><<a href="mailto:george.burgess.iv@gmail.com" target="_blank">george.burgess.iv@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra">Do we want to consider merging this into the release branch? Seems like more of a bugfix than a feature to me.</div><div><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jan 13, 2017 at 2:11 PM, Eric Fiselier via cfe-commits <span dir="ltr"><<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: ericwf<br>
Date: Fri Jan 13 16:11:40 2017<br>
New Revision: 291963<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=291963&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject?rev=291963&view=rev</a><br>
Log:<br>
[clang] Emit `diagnose_if` warnings from system headers<br>
<br>
Summary: In order for libc++ to meaningfully use `diagnose_if` warnings they need to be emitted from system headers by default. This patch changes the `diagnose_if` warning diagnostic to be shown in system headers.<br>
<br>
Reviewers: george.burgess.iv, rsmith, aaron.ballman<br>
<br>
Subscribers: cfe-commits<br>
<br>
Differential Revision: <a href="https://reviews.llvm.org/D28703" rel="noreferrer" target="_blank">https://reviews.llvm.org/D2870<wbr>3</a><br>
<br>
Added:<br>
    cfe/trunk/test/Sema/Inputs/dia<wbr>gnose-if-warn-system-header.h<br>
Modified:<br>
    cfe/trunk/include/clang/Basic/<wbr>DiagnosticSemaKinds.td<br>
    cfe/trunk/test/Sema/diagnose_i<wbr>f.c<br>
<br>
Modified: cfe/trunk/include/clang/Basic/<wbr>DiagnosticSemaKinds.td<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=291963&r1=291962&r2=291963&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/cfe/trunk/include/clang/<wbr>Basic/DiagnosticSemaKinds.td?r<wbr>ev=291963&r1=291962&r2=291963&<wbr>view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/include/clang/Basic/<wbr>DiagnosticSemaKinds.td (original)<br>
+++ cfe/trunk/include/clang/Basic/<wbr>DiagnosticSemaKinds.td Fri Jan 13 16:11:40 2017<br>
@@ -3380,7 +3380,8 @@ def note_ovl_candidate_has_pass_ob<wbr>ject_s<br>
     "candidate address cannot be taken because parameter %0 has "<br>
     "pass_object_size attribute">;<br>
 def err_diagnose_if_succeeded : Error<"%0">;<br>
-def warn_diagnose_if_succeeded : Warning<"%0">, InGroup<UserDefinedWarnings>;<br>
+def warn_diagnose_if_succeeded : Warning<"%0">, InGroup<UserDefinedWarnings>,<br>
+    ShowInSystemHeader;<br>
 def note_ovl_candidate_disabled_by<wbr>_function_cond_attr : Note<<br>
     "candidate disabled: %0">;<br>
 def note_ovl_candidate_disabled_by<wbr>_extension : Note<<br>
<br>
Added: cfe/trunk/test/Sema/Inputs/dia<wbr>gnose-if-warn-system-header.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/Inputs/diagnose-if-warn-system-header.h?rev=291963&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/cfe/trunk/test/Sema/Inpu<wbr>ts/diagnose-if-warn-system-hea<wbr>der.h?rev=291963&view=auto</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/test/Sema/Inputs/dia<wbr>gnose-if-warn-system-header.h (added)<br>
+++ cfe/trunk/test/Sema/Inputs/dia<wbr>gnose-if-warn-system-header.h Fri Jan 13 16:11:40 2017<br>
@@ -0,0 +1,11 @@<br>
+#pragma GCC system_header<br>
+<br>
+inline int system_header_func(int x)<br>
+  __attribute__((diagnose_if(x == x, "system header warning", "warning"))) // expected-note {{from 'diagnose_if' attribute}}<br>
+{<br>
+  return 0;<br>
+}<br>
+<br>
+void test_system_header() {<br>
+  system_header_func(0); // expected-warning {{system header warning}}<br>
+}<br>
<br>
Modified: cfe/trunk/test/Sema/diagnose_i<wbr>f.c<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/diagnose_if.c?rev=291963&r1=291962&r2=291963&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/cfe/trunk/test/Sema/diag<wbr>nose_if.c?rev=291963&r1=291962<wbr>&r2=291963&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/test/Sema/diagnose_i<wbr>f.c (original)<br>
+++ cfe/trunk/test/Sema/diagnose_i<wbr>f.c Fri Jan 13 16:11:40 2017<br>
@@ -150,3 +150,6 @@ void alwaysWarnWithArg(int a) _diagnose_<br>
 void runAlwaysWarnWithArg(int a) {<br>
   alwaysWarnWithArg(a); // expected-warning{{alwaysWarn}}<br>
 }<br>
+<br>
+// Test that diagnose_if warnings generated in system headers are not ignored.<br>
+#include "Inputs/diagnose-if-warn-syste<wbr>m-header.h"<br>
<br>
<br>
______________________________<wbr>_________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-commits</a><br>
</blockquote></div><br></div></div></div></div>
</blockquote></div><br></div>