[llvm-commits] [llvm] r116920 - /llvm/trunk/include/llvm/Support/Compiler.h
Bill Wendling
wendling at apple.com
Wed Oct 20 17:38:18 PDT 2010
On Oct 20, 2010, at 1:44 AM, Chandler Carruth wrote:
> Author: chandlerc
> Date: Wed Oct 20 03:44:27 2010
> New Revision: 116920
>
> URL: http://llvm.org/viewvc/llvm-project?rev=116920&view=rev
> Log:
> Add a comment about ATTRIBUTE_UNUSED to avoid further confusion over when to
> use it.
>
There's no reason not to use this for variables. And it avoids the void-casting hack.
-bw
> Modified:
> llvm/trunk/include/llvm/Support/Compiler.h
>
> Modified: llvm/trunk/include/llvm/Support/Compiler.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Compiler.h?rev=116920&r1=116919&r2=116920&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/Support/Compiler.h (original)
> +++ llvm/trunk/include/llvm/Support/Compiler.h Wed Oct 20 03:44:27 2010
> @@ -31,6 +31,14 @@
> #define ATTRIBUTE_USED
> #endif
>
> +// Some compilers warn about unused functions. When a function is sometimes
> +// used or not depending on build settings (e.g. a function only called from
> +// within "assert"), this attribute can be used to suppress such warnings.
> +//
> +// However, it shouldn't be used for unused *variables*, as those have a much
> +// more portable solution:
> +// (void)unused_var_name;
> +// Prefer cast-to-void wherever it is sufficient.
> #if (__GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
> #define ATTRIBUTE_UNUSED __attribute__((__unused__))
> #else
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20101020/9cd04a66/attachment.html>
More information about the llvm-commits
mailing list