aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2010-10-20 08:44:27 +0000
committerChandler Carruth <chandlerc@gmail.com>2010-10-20 08:44:27 +0000
commit7283da51b8860ca9af4cb5ca082f7bcca3894d99 (patch)
tree954a09053d7887a821853980ea80257bfa842fb6 /include
parent1cd9708f5cc13995a4e84ef498e4162a47f8b4f5 (diff)
downloadexternal_llvm-7283da51b8860ca9af4cb5ca082f7bcca3894d99.zip
external_llvm-7283da51b8860ca9af4cb5ca082f7bcca3894d99.tar.gz
external_llvm-7283da51b8860ca9af4cb5ca082f7bcca3894d99.tar.bz2
Add a comment about ATTRIBUTE_UNUSED to avoid further confusion over when to
use it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116920 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/Support/Compiler.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/llvm/Support/Compiler.h b/include/llvm/Support/Compiler.h
index 9ff7817..014e801 100644
--- a/include/llvm/Support/Compiler.h
+++ b/include/llvm/Support/Compiler.h
@@ -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