<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">In r201893.  Thanks for the prod.<div><br><div style=""><div>On Feb 21, 2014, at 11:53 AM, David Blaikie <<a href="mailto:dblaikie@gmail.com">dblaikie@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Feb 18, 2014 at 2:28 PM, David Blaikie <span dir="ltr"><<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@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"><br><div class="gmail_extra"><br><br><div class="gmail_quote"><div class="">On Tue, Feb 18, 2014 at 2:12 PM, Ted Kremenek <span dir="ltr"><<a href="mailto:kremenek@apple.com" target="_blank">kremenek@apple.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: kremenek<br>
Date: Tue Feb 18 16:12:10 2014<br>
New Revision: 201607<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=201607&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=201607&view=rev</a><br>
Log:<br>
Experiment with making -Wunreachable-code more immediately useful by restricting warnings to those issued in the main file.<br></blockquote><div><br></div></div><div>Seems simple enough (though one of these days I'll dredge up the CFG edge improvements again to start fixing this more completely) - but a simple test case would be nice to have too.</div>
</div></div></div></blockquote><div><br></div><div>Bump for test case?</div><div> </div><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">
<div class="gmail_quote"><div class="h5">
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">This warning has a whole bunch of known false positives, much of them due<br>
to code that is "sometimes unreachable".  This can caused by code that<br>
is conditionally generated by the preprocessor, branches that are defined<br>
in terms of architecture-specific details (e.g., the size of a type), and<br>
so on.  While these are all good things to address one by one, the reality<br>
is that this warning has received little love lately.  By restricting<br>
its purvue, we can focus on the top issues effecting main files, which<br>
should be smaller, and then gradually widen the scope.<br>
<br>
Modified:<br>
    cfe/trunk/lib/Sema/AnalysisBasedWarnings.cpp<br>
<br>
Modified: cfe/trunk/lib/Sema/AnalysisBasedWarnings.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/AnalysisBasedWarnings.cpp?rev=201607&r1=201606&r2=201607&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/AnalysisBasedWarnings.cpp?rev=201607&r1=201606&r2=201607&view=diff</a><br>


==============================================================================<br>
--- cfe/trunk/lib/Sema/AnalysisBasedWarnings.cpp (original)<br>
+++ cfe/trunk/lib/Sema/AnalysisBasedWarnings.cpp Tue Feb 18 16:12:10 2014<br>
@@ -66,6 +66,12 @@ namespace {<br>
     UnreachableCodeHandler(Sema &s) : S(s) {}<br>
<br>
     void HandleUnreachable(SourceLocation L, SourceRange R1, SourceRange R2) {<br>
+      // As a heuristic prune all diagnostics not in the main file.  Currently<br>
+      // the majority of warnings in headers are false positives.  These<br>
+      // are largely caused by configuration state, e.g. preprocessor<br>
+      // defined code, etc.<br>
+      if (!S.getSourceManager().isInMainFile(L))<br>
+        return;<br>
       S.Diag(L, diag::warn_unreachable) << R1 << R2;<br>
     }<br>
   };<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu" target="_blank">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
</blockquote></div></div><br></div></div>
</blockquote></div><br></div></div>
</blockquote></div><br></div></body></html>