summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2011-07-21 10:56:37 +0100
committerCaolán McNamara <caolanm@redhat.com>2011-07-21 10:56:37 +0100
commitb09acc30c9f2f7b165959d35c19b808d16988a7c (patch)
tree97776dce60bb29df92863f1a17573ec0e9d9f01f /sal
parent861f8ece769bf05c138aac080706e0d97bf5fd10 (diff)
add a _attribute__((warn_unused_result)) based macro
Diffstat (limited to 'sal')
-rw-r--r--sal/inc/sal/types.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/sal/inc/sal/types.h b/sal/inc/sal/types.h
index 9954ff4eebe5..bf7d4109db3f 100644
--- a/sal/inc/sal/types.h
+++ b/sal/inc/sal/types.h
@@ -296,6 +296,18 @@ typedef void * sal_Handle;
#define SAL_EXCEPTION_DLLPRIVATE
#endif
+/** Use this as markup for functions and methods whose return value must be
+ checked.
+
+ Compilers that support a construct of this nature will emit a compile
+ time warning on unchecked return value.
+*/
+#if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
+# define SAL_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
+#else
+# define SAL_WARN_UNUSED_RESULT
+#endif
+
/** Use this for pure virtual classes, e.g. class SAL_NO_VTABLE Foo { ...
This hinders the compiler from setting a generic vtable stating that
a pure virtual function was called and thus slightly reduces code size.