Hi Akim,

> > In file included from ../lib/bitsetv.c:21:
> > In file included from ../lib/bitsetv.h:24:
> > In file included from ../lib/bitset.h:31:
> > In file included from ../lib/bitset/base.h:28:
> > ../lib/xalloc.h:43:10: warning: '_GL_ATTRIBUTE_ALLOC_SIZE' macro redefined 
> > [-Wmacro-redefined]
> > # define _GL_ATTRIBUTE_ALLOC_SIZE(args)
> >          ^
> > ./lib/config.h:1657:10: note: previous definition is here
> > # define _GL_ATTRIBUTE_ALLOC_SIZE(args) __attribute__ ((__alloc_size__ 
> > args))
> >          ^

These two patches should fix these warnings.


2020-05-09  Bruno Haible  <br...@clisp.org>

        Remove redundant definitions of _GL_ATTRIBUTE_FORMAT.
        * lib/argp.h (_GL_ATTRIBUTE_FORMAT): Remove macro.
        * lib/argp-fmtstream.h (_GL_ATTRIBUTE_FORMAT): Likewise.
        * lib/c-snprintf.h (_GL_ATTRIBUTE_FORMAT): Likewise.
        * lib/c-vasnprintf.h (_GL_ATTRIBUTE_FORMAT): Likewise.
        * lib/c-vasprintf.h (_GL_ATTRIBUTE_FORMAT): Likewise.
        * lib/c-vsnprintf.h (_GL_ATTRIBUTE_FORMAT): Likewise.
        * lib/c-xvasprintf.h (_GL_ATTRIBUTE_FORMAT): Likewise.
        * lib/error.h (_GL_ATTRIBUTE_FORMAT): Likewise.
        * lib/parse-datetime.y (_GL_ATTRIBUTE_FORMAT): Likewise.
        * lib/vasnprintf.h (_GL_ATTRIBUTE_FORMAT): Likewise.
        * lib/xprintf.h (_GL_ATTRIBUTE_FORMAT): Likewise.
        * lib/xvasprintf.h (_GL_ATTRIBUTE_FORMAT): Likewise.

2020-05-09  Bruno Haible  <br...@clisp.org>

        Remove redundant definitions of _GL_ATTRIBUTE_ALLOC_SIZE.
        Reported by Akim Demaille in
        <https://lists.gnu.org/archive/html/bug-gnulib/2020-05/msg00077.html>.
        * lib/eealloc.h (_GL_ATTRIBUTE_ALLOC_SIZE): Remove macro.
        * lib/pagealign_alloc.h (_GL_ATTRIBUTE_ALLOC_SIZE): Likewise.
        * lib/xalloc.h (_GL_ATTRIBUTE_ALLOC_SIZE): Likewise.

>From 7dc2704acc113493518945b2f751dfb2882a698a Mon Sep 17 00:00:00 2001
From: Bruno Haible <br...@clisp.org>
Date: Sat, 9 May 2020 13:14:24 +0200
Subject: [PATCH 1/2] Remove redundant definitions of _GL_ATTRIBUTE_ALLOC_SIZE.

Reported by Akim Demaille in
<https://lists.gnu.org/archive/html/bug-gnulib/2020-05/msg00077.html>.

* lib/eealloc.h (_GL_ATTRIBUTE_ALLOC_SIZE): Remove macro.
* lib/pagealign_alloc.h (_GL_ATTRIBUTE_ALLOC_SIZE): Likewise.
* lib/xalloc.h (_GL_ATTRIBUTE_ALLOC_SIZE): Likewise.
---
 ChangeLog             | 9 +++++++++
 lib/eealloc.h         | 7 -------
 lib/pagealign_alloc.h | 7 -------
 lib/xalloc.h          | 7 -------
 4 files changed, 9 insertions(+), 21 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 7f19e4e..dff097d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2020-05-09  Bruno Haible  <br...@clisp.org>
 
+	Remove redundant definitions of _GL_ATTRIBUTE_ALLOC_SIZE.
+	Reported by Akim Demaille in
+	<https://lists.gnu.org/archive/html/bug-gnulib/2020-05/msg00077.html>.
+	* lib/eealloc.h (_GL_ATTRIBUTE_ALLOC_SIZE): Remove macro.
+	* lib/pagealign_alloc.h (_GL_ATTRIBUTE_ALLOC_SIZE): Likewise.
+	* lib/xalloc.h (_GL_ATTRIBUTE_ALLOC_SIZE): Likewise.
+
+2020-05-09  Bruno Haible  <br...@clisp.org>
+
 	stdio, monetary: Don't redefine _GL_ATTRIBUTE_FORMAT.
 	* lib/stdio.in.h (_GL_ATTRIBUTE_FORMAT): Don't override the definition
 	that usually comes from m4/gnulib-common.m4.
diff --git a/lib/eealloc.h b/lib/eealloc.h
index 351cbed..328268e 100644
--- a/lib/eealloc.h
+++ b/lib/eealloc.h
@@ -39,13 +39,6 @@ _GL_INLINE_HEADER_BEGIN
 # define EEALLOC_INLINE _GL_INLINE
 #endif
 
-#if ! defined __clang__ && \
-    (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
-# define _GL_ATTRIBUTE_ALLOC_SIZE(args) __attribute__ ((__alloc_size__ args))
-#else
-# define _GL_ATTRIBUTE_ALLOC_SIZE(args)
-#endif
-
 #if MALLOC_0_IS_NONNULL
 # define eemalloc malloc
 #else
diff --git a/lib/pagealign_alloc.h b/lib/pagealign_alloc.h
index 1459ec4..393eb18 100644
--- a/lib/pagealign_alloc.h
+++ b/lib/pagealign_alloc.h
@@ -20,13 +20,6 @@
 
 # include <stddef.h>
 
-#if ! defined __clang__ && \
-    (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
-# define _GL_ATTRIBUTE_ALLOC_SIZE(args) __attribute__ ((__alloc_size__ args))
-#else
-# define _GL_ATTRIBUTE_ALLOC_SIZE(args)
-#endif
-
 /* Allocate a block of memory of SIZE bytes, aligned on a system page
    boundary.
    If SIZE is not a multiple of the system page size, it will be rounded up
diff --git a/lib/xalloc.h b/lib/xalloc.h
index 19c64ac..24273ff 100644
--- a/lib/xalloc.h
+++ b/lib/xalloc.h
@@ -36,13 +36,6 @@ extern "C" {
 #endif
 
 
-#if ! defined __clang__ && \
-    (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
-# define _GL_ATTRIBUTE_ALLOC_SIZE(args) __attribute__ ((__alloc_size__ args))
-#else
-# define _GL_ATTRIBUTE_ALLOC_SIZE(args)
-#endif
-
 /* This function is always triggered when memory is exhausted.
    It must be defined by the application, either explicitly
    or by using gnulib's xalloc-die module.  This is the
-- 
2.7.4

>From 598afc1407a86340f948e5545f19c06afe13e059 Mon Sep 17 00:00:00 2001
From: Bruno Haible <br...@clisp.org>
Date: Sat, 9 May 2020 13:22:49 +0200
Subject: [PATCH 2/2] Remove redundant definitions of _GL_ATTRIBUTE_FORMAT.

* lib/argp.h (_GL_ATTRIBUTE_FORMAT): Remove macro.
* lib/argp-fmtstream.h (_GL_ATTRIBUTE_FORMAT): Likewise.
* lib/c-snprintf.h (_GL_ATTRIBUTE_FORMAT): Likewise.
* lib/c-vasnprintf.h (_GL_ATTRIBUTE_FORMAT): Likewise.
* lib/c-vasprintf.h (_GL_ATTRIBUTE_FORMAT): Likewise.
* lib/c-vsnprintf.h (_GL_ATTRIBUTE_FORMAT): Likewise.
* lib/c-xvasprintf.h (_GL_ATTRIBUTE_FORMAT): Likewise.
* lib/error.h (_GL_ATTRIBUTE_FORMAT): Likewise.
* lib/parse-datetime.y (_GL_ATTRIBUTE_FORMAT): Likewise.
* lib/vasnprintf.h (_GL_ATTRIBUTE_FORMAT): Likewise.
* lib/xprintf.h (_GL_ATTRIBUTE_FORMAT): Likewise.
* lib/xvasprintf.h (_GL_ATTRIBUTE_FORMAT): Likewise.
---
 ChangeLog            | 16 ++++++++++++++++
 lib/argp-fmtstream.h | 12 ------------
 lib/argp.h           | 12 ------------
 lib/c-snprintf.h     | 12 ------------
 lib/c-vasnprintf.h   | 12 ------------
 lib/c-vasprintf.h    | 12 ------------
 lib/c-vsnprintf.h    | 12 ------------
 lib/c-xvasprintf.h   | 12 ------------
 lib/error.h          | 12 ------------
 lib/parse-datetime.y | 12 ------------
 lib/vasnprintf.h     | 12 ------------
 lib/xprintf.h        | 12 ------------
 lib/xvasprintf.h     | 12 ------------
 13 files changed, 16 insertions(+), 144 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index dff097d..85c5af9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,21 @@
 2020-05-09  Bruno Haible  <br...@clisp.org>
 
+	Remove redundant definitions of _GL_ATTRIBUTE_FORMAT.
+	* lib/argp.h (_GL_ATTRIBUTE_FORMAT): Remove macro.
+	* lib/argp-fmtstream.h (_GL_ATTRIBUTE_FORMAT): Likewise.
+	* lib/c-snprintf.h (_GL_ATTRIBUTE_FORMAT): Likewise.
+	* lib/c-vasnprintf.h (_GL_ATTRIBUTE_FORMAT): Likewise.
+	* lib/c-vasprintf.h (_GL_ATTRIBUTE_FORMAT): Likewise.
+	* lib/c-vsnprintf.h (_GL_ATTRIBUTE_FORMAT): Likewise.
+	* lib/c-xvasprintf.h (_GL_ATTRIBUTE_FORMAT): Likewise.
+	* lib/error.h (_GL_ATTRIBUTE_FORMAT): Likewise.
+	* lib/parse-datetime.y (_GL_ATTRIBUTE_FORMAT): Likewise.
+	* lib/vasnprintf.h (_GL_ATTRIBUTE_FORMAT): Likewise.
+	* lib/xprintf.h (_GL_ATTRIBUTE_FORMAT): Likewise.
+	* lib/xvasprintf.h (_GL_ATTRIBUTE_FORMAT): Likewise.
+
+2020-05-09  Bruno Haible  <br...@clisp.org>
+
 	Remove redundant definitions of _GL_ATTRIBUTE_ALLOC_SIZE.
 	Reported by Akim Demaille in
 	<https://lists.gnu.org/archive/html/bug-gnulib/2020-05/msg00077.html>.
diff --git a/lib/argp-fmtstream.h b/lib/argp-fmtstream.h
index e7713c4..8e4bc0d 100644
--- a/lib/argp-fmtstream.h
+++ b/lib/argp-fmtstream.h
@@ -28,18 +28,6 @@
 #include <string.h>
 #include <unistd.h>
 
-/* The __attribute__ feature is available in gcc versions 2.5 and later.
-   The __-protected variants of the attributes 'format' and 'printf' are
-   accepted by gcc versions 2.6.4 (effectively 2.7) and later.
-   We enable _GL_ATTRIBUTE_FORMAT only if these are supported too, because
-   gnulib and libintl do '#define printf __printf__' when they override
-   the 'printf' function.  */
-#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
-# define _GL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec))
-#else
-# define _GL_ATTRIBUTE_FORMAT(spec) /* empty */
-#endif
-
 #if defined (__GNU_LIBRARY__) && defined (HAVE_LINEWRAP_H)
 /* line_wrap_stream is available, so use that.  */
 #define ARGP_FMTSTREAM_USE_LINEWRAP
diff --git a/lib/argp.h b/lib/argp.h
index 4cc6563..808c900 100644
--- a/lib/argp.h
+++ b/lib/argp.h
@@ -34,18 +34,6 @@
 # define __NTH(fct) fct __THROW
 #endif
 
-/* The __attribute__ feature is available in gcc versions 2.5 and later.
-   The __-protected variants of the attributes 'format' and 'printf' are
-   accepted by gcc versions 2.6.4 (effectively 2.7) and later.
-   We enable _GL_ATTRIBUTE_FORMAT only if these are supported too, because
-   gnulib and libintl do '#define printf __printf__' when they override
-   the 'printf' function.  */
-#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
-# define _GL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec))
-#else
-# define _GL_ATTRIBUTE_FORMAT(spec) /* empty */
-#endif
-
 /* GCC 2.95 and later have "__restrict"; C99 compilers have
    "restrict", and "configure" may have defined "restrict".
    Other compilers use __restrict, __restrict__, and _Restrict, and
diff --git a/lib/c-snprintf.h b/lib/c-snprintf.h
index d82f354..e03ef88 100644
--- a/lib/c-snprintf.h
+++ b/lib/c-snprintf.h
@@ -20,18 +20,6 @@
 /* Get size_t.  */
 #include <stddef.h>
 
-/* The __attribute__ feature is available in gcc versions 2.5 and later.
-   The __-protected variants of the attributes 'format' and 'printf' are
-   accepted by gcc versions 2.6.4 (effectively 2.7) and later.
-   We enable _GL_ATTRIBUTE_FORMAT only if these are supported too, because
-   gnulib and libintl do '#define printf __printf__' when they override
-   the 'printf' function.  */
-#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
-# define _GL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec))
-#else
-# define _GL_ATTRIBUTE_FORMAT(spec) /* empty */
-#endif
-
 #ifdef __cplusplus
 extern "C" {
 #endif
diff --git a/lib/c-vasnprintf.h b/lib/c-vasnprintf.h
index 0f58fb8..b9853f6 100644
--- a/lib/c-vasnprintf.h
+++ b/lib/c-vasnprintf.h
@@ -23,18 +23,6 @@
 /* Get size_t.  */
 #include <stddef.h>
 
-/* The __attribute__ feature is available in gcc versions 2.5 and later.
-   The __-protected variants of the attributes 'format' and 'printf' are
-   accepted by gcc versions 2.6.4 (effectively 2.7) and later.
-   We enable _GL_ATTRIBUTE_FORMAT only if these are supported too, because
-   gnulib and libintl do '#define printf __printf__' when they override
-   the 'printf' function.  */
-#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
-# define _GL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec))
-#else
-# define _GL_ATTRIBUTE_FORMAT(spec) /* empty */
-#endif
-
 #ifdef __cplusplus
 extern "C" {
 #endif
diff --git a/lib/c-vasprintf.h b/lib/c-vasprintf.h
index 3b5b5f7..588fbf0 100644
--- a/lib/c-vasprintf.h
+++ b/lib/c-vasprintf.h
@@ -20,18 +20,6 @@
 /* Get va_list.  */
 #include <stdarg.h>
 
-/* The __attribute__ feature is available in gcc versions 2.5 and later.
-   The __-protected variants of the attributes 'format' and 'printf' are
-   accepted by gcc versions 2.6.4 (effectively 2.7) and later.
-   We enable _GL_ATTRIBUTE_FORMAT only if these are supported too, because
-   gnulib and libintl do '#define printf __printf__' when they override
-   the 'printf' function.  */
-#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
-# define _GL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec))
-#else
-# define _GL_ATTRIBUTE_FORMAT(spec) /* empty */
-#endif
-
 #ifdef __cplusplus
 extern "C" {
 #endif
diff --git a/lib/c-vsnprintf.h b/lib/c-vsnprintf.h
index e296871..6e39102 100644
--- a/lib/c-vsnprintf.h
+++ b/lib/c-vsnprintf.h
@@ -23,18 +23,6 @@
 /* Get va_list. */
 #include <stdarg.h>
 
-/* The __attribute__ feature is available in gcc versions 2.5 and later.
-   The __-protected variants of the attributes 'format' and 'printf' are
-   accepted by gcc versions 2.6.4 (effectively 2.7) and later.
-   We enable _GL_ATTRIBUTE_FORMAT only if these are supported too, because
-   gnulib and libintl do '#define printf __printf__' when they override
-   the 'printf' function.  */
-#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
-# define _GL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec))
-#else
-# define _GL_ATTRIBUTE_FORMAT(spec) /* empty */
-#endif
-
 #ifdef __cplusplus
 extern "C" {
 #endif
diff --git a/lib/c-xvasprintf.h b/lib/c-xvasprintf.h
index d8f64cd..1d3a551 100644
--- a/lib/c-xvasprintf.h
+++ b/lib/c-xvasprintf.h
@@ -20,18 +20,6 @@
 /* Get va_list.  */
 #include <stdarg.h>
 
-/* The __attribute__ feature is available in gcc versions 2.5 and later.
-   The __-protected variants of the attributes 'format' and 'printf' are
-   accepted by gcc versions 2.6.4 (effectively 2.7) and later.
-   We enable _GL_ATTRIBUTE_FORMAT only if these are supported too, because
-   gnulib and libintl do '#define printf __printf__' when they override
-   the 'printf' function.  */
-#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
-# define _GL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec))
-#else
-# define _GL_ATTRIBUTE_FORMAT(spec) /* empty */
-#endif
-
 #ifdef __cplusplus
 extern "C" {
 #endif
diff --git a/lib/error.h b/lib/error.h
index bad47a1..a351606 100644
--- a/lib/error.h
+++ b/lib/error.h
@@ -19,18 +19,6 @@
 #ifndef _ERROR_H
 #define _ERROR_H 1
 
-/* The __attribute__ feature is available in gcc versions 2.5 and later.
-   The __-protected variants of the attributes 'format' and 'printf' are
-   accepted by gcc versions 2.6.4 (effectively 2.7) and later.
-   We enable _GL_ATTRIBUTE_FORMAT only if these are supported too, because
-   gnulib and libintl do '#define printf __printf__' when they override
-   the 'printf' function.  */
-#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
-# define _GL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec))
-#else
-# define _GL_ATTRIBUTE_FORMAT(spec) /* empty */
-#endif
-
 /* On mingw, the flavor of printf depends on whether the extensions module
  * is in use; the check for <stdio.h> determines the witness macro.  */
 #ifndef _GL_ATTRIBUTE_SPEC_PRINTF
diff --git a/lib/parse-datetime.y b/lib/parse-datetime.y
index 206ff20..0c62467 100644
--- a/lib/parse-datetime.y
+++ b/lib/parse-datetime.y
@@ -82,18 +82,6 @@
 # define _STDLIB_H 1
 #endif
 
-/* The __attribute__ feature is available in gcc versions 2.5 and later.
-   The __-protected variants of the attributes 'format' and 'printf' are
-   accepted by gcc versions 2.6.4 (effectively 2.7) and later.
-   Enable _GL_ATTRIBUTE_FORMAT only if these are supported too, because
-   gnulib and libintl do '#define printf __printf__' when they override
-   the 'printf' function.  */
-#if 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
-# define _GL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec))
-#else
-# define _GL_ATTRIBUTE_FORMAT(spec) /* empty */
-#endif
-
 /* Shift A right by B bits portably, by dividing A by 2**B and
    truncating towards minus infinity.  A and B should be free of side
    effects, and B should be in the range 0 <= B <= INT_BITS - 2, where
diff --git a/lib/vasnprintf.h b/lib/vasnprintf.h
index 37777c9..5be0553 100644
--- a/lib/vasnprintf.h
+++ b/lib/vasnprintf.h
@@ -23,18 +23,6 @@
 /* Get size_t.  */
 #include <stddef.h>
 
-/* The __attribute__ feature is available in gcc versions 2.5 and later.
-   The __-protected variants of the attributes 'format' and 'printf' are
-   accepted by gcc versions 2.6.4 (effectively 2.7) and later.
-   We enable _GL_ATTRIBUTE_FORMAT only if these are supported too, because
-   gnulib and libintl do '#define printf __printf__' when they override
-   the 'printf' function.  */
-#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
-# define _GL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec))
-#else
-# define _GL_ATTRIBUTE_FORMAT(spec) /* empty */
-#endif
-
 #ifdef __cplusplus
 extern "C" {
 #endif
diff --git a/lib/xprintf.h b/lib/xprintf.h
index 18ca05c..d0615b4 100644
--- a/lib/xprintf.h
+++ b/lib/xprintf.h
@@ -20,18 +20,6 @@
 #include <stdarg.h>
 #include <stdio.h>
 
-/* The __attribute__ feature is available in gcc versions 2.5 and later.
-   The __-protected variants of the attributes 'format' and 'printf' are
-   accepted by gcc versions 2.6.4 (effectively 2.7) and later.
-   We enable _GL_ATTRIBUTE_FORMAT only if these are supported too, because
-   gnulib and libintl do '#define printf __printf__' when they override
-   the 'printf' function.  */
-#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
-# define _GL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec))
-#else
-# define _GL_ATTRIBUTE_FORMAT(spec) /* empty */
-#endif
-
 extern int xprintf (char const *restrict format, ...)
   _GL_ATTRIBUTE_FORMAT ((__printf__, 1, 2));
 extern int xvprintf (char const *restrict format, va_list args)
diff --git a/lib/xvasprintf.h b/lib/xvasprintf.h
index 8a64f53..ff43d1b 100644
--- a/lib/xvasprintf.h
+++ b/lib/xvasprintf.h
@@ -20,18 +20,6 @@
 /* Get va_list.  */
 #include <stdarg.h>
 
-/* The __attribute__ feature is available in gcc versions 2.5 and later.
-   The __-protected variants of the attributes 'format' and 'printf' are
-   accepted by gcc versions 2.6.4 (effectively 2.7) and later.
-   We enable _GL_ATTRIBUTE_FORMAT only if these are supported too, because
-   gnulib and libintl do '#define printf __printf__' when they override
-   the 'printf' function.  */
-#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
-# define _GL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec))
-#else
-# define _GL_ATTRIBUTE_FORMAT(spec) /* empty */
-#endif
-
 #ifdef __cplusplus
 extern "C" {
 #endif
-- 
2.7.4

Reply via email to