+2021-04-22 Paul Eggert <eggert@cs.ucla.edu>
+
+ libc-config: port better to Fedora Rawhide
+ Problem reported by Eric Blake in:
+ https://lists.gnu.org/r/bug-gnulib/2021-04/msg00181.html
+ * lib/cdefs.h: Make this closer to glibc, so that we can
+ merge Gnulib into glibc here.
+ (__attribute_maybe_unused__): Make identical to glibc’s
+ definition, though with an additional comment.
+ (__attribute_nonnull__): Add clarifying comment.
+ Make inclusion of bits/wordsize.h, bits/long-double.h
+ dependent on __GLIBC__, not on !__WORDSIZE.
+ * lib/libc-config.h: Use __attribute_nonnull__,
+ not __attribute_maybe_unused__, to detect whether
+ to include sys/cdefs.h.
+
2021-04-21 Paul Eggert <eggert@cs.ucla.edu>
realloc: port to AIX 7.1
# define __attribute_const__ /* Ignore */
#endif
-#if defined __STDC_VERSION__ && 201710L < __STDC_VERSION__
-# define __attribute_maybe_unused__ [[__maybe_unused__]]
-#elif __GNUC_PREREQ (2,7) || __glibc_has_attribute (__unused__)
+#if __GNUC_PREREQ (2,7) || __glibc_has_attribute (__unused__)
# define __attribute_maybe_unused__ __attribute__ ((__unused__))
+/* Once the next version of the C standard comes out, we can
+ do something like the following here:
+ #elif defined __STDC_VERSION__ && 202???L <= __STDC_VERSION__
+ # define __attribute_maybe_unused__ [[__maybe_unused__]] */
#else
# define __attribute_maybe_unused__ /* Ignore */
#endif
#endif
/* The nonnull function attribute marks pointer parameters that
- must not be NULL. */
+ must not be NULL. This has the name __nonnull in glibc,
+ and __attribute_nonnull__ in files shared with Gnulib to avoid
+ collision with a different __nonnull in DragonFlyBSD 5.9. */
#ifndef __attribute_nonnull__
# if __GNUC_PREREQ (3,3) || __glibc_has_attribute (__nonnull__)
# define __attribute_nonnull__(params) __attribute__ ((__nonnull__ params))
/* The #ifndef lets Gnulib avoid including these on non-glibc
platforms, where the includes typically do not exist. */
-#ifndef __WORDSIZE
+#ifdef __GLIBC__
# include <bits/wordsize.h>
# include <bits/long-double.h>
#endif
# endif
#endif
-#ifndef __attribute_maybe_unused__
+#ifndef __attribute_nonnull__
/* <sys/cdefs.h> either does not exist, or is too old for Gnulib.
Prepare to include <cdefs.h>, which is Gnulib's version of a
more-recent glibc <sys/cdefs.h>. */