+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__.
# 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
/* 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);
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 *);
#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
/* 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
# 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
#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
#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
# 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:
# 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. */
# 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
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);
# 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.
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
# 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
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)
{
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)
{
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)
{
# 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.
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);
#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.
void xstrtol_fatal (enum strtol_error,
int, char, struct option const *,
- char const *) ATTRIBUTE_NORETURN;
+ char const *) _GL_ATTRIBUTE_NORETURN;
#endif /* not XSTRTOL_H_ */
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
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
#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)