Mercurial > hg > octave-lyh > gnulib-hg
changeset 14351:724011432f7b
Consistent macro naming for macros that use GCC __attribute__.
* lib/di-set.h (_GL_ATTRIBUTE_NONNULL): Renamed from
_ATTRIBUTE_NONNULL_.
* lib/ino-map.h (_GL_ATTRIBUTE_NONNULL): Likewise.
* lib/hash.h (_GL_ATTRIBUTE_WUR): Renamed from ATTRIBUTE_WUR.
* lib/ignore-value.h (_GL_ATTRIBUTE_DEPRECATED): Renamed from
ATTRIBUTE_DEPRECATED.
* lib/openat.h (_GL_ATTRIBUTE_NORETURN): Renamed from
ATTRIBUTE_NORETURN.
* lib/sigpipe-die.h (_GL_ATTRIBUTE_NORETURN): Likewise.
* lib/xmemdup0.h (_GL_ATTRIBUTE_NORETURN): Likewise.
* lib/xstrtol.h (_GL_ATTRIBUTE_NORETURN): Likewise.
* lib/xalloc.h (_GL_ATTRIBUTE_NORETURN): Likewise.
(_GL_ATTRIBUTE_MALLOC): Renamed from ATTRIBUTE_MALLOC.
(_GL_ATTRIBUTE_ALLOC_SIZE): Renamed from ATTRIBUTE_ALLOC_SIZE.
* lib/version-etc.h (_GL_ATTRIBUTE_SENTINEL): Renamed from
ATTRIBUTE_SENTINEL.
* lib/safe-alloc.h (_GL_ATTRIBUTE_RETURN_CHECK): Renamed from
ATTRIBUTE_RETURN_CHECK.
* tests/test-ignore-value.c (_GL_ATTRIBUTE_RETURN_CHECK): Likewise.
* tests/test-argmatch.c (_GL_ATTRIBUTE_NORETURN): Renamed from
ATTRIBUTE_NORETURN.
* tests/test-exclude.c (_GL_ATTRIBUTE_NORETURN): Likewise.
Reported by Paul Eggert.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Sun, 13 Feb 2011 23:44:28 +0100 |
parents | 4cf3b58aaf12 |
children | dbcaf5d671d4 |
files | ChangeLog lib/di-set.h lib/hash.h lib/ignore-value.h lib/ino-map.h lib/openat.h lib/safe-alloc.h lib/sigpipe-die.h lib/version-etc.h lib/xalloc.h lib/xmemdup0.h lib/xstrtol.h tests/test-argmatch.c tests/test-exclude.c tests/test-ignore-value.c |
diffstat | 15 files changed, 102 insertions(+), 75 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,30 @@ +2011-02-13 Bruno Haible <bruno@clisp.org> + + Consistent macro naming for macros that use GCC __attribute__. + * lib/di-set.h (_GL_ATTRIBUTE_NONNULL): Renamed from + _ATTRIBUTE_NONNULL_. + * lib/ino-map.h (_GL_ATTRIBUTE_NONNULL): Likewise. + * lib/hash.h (_GL_ATTRIBUTE_WUR): Renamed from ATTRIBUTE_WUR. + * lib/ignore-value.h (_GL_ATTRIBUTE_DEPRECATED): Renamed from + ATTRIBUTE_DEPRECATED. + * lib/openat.h (_GL_ATTRIBUTE_NORETURN): Renamed from + ATTRIBUTE_NORETURN. + * lib/sigpipe-die.h (_GL_ATTRIBUTE_NORETURN): Likewise. + * lib/xmemdup0.h (_GL_ATTRIBUTE_NORETURN): Likewise. + * lib/xstrtol.h (_GL_ATTRIBUTE_NORETURN): Likewise. + * lib/xalloc.h (_GL_ATTRIBUTE_NORETURN): Likewise. + (_GL_ATTRIBUTE_MALLOC): Renamed from ATTRIBUTE_MALLOC. + (_GL_ATTRIBUTE_ALLOC_SIZE): Renamed from ATTRIBUTE_ALLOC_SIZE. + * lib/version-etc.h (_GL_ATTRIBUTE_SENTINEL): Renamed from + ATTRIBUTE_SENTINEL. + * lib/safe-alloc.h (_GL_ATTRIBUTE_RETURN_CHECK): Renamed from + ATTRIBUTE_RETURN_CHECK. + * tests/test-ignore-value.c (_GL_ATTRIBUTE_RETURN_CHECK): Likewise. + * tests/test-argmatch.c (_GL_ATTRIBUTE_NORETURN): Renamed from + ATTRIBUTE_NORETURN. + * tests/test-exclude.c (_GL_ATTRIBUTE_NORETURN): Likewise. + Reported by Paul Eggert. + 2011-02-13 Bruno Haible <bruno@clisp.org> Don't interfere with a program's definition of __attribute__.
--- a/lib/di-set.h +++ b/lib/di-set.h @@ -3,17 +3,17 @@ # include <sys/types.h> -# undef _ATTRIBUTE_NONNULL_ +# undef _GL_ATTRIBUTE_NONNULL # if __GNUC__ == 3 && __GNUC_MINOR__ >= 3 || 3 < __GNUC__ -# define _ATTRIBUTE_NONNULL_(m) __attribute__ ((__nonnull__ (m))) +# define _GL_ATTRIBUTE_NONNULL(m) __attribute__ ((__nonnull__ (m))) # else -# define _ATTRIBUTE_NONNULL_(m) +# define _GL_ATTRIBUTE_NONNULL(m) # endif struct di_set *di_set_alloc (void); -int di_set_insert (struct di_set *, dev_t, ino_t) _ATTRIBUTE_NONNULL_ (1); -void di_set_free (struct di_set *) _ATTRIBUTE_NONNULL_ (1); +int di_set_insert (struct di_set *, dev_t, ino_t) _GL_ATTRIBUTE_NONNULL (1); +void di_set_free (struct di_set *) _GL_ATTRIBUTE_NONNULL (1); int di_set_lookup (struct di_set *dis, dev_t dev, ino_t ino) - _ATTRIBUTE_NONNULL_ (1); + _GL_ATTRIBUTE_NONNULL (1); #endif
--- a/lib/hash.h +++ b/lib/hash.h @@ -30,9 +30,9 @@ /* The __attribute__ feature is available in gcc versions 2.5 and later. The warn_unused_result attribute appeared first in gcc-3.4.0. */ # if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) -# define ATTRIBUTE_WUR __attribute__ ((__warn_unused_result__)) +# define _GL_ATTRIBUTE_WUR __attribute__ ((__warn_unused_result__)) # else -# define ATTRIBUTE_WUR /* empty */ +# define _GL_ATTRIBUTE_WUR /* empty */ # endif typedef size_t (*Hash_hasher) (const void *, size_t); @@ -78,13 +78,13 @@ void hash_reset_tuning (Hash_tuning *); Hash_table *hash_initialize (size_t, const Hash_tuning *, Hash_hasher, Hash_comparator, - Hash_data_freer) ATTRIBUTE_WUR; + Hash_data_freer) _GL_ATTRIBUTE_WUR; void hash_clear (Hash_table *); void hash_free (Hash_table *); /* Insertion and deletion. */ -bool hash_rehash (Hash_table *, size_t) ATTRIBUTE_WUR; -void *hash_insert (Hash_table *, const void *) ATTRIBUTE_WUR; +bool hash_rehash (Hash_table *, size_t) _GL_ATTRIBUTE_WUR; +void *hash_insert (Hash_table *, const void *) _GL_ATTRIBUTE_WUR; int hash_insert0 (Hash_table *table, const void *entry, const void **matched_ent); void *hash_delete (Hash_table *, const void *);
--- a/lib/ignore-value.h +++ b/lib/ignore-value.h @@ -35,13 +35,13 @@ #ifndef _GL_IGNORE_VALUE_H # define _GL_IGNORE_VALUE_H -# ifndef ATTRIBUTE_DEPRECATED +# ifndef _GL_ATTRIBUTE_DEPRECATED /* The __attribute__((__deprecated__)) feature is available in gcc versions 3.1 and newer. */ # if __GNUC__ < 3 || (__GNUC__ == 3 && __GNUC_MINOR__ < 1) -# define ATTRIBUTE_DEPRECATED /* empty */ +# define _GL_ATTRIBUTE_DEPRECATED /* empty */ # else -# define ATTRIBUTE_DEPRECATED __attribute__ ((__deprecated__)) +# define _GL_ATTRIBUTE_DEPRECATED __attribute__ ((__deprecated__)) # endif # endif @@ -56,7 +56,7 @@ /* ignore_value works for scalars, pointers and aggregates; deprecate ignore_ptr. */ -static inline void ATTRIBUTE_DEPRECATED +static inline void _GL_ATTRIBUTE_DEPRECATED ignore_ptr (void *p) { (void) p; } /* deprecated: use ignore_value */ #endif
--- a/lib/ino-map.h +++ b/lib/ino-map.h @@ -3,17 +3,17 @@ # include <sys/types.h> -# undef _ATTRIBUTE_NONNULL_ +# undef _GL_ATTRIBUTE_NONNULL # if __GNUC__ == 3 && __GNUC_MINOR__ >= 3 || 3 < __GNUC__ -# define _ATTRIBUTE_NONNULL_(m) __attribute__ ((__nonnull__ (m))) +# define _GL_ATTRIBUTE_NONNULL(m) __attribute__ ((__nonnull__ (m))) # else -# define _ATTRIBUTE_NONNULL_(m) +# define _GL_ATTRIBUTE_NONNULL(m) # endif # define INO_MAP_INSERT_FAILURE ((size_t) -1) struct ino_map *ino_map_alloc (size_t); -void ino_map_free (struct ino_map *) _ATTRIBUTE_NONNULL_ (1); -size_t ino_map_insert (struct ino_map *, ino_t) _ATTRIBUTE_NONNULL_ (1); +void ino_map_free (struct ino_map *) _GL_ATTRIBUTE_NONNULL (1); +size_t ino_map_insert (struct ino_map *, ino_t) _GL_ATTRIBUTE_NONNULL (1); #endif
--- a/lib/openat.h +++ b/lib/openat.h @@ -28,9 +28,9 @@ #include <stdbool.h> #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8) -# define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__)) +# define _GL_ATTRIBUTE_NORETURN __attribute__ ((__noreturn__)) #else -# define ATTRIBUTE_NORETURN /* empty */ +# define _GL_ATTRIBUTE_NORETURN /* empty */ #endif #if !HAVE_OPENAT @@ -47,8 +47,8 @@ #endif -void openat_restore_fail (int) ATTRIBUTE_NORETURN; -void openat_save_fail (int) ATTRIBUTE_NORETURN; +void openat_restore_fail (int) _GL_ATTRIBUTE_NORETURN; +void openat_save_fail (int) _GL_ATTRIBUTE_NORETURN; /* Using these function names makes application code slightly more readable than it would be with
--- a/lib/safe-alloc.h +++ b/lib/safe-alloc.h @@ -31,22 +31,22 @@ # endif #endif -# ifndef ATTRIBUTE_RETURN_CHECK +# ifndef _GL_ATTRIBUTE_RETURN_CHECK # if __GNUC_PREREQ (3, 4) -# define ATTRIBUTE_RETURN_CHECK __attribute__((__warn_unused_result__)) +# define _GL_ATTRIBUTE_RETURN_CHECK __attribute__((__warn_unused_result__)) # else -# define ATTRIBUTE_RETURN_CHECK +# define _GL_ATTRIBUTE_RETURN_CHECK # endif # endif /* Don't call these directly - use the macros below */ int safe_alloc_alloc_n (void *ptrptr, size_t size, size_t count, int zeroed) - ATTRIBUTE_RETURN_CHECK; + _GL_ATTRIBUTE_RETURN_CHECK; int safe_alloc_realloc_n (void *ptrptr, size_t size, size_t count) - ATTRIBUTE_RETURN_CHECK; + _GL_ATTRIBUTE_RETURN_CHECK; /** * ALLOC:
--- a/lib/sigpipe-die.h +++ b/lib/sigpipe-die.h @@ -48,14 +48,14 @@ # if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8) -# define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__)) +# define _GL_ATTRIBUTE_NORETURN __attribute__ ((__noreturn__)) # else -# define ATTRIBUTE_NORETURN /* empty */ +# define _GL_ATTRIBUTE_NORETURN /* empty */ # endif /* Emit an error message indicating a SIGPIPE signal, and terminate the process with an error code. */ -extern void sigpipe_die (void) ATTRIBUTE_NORETURN; +extern void sigpipe_die (void) _GL_ATTRIBUTE_NORETURN; /* Install a SIGPIPE handler that invokes PREPARE_DIE and then emits an error message and exits. PREPARE_DIE may be NULL, meaning a no-op. */
--- a/lib/version-etc.h +++ b/lib/version-etc.h @@ -23,11 +23,11 @@ # include <stdio.h> /* The `sentinel' attribute was added in gcc 4.0. */ -#ifndef ATTRIBUTE_SENTINEL +#ifndef _GL_ATTRIBUTE_SENTINEL # if 4 <= __GNUC__ -# define ATTRIBUTE_SENTINEL __attribute__ ((__sentinel__)) +# define _GL_ATTRIBUTE_SENTINEL __attribute__ ((__sentinel__)) # else -# define ATTRIBUTE_SENTINEL /* empty */ +# define _GL_ATTRIBUTE_SENTINEL /* empty */ # endif #endif @@ -70,7 +70,7 @@ const char *command_name, const char *package, const char *version, /* const char *author1, ..., NULL */ ...) - ATTRIBUTE_SENTINEL; + _GL_ATTRIBUTE_SENTINEL; /* Display the usual `Report bugs to' stanza */ extern void emit_bug_reporting_address (void);
--- a/lib/xalloc.h +++ b/lib/xalloc.h @@ -27,21 +27,21 @@ # if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8) -# define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__)) +# define _GL_ATTRIBUTE_NORETURN __attribute__ ((__noreturn__)) # else -# define ATTRIBUTE_NORETURN /* empty */ +# define _GL_ATTRIBUTE_NORETURN /* empty */ # endif # if __GNUC__ >= 3 -# define ATTRIBUTE_MALLOC __attribute__ ((__malloc__)) +# define _GL_ATTRIBUTE_MALLOC __attribute__ ((__malloc__)) # else -# define ATTRIBUTE_MALLOC +# define _GL_ATTRIBUTE_MALLOC # endif # if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) -# define ATTRIBUTE_ALLOC_SIZE(args) __attribute__ ((__alloc_size__ args)) +# define _GL_ATTRIBUTE_ALLOC_SIZE(args) __attribute__ ((__alloc_size__ args)) # else -# define ATTRIBUTE_ALLOC_SIZE(args) +# define _GL_ATTRIBUTE_ALLOC_SIZE(args) # endif /* This function is always triggered when memory is exhausted. @@ -49,21 +49,21 @@ or by using gnulib's xalloc-die module. This is the function to call when one wants the program to die because of a memory allocation failure. */ -extern void xalloc_die (void) ATTRIBUTE_NORETURN; +extern void xalloc_die (void) _GL_ATTRIBUTE_NORETURN; void *xmalloc (size_t s) - ATTRIBUTE_MALLOC ATTRIBUTE_ALLOC_SIZE ((1)); + _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_ALLOC_SIZE ((1)); void *xzalloc (size_t s) - ATTRIBUTE_MALLOC ATTRIBUTE_ALLOC_SIZE ((1)); + _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_ALLOC_SIZE ((1)); void *xcalloc (size_t n, size_t s) - ATTRIBUTE_MALLOC ATTRIBUTE_ALLOC_SIZE ((1, 2)); + _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_ALLOC_SIZE ((1, 2)); void *xrealloc (void *p, size_t s) - ATTRIBUTE_ALLOC_SIZE ((2)); + _GL_ATTRIBUTE_ALLOC_SIZE ((2)); void *x2realloc (void *p, size_t *pn); void *xmemdup (void const *p, size_t s) - ATTRIBUTE_MALLOC ATTRIBUTE_ALLOC_SIZE ((2)); + _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_ALLOC_SIZE ((2)); char *xstrdup (char const *str) - ATTRIBUTE_MALLOC; + _GL_ATTRIBUTE_MALLOC; /* Return 1 if an array of N objects, each of size S, cannot exist due to size arithmetic overflow. S must be positive and N must be @@ -111,12 +111,12 @@ # define static_inline static inline # else void *xnmalloc (size_t n, size_t s) - ATTRIBUTE_MALLOC ATTRIBUTE_ALLOC_SIZE ((1, 2)); + _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_ALLOC_SIZE ((1, 2)); void *xnrealloc (void *p, size_t n, size_t s) - ATTRIBUTE_ALLOC_SIZE ((2, 3)); + _GL_ATTRIBUTE_ALLOC_SIZE ((2, 3)); void *x2nrealloc (void *p, size_t *pn, size_t s); char *xcharalloc (size_t n) - ATTRIBUTE_MALLOC ATTRIBUTE_ALLOC_SIZE ((1)); + _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_ALLOC_SIZE ((1)); # endif # ifdef static_inline @@ -125,7 +125,7 @@ dynamically, with error checking. S must be nonzero. */ static_inline void *xnmalloc (size_t n, size_t s) - ATTRIBUTE_MALLOC ATTRIBUTE_ALLOC_SIZE ((1, 2)); + _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_ALLOC_SIZE ((1, 2)); static_inline void * xnmalloc (size_t n, size_t s) { @@ -138,7 +138,7 @@ objects each of S bytes, with error checking. S must be nonzero. */ static_inline void *xnrealloc (void *p, size_t n, size_t s) - ATTRIBUTE_ALLOC_SIZE ((2, 3)); + _GL_ATTRIBUTE_ALLOC_SIZE ((2, 3)); static_inline void * xnrealloc (void *p, size_t n, size_t s) { @@ -240,7 +240,7 @@ except it returns char *. */ static_inline char *xcharalloc (size_t n) - ATTRIBUTE_MALLOC ATTRIBUTE_ALLOC_SIZE ((1)); + _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_ALLOC_SIZE ((1)); static_inline char * xcharalloc (size_t n) {
--- a/lib/xmemdup0.h +++ b/lib/xmemdup0.h @@ -26,9 +26,9 @@ # endif # if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8) -# define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__)) +# define _GL_ATTRIBUTE_NORETURN __attribute__ ((__noreturn__)) # else -# define ATTRIBUTE_NORETURN /* empty */ +# define _GL_ATTRIBUTE_NORETURN /* empty */ # endif /* This function is always triggered when memory is exhausted. @@ -36,7 +36,7 @@ or by using gnulib's xalloc-die module. This is the function to call when one wants the program to die because of a memory allocation failure. */ -extern void xalloc_die (void) ATTRIBUTE_NORETURN; +extern void xalloc_die (void) _GL_ATTRIBUTE_NORETURN; char *xmemdup0 (void const *p, size_t s);
--- a/lib/xstrtol.h +++ b/lib/xstrtol.h @@ -52,9 +52,9 @@ #endif #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8) -# define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__)) +# define _GL_ATTRIBUTE_NORETURN __attribute__ ((__noreturn__)) #else -# define ATTRIBUTE_NORETURN /* empty */ +# define _GL_ATTRIBUTE_NORETURN /* empty */ #endif /* Report an error for an invalid integer in an option argument. @@ -74,6 +74,6 @@ void xstrtol_fatal (enum strtol_error, int, char, struct option const *, - char const *) ATTRIBUTE_NORETURN; + char const *) _GL_ATTRIBUTE_NORETURN; #endif /* not XSTRTOL_H_ */
--- a/tests/test-argmatch.c +++ b/tests/test-argmatch.c @@ -30,12 +30,12 @@ thus must link with a definition of that function. Provide it here. */ #ifdef ARGMATCH_DIE_DECL # if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8) -# define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__)) +# define _GL_ATTRIBUTE_NORETURN __attribute__ ((__noreturn__)) # else -# define ATTRIBUTE_NORETURN /* empty */ +# define _GL_ATTRIBUTE_NORETURN /* empty */ # endif -ARGMATCH_DIE_DECL ATTRIBUTE_NORETURN; +ARGMATCH_DIE_DECL _GL_ATTRIBUTE_NORETURN; ARGMATCH_DIE_DECL { exit (1); } #endif
--- a/tests/test-exclude.c +++ b/tests/test-exclude.c @@ -64,13 +64,13 @@ thus must link with a definition of that function. Provide it here. */ #ifdef ARGMATCH_DIE_DECL # if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8) -# define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__)) +# define _GL_ATTRIBUTE_NORETURN __attribute__ ((__noreturn__)) # else -# define ATTRIBUTE_NORETURN /* empty */ +# define _GL_ATTRIBUTE_NORETURN /* empty */ # endif #endif -ARGMATCH_DIE_DECL ATTRIBUTE_NORETURN; +ARGMATCH_DIE_DECL _GL_ATTRIBUTE_NORETURN; ARGMATCH_DIE_DECL { exit (1); } #endif
--- a/tests/test-ignore-value.c +++ b/tests/test-ignore-value.c @@ -23,20 +23,20 @@ #include <stdio.h> -#ifndef ATTRIBUTE_RETURN_CHECK +#ifndef _GL_ATTRIBUTE_RETURN_CHECK # if __GNUC__ < 3 || (__GNUC__ == 3 && __GNUC_MINOR__ < 1) -# define ATTRIBUTE_RETURN_CHECK +# define _GL_ATTRIBUTE_RETURN_CHECK # else -# define ATTRIBUTE_RETURN_CHECK __attribute__((__warn_unused_result__)) +# define _GL_ATTRIBUTE_RETURN_CHECK __attribute__((__warn_unused_result__)) # endif #endif struct s { int i; }; -static char doChar (void) ATTRIBUTE_RETURN_CHECK; -static int doInt (void) ATTRIBUTE_RETURN_CHECK; -static off_t doOff (void) ATTRIBUTE_RETURN_CHECK; -static void *doPtr (void) ATTRIBUTE_RETURN_CHECK; -static struct s doStruct (void) ATTRIBUTE_RETURN_CHECK; +static char doChar (void) _GL_ATTRIBUTE_RETURN_CHECK; +static int doInt (void) _GL_ATTRIBUTE_RETURN_CHECK; +static off_t doOff (void) _GL_ATTRIBUTE_RETURN_CHECK; +static void *doPtr (void) _GL_ATTRIBUTE_RETURN_CHECK; +static struct s doStruct (void) _GL_ATTRIBUTE_RETURN_CHECK; static char doChar (void)