]> Savannah Git Hosting - gnulib.git/commitdiff
libc-config: port to Xcode 7
authorPaul Eggert <eggert@cs.ucla.edu>
Sat, 23 Jan 2021 18:19:24 +0000 (10:19 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Sat, 23 Jan 2021 19:22:56 +0000 (11:22 -0800)
Problem reported by Mattias Engdegård in:
https://lists.gnu.org/r/emacs-devel/2021-01/msg01089.html
* lib/cdefs.h (__nonnull): If already defined but glibc is not in
use, override the definition with Gnulib’s _GL_ATTRIBUTE_NONNULL.
This is needed for Xcode 7, which has a ‘#define __nonnull
_Nonnull’ builtin for backwards-compatibility with an older Xcode
syntax that GNUish code never uses.

ChangeLog
lib/cdefs.h

index b1b81353e6bad26290677c15608b69b38bba42a6..43d1a1671c808110014b33e4221ffdcae0727381 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2021-01-23  Paul Eggert  <eggert@cs.ucla.edu>
+
+       libc-config: port to Xcode 7
+       Problem reported by Mattias Engdegård in:
+       https://lists.gnu.org/r/emacs-devel/2021-01/msg01089.html
+       * lib/cdefs.h (__nonnull): If already defined but glibc is not in
+       use, override the definition with Gnulib’s _GL_ATTRIBUTE_NONNULL.
+       This is needed for Xcode 7, which has a ‘#define __nonnull
+       _Nonnull’ builtin for backwards-compatibility with an older Xcode
+       syntax that GNUish code never uses.
+
 2021-01-23  Bastien Roucariès  <rouca@debian.org>
 
        explicit_bzero: Add fallback for other compilers.
index 060a3d068915c034cdf84b3f230e0110feb0f947..6f12c79da6efc597b2df042ae8abefe14ff94fe5 100644 (file)
 #endif
 
 /* The nonnull function attribute marks pointer parameters that
-   must not be NULL.  Do not define __nonnull if it is already defined,
-   for portability when this file is used in Gnulib.  */
+   must not be NULL.  */
 #ifndef __nonnull
 # if __GNUC_PREREQ (3,3) || __glibc_has_attribute (__nonnull__)
 #  define __nonnull(params) __attribute__ ((__nonnull__ params))
 # else
 #  define __nonnull(params)
 # endif
+#elif !defined __GLIBC__
+# undef __nonnull
+# define __nonnull(params) _GL_ATTRIBUTE_NONNULL (params)
 #endif
 
 /* If fortification mode, we warn about unused results of certain