From: Paul Eggert Date: Sat, 23 Jan 2021 18:19:24 +0000 (-0800) Subject: libc-config: port to Xcode 7 X-Git-Tag: v1.0~3128 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=195a10b512067f18c79da0b2184689bc5520517c;p=gnulib.git 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. --- diff --git a/ChangeLog b/ChangeLog index b1b81353e6..43d1a1671c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2021-01-23 Paul Eggert + + 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 explicit_bzero: Add fallback for other compilers. diff --git a/lib/cdefs.h b/lib/cdefs.h index 060a3d0689..6f12c79da6 100644 --- a/lib/cdefs.h +++ b/lib/cdefs.h @@ -320,14 +320,16 @@ #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