summaryrefslogtreecommitdiff
path: root/lib/xalloc.h
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2011-02-13 23:21:20 +0100
committerBruno Haible <bruno@clisp.org>2011-02-15 02:31:02 +0100
commitf6a5a124d0cb326acd4dfa9ce3276baa26734b16 (patch)
tree51c769d136f2dc11801b2191686cd03955c2d82b /lib/xalloc.h
parente7a3c769e98d9054d3d9f6983e678397b0b7cb94 (diff)
downloadgnulib-f6a5a124d0cb326acd4dfa9ce3276baa26734b16.tar.gz
Don't interfere with a program's definition of __attribute__.
* lib/argp.h (__attribute__): Remove definition. (_GL_ATTRIBUTE_FORMAT): New macro. (argp_error, __argp_error, argp_failure, __argp_failure): Use it. * lib/argp-fmtstream.h (__attribute__): Remove definition. (_GL_ATTRIBUTE_FORMAT): New macro. (__argp_fmtstream_printf, argp_fmtstream_printf): Use it. * lib/argp-help.c (hol_entry_long_iterate): Use __attribute__ only for GCC 3 or newer. * lib/error.h (__attribute__): Remove definition. (_GL_ATTRIBUTE_FORMAT): New macro. (error, error_at_line): Use it. * lib/hash.h (__attribute__): Remove definition. (ATTRIBUTE_WUR): Update definition. Define always. * lib/openat.h (__attribute__): Remove definition. (ATTRIBUTE_NORETURN): Update definition. Define always. * lib/sigpipe-die.h (__attribute__): Remove definition. (ATTRIBUTE_NORETURN): Update definition. Define always. * lib/vasnprintf.h (__attribute__): Remove definition. (_GL_ATTRIBUTE_FORMAT): New macro. (asnprintf, vasnprintf): Use it. * lib/xalloc.h (__attribute__): Remove definition. (ATTRIBUTE_NORETURN): Update definition. Define always. (ATTRIBUTE_MALLOC, ATTRIBUTE_ALLOC_SIZE): Define always. * lib/xmemdup0.h (__attribute__): Remove definition. (ATTRIBUTE_NORETURN): Update definition. Define always. * lib/xprintf.h (__attribute__): Remove definition. (_GL_ATTRIBUTE_FORMAT): New macro. (xprintf, xvprintf, xfprintf, xvfprintf): Use it. * lib/xstrtol.h (__attribute__): Remove definition. (ATTRIBUTE_NORETURN): Update definition. Define always. * lib/xvasprintf.h (__attribute__): Remove definition. (_GL_ATTRIBUTE_FORMAT): New macro. (xasprintf, xvasprintf): Use it. * tests/test-argmatch.c (__attribute__): Remove definition. (ATTRIBUTE_NORETURN): Update definition. Define always. * tests/test-exclude.c (__attribute__): Remove definition. (ATTRIBUTE_NORETURN): Update definition. Define always. Reported by Paul Eggert.
Diffstat (limited to 'lib/xalloc.h')
-rw-r--r--lib/xalloc.h30
1 files changed, 11 insertions, 19 deletions
diff --git a/lib/xalloc.h b/lib/xalloc.h
index aaec116854..30823b7be2 100644
--- a/lib/xalloc.h
+++ b/lib/xalloc.h
@@ -26,30 +26,22 @@ extern "C" {
# endif
-# ifndef __attribute__
-# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8)
-# define __attribute__(x)
-# endif
-# endif
-
-# ifndef ATTRIBUTE_NORETURN
+# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8)
# define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__))
+# else
+# define ATTRIBUTE_NORETURN /* empty */
# endif
-# ifndef ATTRIBUTE_MALLOC
-# if __GNUC__ >= 3
-# define ATTRIBUTE_MALLOC __attribute__ ((__malloc__))
-# else
-# define ATTRIBUTE_MALLOC
-# endif
+# if __GNUC__ >= 3
+# define ATTRIBUTE_MALLOC __attribute__ ((__malloc__))
+# else
+# define ATTRIBUTE_MALLOC
# endif
-# ifndef ATTRIBUTE_ALLOC_SIZE
-# if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
-# define ATTRIBUTE_ALLOC_SIZE(args) __attribute__ ((__alloc_size__ args))
-# else
-# define ATTRIBUTE_ALLOC_SIZE(args)
-# endif
+# if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
+# define ATTRIBUTE_ALLOC_SIZE(args) __attribute__ ((__alloc_size__ args))
+# else
+# define ATTRIBUTE_ALLOC_SIZE(args)
# endif
/* This function is always triggered when memory is exhausted.