]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
system.h: define ATTRIBUTE_WARN_UNUSED_RESULT
authorJim Meyering <meyering@redhat.com>
Mon, 5 Jul 2010 15:16:23 +0000 (17:16 +0200)
committerJim Meyering <meyering@redhat.com>
Mon, 5 Jul 2010 15:39:46 +0000 (17:39 +0200)
* src/system.h (ATTRIBUTE_WARN_UNUSED_RESULT): Define.

src/system.h

index 859b663b9f0d6fbf5213d8ef397ff9397bf4f448..9e1468172abd6f28f7d099505c420808ed89a723 100644 (file)
@@ -483,6 +483,14 @@ enum
 # define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
 #endif
 
+/* The warn_unused_result attribute appeared first in gcc-3.4.0 */
+#undef ATTRIBUTE_WARN_UNUSED_RESULT
+#if __GNUC__ < 3 || (__GNUC__ == 3 && __GNUC_MINOR__ < 4)
+# define ATTRIBUTE_WARN_UNUSED_RESULT /* empty */
+#else
+# define ATTRIBUTE_WARN_UNUSED_RESULT __attribute__ ((__warn_unused_result__))
+#endif
+
 #if defined strdupa
 # define ASSIGN_STRDUPA(DEST, S)               \
   do { DEST = strdupa (S); } while (0)