<div class="gmail_quote">On Wed, Oct 20, 2010 at 5:38 PM, Bill Wendling <span dir="ltr"><<a href="mailto:wendling@apple.com">wendling@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div style="word-wrap:break-word"><div><div class="im"><div>On Oct 20, 2010, at 1:44 AM, Chandler Carruth wrote:</div><br><blockquote type="cite"><div>Author: chandlerc<br>Date: Wed Oct 20 03:44:27 2010<br>New Revision: 116920<br>
<br>URL: <a href="http://llvm.org/viewvc/llvm-project?rev=116920&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=116920&view=rev</a><br>Log:<br>Add a comment about ATTRIBUTE_UNUSED to avoid further confusion over when to<br>
use it.<br><br></div></blockquote></div><div>There's no reason not to use this for variables. And it avoids the void-casting hack.</div></div></div></blockquote><div><br></div><div>Chris expressly asked for the void-cast for variables: <a href="http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20100705/032066.html">http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20100705/032066.html</a></div>
<div><br></div><div>The comment I added was intended to help document this preference. I'll happily change it if you change Chris's mind. ;]</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div style="word-wrap:break-word"><div><div><br></div><font color="#888888"><div>-bw</div></font><div class="im"><br><blockquote type="cite"><div>Modified:<br>    llvm/trunk/include/llvm/Support/Compiler.h<br><br>Modified: llvm/trunk/include/llvm/Support/Compiler.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Compiler.h?rev=116920&r1=116919&r2=116920&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Compiler.h?rev=116920&r1=116919&r2=116920&view=diff</a><br>
==============================================================================<br>--- llvm/trunk/include/llvm/Support/Compiler.h (original)<br>+++ llvm/trunk/include/llvm/Support/Compiler.h Wed Oct 20 03:44:27 2010<br>@@ -31,6 +31,14 @@<br>
 #define ATTRIBUTE_USED<br> #endif<br><br>+// Some compilers warn about unused functions. When a function is sometimes<br>+// used or not depending on build settings (e.g. a function only called from<br>+// within "assert"), this attribute can be used to suppress such warnings.<br>
+//<br>+// However, it shouldn't be used for unused *variables*, as those have a much<br>+// more portable solution:<br>+//   (void)unused_var_name;<br>+// Prefer cast-to-void wherever it is sufficient.<br> #if (__GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))<br>
 #define ATTRIBUTE_UNUSED __attribute__((__unused__))<br> #else<br><br><br>_______________________________________________<br>llvm-commits mailing list<br><a href="mailto:llvm-commits@cs.uiuc.edu" target="_blank">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br></div></blockquote></div></div><br></div><br>_______________________________________________<br>

llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
<br></blockquote></div><br>