unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: Harald Maier <Harald@Maierh.de>
Cc: Zack Weinberg <zackw@panix.com>, Gnulib bugs <bug-gnulib@gnu.org>,
	26398@debbugs.gnu.org
Subject: bug#26398: GNU LIB build fails on macOS 10.12.4
Date: Sat, 8 Apr 2017 02:38:21 -0700	[thread overview]
Message-ID: <bdc231db-f2a9-caf6-ef8d-20f144f06702__14230.6268950508$1491644355$gmane$org@cs.ucla.edu> (raw)
In-Reply-To: <8AE2BE5E-3FDE-4F7E-9F82-2CB8D8880D95@Maierh.de>

[-- Attachment #1: Type: text/plain, Size: 502 bytes --]

Harald Maier wrote:
> They __THROW and __nonnull are defined in „getopt_cdefs.h“.

Thanks, I think I see the problem. Either the compiler or some macOS header does 
"#define __nonnull _Nonnull", and this collides with glibc's use of __nonnull. 
Presumably Clang uses _Nonnull as a type qualifier and some Clang headers use 
__nonnull as an alias for _Nonnull.

Please try the attached patch against Emacs master. If it works I plan to 
install it into Emacs and propagate it into Gnulib.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: emacs.diff --]
[-- Type: text/x-diff; name="emacs.diff", Size: 2189 bytes --]

diff --git a/lib/getopt.in.h b/lib/getopt.in.h
index 91e086c..900b54d 100644
--- a/lib/getopt.in.h
+++ b/lib/getopt.in.h
@@ -52,6 +52,8 @@
 # endif
 #endif
 
+/* The definition of _GL_ARG_NONNULL is copied here.  */
+
 #include <getopt_cdefs.h>
 #include <getopt_pfx_core.h>
 #include <getopt_pfx_ext.h>
diff --git a/lib/getopt_core.h b/lib/getopt_core.h
index d6ef8a6..f543024 100644
--- a/lib/getopt_core.h
+++ b/lib/getopt_core.h
@@ -88,8 +88,12 @@ extern int optopt;
    enabled, the argv array (not the strings it points to) must be
    writable.  */
 
+#ifndef _GL_ARG_NONNULL
+# define _GL_ARG_NONNULL __nonnull
+#endif
+
 extern int getopt (int ___argc, char *const *___argv, const char *__shortopts)
-       __THROW __nonnull ((2, 3));
+       __THROW _GL_ARG_NONNULL ((2, 3));
 
 __END_DECLS
 
diff --git a/lib/getopt_ext.h b/lib/getopt_ext.h
index 79b7a67..fc99e3a 100644
--- a/lib/getopt_ext.h
+++ b/lib/getopt_ext.h
@@ -63,14 +63,18 @@ struct option
 #define required_argument	1
 #define optional_argument	2
 
+#ifndef _GL_ARG_NONNULL
+# define _GL_ARG_NONNULL __nonnull
+#endif
+
 extern int getopt_long (int ___argc, char *__getopt_argv_const *___argv,
 			const char *__shortopts,
 		        const struct option *__longopts, int *__longind)
-       __THROW __nonnull ((2, 3));
+       __THROW _GL_ARG_NONNULL ((2, 3));
 extern int getopt_long_only (int ___argc, char *__getopt_argv_const *___argv,
 			     const char *__shortopts,
 		             const struct option *__longopts, int *__longind)
-       __THROW __nonnull ((2, 3));
+       __THROW _GL_ARG_NONNULL ((2, 3));
 
 __END_DECLS
 
diff --git a/lib/gnulib.mk.in b/lib/gnulib.mk.in
index 38adf2a..d25ea0a 100644
--- a/lib/gnulib.mk.in
+++ b/lib/gnulib.mk.in
@@ -1527,6 +1527,7 @@ getopt.h: getopt.in.h $(top_builddir)/config.status
 	      -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
 	      -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
 	      -e 's|@''NEXT_GETOPT_H''@|$(NEXT_GETOPT_H)|g' \
+	      -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
 	      < $(srcdir)/getopt.in.h; \
 	} > $@-t && \
 	mv -f $@-t $@

  reply	other threads:[~2017-04-08  9:38 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-08  7:14 bug#26398: 26.0.50; GNU LIB build fails on macOS 10.12.4 Harald Maier
2017-04-08  8:24 ` bug#26398: " Paul Eggert
2017-04-08  8:43   ` Harald Maier
2017-04-08  9:38     ` Paul Eggert [this message]
     [not found]     ` <bdc231db-f2a9-caf6-ef8d-20f144f06702@cs.ucla.edu>
2017-04-08 10:31       ` Harald Maier
2017-04-08 15:24       ` Zack Weinberg
     [not found]       ` <CAKCAbMis9L+_1=JukqJT4N9AKePvUHBSttyb03pCbXSLj5gLig@mail.gmail.com>
2017-04-09  8:03         ` Paul Eggert

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://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to='bdc231db-f2a9-caf6-ef8d-20f144f06702__14230.6268950508$1491644355$gmane$org@cs.ucla.edu' \
    --to=eggert@cs.ucla.edu \
    --cc=26398@debbugs.gnu.org \
    --cc=Harald@Maierh.de \
    --cc=bug-gnulib@gnu.org \
    --cc=zackw@panix.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).