Add definition of __warn_unused_result__ attribute. It will be used in the
authorJakub Staszak <kubastaszak@gmail.com>
Mon, 19 Aug 2013 19:02:33 +0000 (19:02 +0000)
committerJakub Staszak <kubastaszak@gmail.com>
Mon, 19 Aug 2013 19:02:33 +0000 (19:02 +0000)
futher commits.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188689 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Support/Compiler.h

index feac9348dd45126a29ca24dab4d46167a8ebb64a..c32a48546ce2515db78bbed9b935d81e1fac70cd 100644 (file)
 #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.