bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: bug-gnulib@gnu.org
Cc: Paul Eggert <eggert@cs.ucla.edu>
Subject: [PATCH] libc-config: port to Xcode 7
Date: Sat, 23 Jan 2021 11:23:14 -0800	[thread overview]
Message-ID: <20210123192314.495041-1-eggert@cs.ucla.edu> (raw)

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   | 11 +++++++++++
 lib/cdefs.h |  6 ++++--
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index b1b81353e..43d1a1671 100644
--- 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.
diff --git a/lib/cdefs.h b/lib/cdefs.h
index 060a3d068..6f12c79da 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
-- 
2.29.2



                 reply	other threads:[~2021-01-23 19:23 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://lists.gnu.org/mailman/listinfo/bug-gnulib

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210123192314.495041-1-eggert@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=bug-gnulib@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).