I wrote: > - In the lib/*.in.h header files, that may (in some circumstances) be used > without a preceding '#include <config.h>' and that therefore are > designed > to be as standalone as possible, you can use the _GL_ATTRIBUTE_* macros > if you have added a fallback definition.
The fallback definition was not guarded so far. It becomes relevant now that m4/gnulib-common.m4 contains the more elaborate definition. 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. * lib/monetary.in.h (_GL_ATTRIBUTE_FORMAT): Likewise. 2020-05-09 Bruno Haible <br...@clisp.org> dirent, stdlib, wchar, string: Don't redefine _GL_ATTRIBUTE_PURE. * lib/dirent.in.h (_GL_ATTRIBUTE_PURE): Don't override the definition that usually comes from m4/gnulib-common.m4. * lib/stdlib.in.h (_GL_ATTRIBUTE_PURE): Likewise. * lib/string.in.h (_GL_ATTRIBUTE_PURE): Likewise. * lib/wchar.in.h (_GL_ATTRIBUTE_PURE): Likewise.
>From dae13c0c738762e9522b100868364bd08a080321 Mon Sep 17 00:00:00 2001 From: Bruno Haible <br...@clisp.org> Date: Sat, 9 May 2020 12:50:57 +0200 Subject: [PATCH 1/2] dirent, stdlib, wchar, string: Don't redefine _GL_ATTRIBUTE_PURE. * lib/dirent.in.h (_GL_ATTRIBUTE_PURE): Don't override the definition that usually comes from m4/gnulib-common.m4. * lib/stdlib.in.h (_GL_ATTRIBUTE_PURE): Likewise. * lib/string.in.h (_GL_ATTRIBUTE_PURE): Likewise. * lib/wchar.in.h (_GL_ATTRIBUTE_PURE): Likewise. --- ChangeLog | 9 +++++++++ lib/dirent.in.h | 10 ++++++---- lib/stdlib.in.h | 10 ++++++---- lib/string.in.h | 10 ++++++---- lib/wchar.in.h | 10 ++++++---- 5 files changed, 33 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0d9ab54..065628f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,14 @@ 2020-05-09 Bruno Haible <br...@clisp.org> + dirent, stdlib, wchar, string: Don't redefine _GL_ATTRIBUTE_PURE. + * lib/dirent.in.h (_GL_ATTRIBUTE_PURE): Don't override the definition + that usually comes from m4/gnulib-common.m4. + * lib/stdlib.in.h (_GL_ATTRIBUTE_PURE): Likewise. + * lib/string.in.h (_GL_ATTRIBUTE_PURE): Likewise. + * lib/wchar.in.h (_GL_ATTRIBUTE_PURE): Likewise. + +2020-05-09 Bruno Haible <br...@clisp.org> + uchar: Work around incorrect char16_t, char32_t types on Haiku 2020. * lib/uchar.in.h (char16_t): Define as macro if GNULIB_OVERRIDES_CHAR16_T. diff --git a/lib/dirent.in.h b/lib/dirent.in.h index f7c2681..6fa44f0 100644 --- a/lib/dirent.in.h +++ b/lib/dirent.in.h @@ -57,10 +57,12 @@ typedef struct gl_directory DIR; /* The __attribute__ feature is available in gcc versions 2.5 and later. The attribute __pure__ was added in gcc 2.96. */ -#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) -# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) -#else -# define _GL_ATTRIBUTE_PURE /* empty */ +#ifndef _GL_ATTRIBUTE_PURE +# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) +# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) +# else +# define _GL_ATTRIBUTE_PURE /* empty */ +# endif #endif /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h index ec5f124..59f9e6c 100644 --- a/lib/stdlib.in.h +++ b/lib/stdlib.in.h @@ -101,10 +101,12 @@ struct random_data /* The __attribute__ feature is available in gcc versions 2.5 and later. The attribute __pure__ was added in gcc 2.96. */ -#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) -# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) -#else -# define _GL_ATTRIBUTE_PURE /* empty */ +#ifndef _GL_ATTRIBUTE_PURE +# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) +# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) +# else +# define _GL_ATTRIBUTE_PURE /* empty */ +# endif #endif /* The definition of _Noreturn is copied here. */ diff --git a/lib/string.in.h b/lib/string.in.h index 87155ca..d601450 100644 --- a/lib/string.in.h +++ b/lib/string.in.h @@ -54,10 +54,12 @@ /* The __attribute__ feature is available in gcc versions 2.5 and later. The attribute __pure__ was added in gcc 2.96. */ -#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) -# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) -#else -# define _GL_ATTRIBUTE_PURE /* empty */ +#ifndef _GL_ATTRIBUTE_PURE +# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) +# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) +# else +# define _GL_ATTRIBUTE_PURE /* empty */ +# endif #endif /* NetBSD 5.0 declares strsignal in <unistd.h>, not in <string.h>. */ diff --git a/lib/wchar.in.h b/lib/wchar.in.h index 040065a..e1fa92f 100644 --- a/lib/wchar.in.h +++ b/lib/wchar.in.h @@ -94,10 +94,12 @@ /* The __attribute__ feature is available in gcc versions 2.5 and later. The attribute __pure__ was added in gcc 2.96. */ -#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) -# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) -#else -# define _GL_ATTRIBUTE_PURE /* empty */ +#ifndef _GL_ATTRIBUTE_PURE +# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) +# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) +# else +# define _GL_ATTRIBUTE_PURE /* empty */ +# endif #endif /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ -- 2.7.4
>From e75f9249df14b9292d39d3881441775905e35ac5 Mon Sep 17 00:00:00 2001 From: Bruno Haible <br...@clisp.org> Date: Sat, 9 May 2020 12:58:23 +0200 Subject: [PATCH 2/2] 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. * lib/monetary.in.h (_GL_ATTRIBUTE_FORMAT): Likewise. --- ChangeLog | 7 +++++++ lib/monetary.in.h | 10 ++++++---- lib/stdio.in.h | 10 ++++++---- 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 065628f..7f19e4e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 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. + * lib/monetary.in.h (_GL_ATTRIBUTE_FORMAT): Likewise. + +2020-05-09 Bruno Haible <br...@clisp.org> + dirent, stdlib, wchar, string: Don't redefine _GL_ATTRIBUTE_PURE. * lib/dirent.in.h (_GL_ATTRIBUTE_PURE): Don't override the definition that usually comes from m4/gnulib-common.m4. diff --git a/lib/monetary.in.h b/lib/monetary.in.h index 456a153..4061319 100644 --- a/lib/monetary.in.h +++ b/lib/monetary.in.h @@ -39,10 +39,12 @@ #endif /* Like in <stdio.h>. */ -#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) -# define _GL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec)) -#else -# define _GL_ATTRIBUTE_FORMAT(spec) /* empty */ +#ifndef _GL_ATTRIBUTE_FORMAT +# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) +# define _GL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec)) +# else +# define _GL_ATTRIBUTE_FORMAT(spec) /* empty */ +# endif #endif /* _GL_ATTRIBUTE_FORMAT_STRFMON diff --git a/lib/stdio.in.h b/lib/stdio.in.h index 839a14b..0823e62 100644 --- a/lib/stdio.in.h +++ b/lib/stdio.in.h @@ -62,10 +62,12 @@ 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 */ +#ifndef _GL_ATTRIBUTE_FORMAT +# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) +# define _GL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec)) +# else +# define _GL_ATTRIBUTE_FORMAT(spec) /* empty */ +# endif #endif /* _GL_ATTRIBUTE_FORMAT_PRINTF -- 2.7.4