diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2021-01-23 10:19:24 -0800 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2021-01-23 11:22:56 -0800 |
commit | 195a10b512067f18c79da0b2184689bc5520517c (patch) | |
tree | 3282f49d7c18bf4900e55f6cb79eac3c8221eea8 | |
parent | cd1b752fa6c5e0aa677f44843ebbe896c10d58ca (diff) | |
download | gnulib-195a10b512067f18c79da0b2184689bc5520517c.tar.gz gnulib-195a10b512067f18c79da0b2184689bc5520517c.tar.bz2 |
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.
-rw-r--r-- | ChangeLog | 11 | ||||
-rw-r--r-- | lib/cdefs.h | 6 |
2 files changed, 15 insertions, 2 deletions
@@ -1,6 +1,17 @@ +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. * lib/explicit_bzero.c (explicit_bzero): For other compilers, invoke memset through a volatile function pointer. diff --git a/lib/cdefs.h b/lib/cdefs.h index 060a3d0689..6f12c79da6 100644 --- a/lib/cdefs.h +++ b/lib/cdefs.h @@ -317,20 +317,22 @@ __attribute__ ((__format__ (__strfmon__, a, b))) #else # define __attribute_format_strfmon__(a,b) /* Ignore */ #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 function calls which can lead to problems. */ #if __GNUC_PREREQ (3,4) || __glibc_has_attribute (__warn_unused_result__) # define __attribute_warn_unused_result__ \ |