summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2021-04-22 12:29:49 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2021-04-22 12:30:14 -0700
commiteb32c992c90617b529e2ce08ad6014d418dceaf9 (patch)
treeeaf5aa877f48f5b38194fff9afa8d9a19c10346a
parent882243dcfe41bd703db61af56e954d8dff3369ce (diff)
downloadgnulib-eb32c992c90617b529e2ce08ad6014d418dceaf9.tar.gz
gnulib-eb32c992c90617b529e2ce08ad6014d418dceaf9.tar.bz2
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.
-rw-r--r--ChangeLog16
-rw-r--r--lib/cdefs.h14
-rw-r--r--lib/libc-config.h2
3 files changed, 26 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 5792843368..eacc4a53fe 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+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
diff --git a/lib/cdefs.h b/lib/cdefs.h
index 90f97412a9..9618152ab8 100644
--- a/lib/cdefs.h
+++ b/lib/cdefs.h
@@ -259,10 +259,12 @@
# 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
@@ -320,7 +322,9 @@
#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))
@@ -487,7 +491,7 @@
/* 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
diff --git a/lib/libc-config.h b/lib/libc-config.h
index f14013f7e8..f2c86144b8 100644
--- a/lib/libc-config.h
+++ b/lib/libc-config.h
@@ -71,7 +71,7 @@
# 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>. */

Return to:

Send suggestions and report system problems to the System administrator.