<div dir="ltr">On Tue, Sep 10, 2013 at 3:43 PM, Nick Lewycky <span dir="ltr"><<a href="mailto:nlewycky@google.com" target="_blank">nlewycky@google.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="im">On 10 September 2013 14:10, Eli Friedman <span dir="ltr"><<a href="mailto:eli.friedman@gmail.com" target="_blank">eli.friedman@gmail.com</a>></span> wrote:<br>
</div><div class="gmail_extra"><div class="gmail_quote"><div class="im">


<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Author: efriedma<br>
Date: Tue Sep 10 16:10:25 2013<br>
New Revision: 190437<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=190437&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=190437&view=rev</a><br>
Log:<br>
Fix regression from r190382.<br>
<br>
Make sure we perform the correct "referenced-but-not-used" check for<br>
static member constants.<br>
<br>
Fixes bug reported on cfe-commits by Alexey Samsonov.<br></blockquote><div><br></div></div><div>This breaks -Werror clang bootstrap. Eli, could you help triage?</div></div></div></div></blockquote><div><br></div><div>Looking.  It looks like just a bunch of unused junk that nobody ever noticed.</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> The main problem looks like this:</div>
<div><pre style="line-height:18px;white-space:pre-wrap;margin-bottom:0px;margin-top:0px;padding:1em 0px"><span style="font-weight:bold">lib/Transforms/Scalar/EarlyCSE.cpp:77:21: </span><span style="font-weight:bold;color:rgb(102,0,0)">error: </span><span style="font-weight:bold">unused variable 'value' [-Werror,-Wunused-variable]</span>
  static const bool value = true;
<span style="font-weight:bold;color:rgb(0,128,0)">                    ^
</span><span style="font-weight:bold">lib/Transforms/Scalar/EarlyCSE.cpp:225:23: </span><span style="font-weight:bold;color:rgb(102,0,0)">error: </span><span style="font-weight:bold">unused variable 'value' [-Werror,-Wunused-variable]</span>
    static const bool value = true;
<span style="font-weight:bold;color:rgb(0,128,0)">                      ^</span></pre></div><div>I'm not sure whether this counts as a true positive or not? Is the problem that the template is never instantiated?</div>
</div></div></div></blockquote><div><br></div><div>Yes: the variable would be referenced if the relevant DenseMap specialization were completely instantiated...</div><div><br></div><div>I'm still thinking about it, but the best approach might be to just use LLVM_ATTRIBUTE_UNUSED markings.</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><br></div><div>This sort of thing occurs here, lib/Transforms/InstCombine/InstCombinePHI.cpp:608, tools/clang/lib/Sema/SemaType.cpp:256 and lib/Rewrite/Frontend/RewriteModernObjC.cpp:61.</div><div><br></div><div>The others are various:</div>


<div><div><pre style="line-height:18px;white-space:pre-wrap;margin-bottom:0px;margin-top:0px;padding:1em 0px"><span style="font-weight:bold">lib/CodeGen/RegAllocGreedy.cpp:123:28: </span><span style="font-weight:bold;color:rgb(102,0,0)">error: </span><span style="font-weight:bold">unused variable 'StageName' [-Werror,-Wunused-variable]</span>
  static const char *const StageName[];
<span style="font-weight:bold;color:rgb(0,128,0)">                           ^</span></pre><pre style="line-height:18px;white-space:pre-wrap;margin-bottom:0px;margin-top:0px;padding:1em 0px"><span style="font-family:arial;line-height:normal;color:rgb(34,34,34)">StageName is only used in debug builds. I suppose we can fix it with (void)StageName?</span></pre>
</div></div></div></div></div></blockquote><div><br></div><div>Yes, or put it in an "#ifndef NDEBUG".</div><div> </div><div>-Eli</div></div><br></div></div>