summaryrefslogtreecommitdiff
path: root/include/llvm/Support/Compiler.h
diff options
context:
space:
mode:
authorJakub Staszak <kubastaszak@gmail.com>2013-08-19 19:02:33 +0000
committerJakub Staszak <kubastaszak@gmail.com>2013-08-19 19:02:33 +0000
commit630d17566793c7f25a05cd407ab9b79a1756966a (patch)
tree53b5ffc19ae4785bc49e2cdb7ede050cb59829ba /include/llvm/Support/Compiler.h
parent2b762cc75df2cbab21b5a1945fdf913a66de0f81 (diff)
downloadllvm-630d17566793c7f25a05cd407ab9b79a1756966a.tar.gz
llvm-630d17566793c7f25a05cd407ab9b79a1756966a.tar.bz2
llvm-630d17566793c7f25a05cd407ab9b79a1756966a.tar.xz
Add definition of __warn_unused_result__ attribute. It will be used in the
futher commits. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188689 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Support/Compiler.h')
-rw-r--r--include/llvm/Support/Compiler.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/llvm/Support/Compiler.h b/include/llvm/Support/Compiler.h
index feac9348dd..c32a48546c 100644
--- a/include/llvm/Support/Compiler.h
+++ b/include/llvm/Support/Compiler.h
@@ -179,6 +179,12 @@
#define LLVM_ATTRIBUTE_USED
#endif
+#if __has_attribute(warn_unused_result) || __GNUC_PREREQ(3, 4)
+#define LLVM_ATTRIBUTE_UNUSED_RESULT __attribute__((__warn_unused_result__))
+#else
+#define LLVM_ATTRIBUTE_UNUSED_RESULT
+#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.