summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2009-09-07 11:16:16 +0300
committerPanu Matilainen <pmatilai@redhat.com>2009-09-07 11:16:16 +0300
commitc51a167cb758aa378e27a9065b1641f758b11cac (patch)
tree7263c3551c296816336aa8da1c8fb338b4a5b42c
parentd8cffcff15cb74d4b2db124711a16afdfc079500 (diff)
downloadrpm-c51a167cb758aa378e27a9065b1641f758b11cac.tar.gz
rpm-c51a167cb758aa378e27a9065b1641f758b11cac.tar.bz2
rpm-c51a167cb758aa378e27a9065b1641f758b11cac.zip
Add RPM_GNUC_NONNULL macro for portable use of gcc nonnull attribute
- gcc itself can only warn on literal NULL's passed where nonnull is expected but static analyzers can make better use of the info
-rw-r--r--rpmio/rpmutil.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/rpmio/rpmutil.h b/rpmio/rpmutil.h
index 19a7a9c23..746dae576 100644
--- a/rpmio/rpmutil.h
+++ b/rpmio/rpmutil.h
@@ -71,9 +71,12 @@
#endif /* __GNUC__ */
#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)
-# define RPM_GNUC_MAY_ALIAS __attribute__((may_alias))
+#define RPM_GNUC_MAY_ALIAS __attribute__((may_alias))
+#define RPM_GNUC_NONNULL( ... ) \
+ __attribute__((__nonnull__ (__VA_ARGS__)))
#else
-# define RPM_GNUC_MAY_ALIAS
+#define RPM_GNUC_MAY_ALIAS
+#define RPM_GNUC_NONNULL( ... )
#endif
#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)