From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.bugs Subject: bug#26398: GNU LIB build fails on macOS 10.12.4 Date: Sun, 9 Apr 2017 01:03:30 -0700 Organization: UCLA Computer Science Department Message-ID: References: <8AE2BE5E-3FDE-4F7E-9F82-2CB8D8880D95@Maierh.de> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------8D255D001D93AA73CBFB1205" X-Trace: blaine.gmane.org 1491725055 3878 195.159.176.226 (9 Apr 2017 08:04:15 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 9 Apr 2017 08:04:15 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 Cc: Gnulib bugs , 26398-done@debbugs.gnu.org, Harald Maier , GNU C Library To: Zack Weinberg Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Apr 09 10:04:10 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cx7pN-0008Jo-DJ for geb-bug-gnu-emacs@m.gmane.org; Sun, 09 Apr 2017 10:04:05 +0200 Original-Received: from localhost ([::1]:57653 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cx7pT-00048e-GN for geb-bug-gnu-emacs@m.gmane.org; Sun, 09 Apr 2017 04:04:11 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44426) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cx7pM-00048X-6n for bug-gnu-emacs@gnu.org; Sun, 09 Apr 2017 04:04:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cx7pK-0006UZ-QQ for bug-gnu-emacs@gnu.org; Sun, 09 Apr 2017 04:04:04 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:40651) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cx7pK-0006UN-O6 for bug-gnu-emacs@gnu.org; Sun, 09 Apr 2017 04:04:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1cx7pK-0003Ro-7O for bug-gnu-emacs@gnu.org; Sun, 09 Apr 2017 04:04:02 -0400 Resent-From: Paul Eggert Original-Sender: "Debbugs-submit" Resent-To: bug-gnu-emacs@gnu.org Resent-Date: Sun, 09 Apr 2017 08:04:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 26398 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Mail-Followup-To: 26398@debbugs.gnu.org, eggert@cs.ucla.edu, Harald@Maierh.de Original-Received: via spool by 26398-done@debbugs.gnu.org id=D26398.149172502113218 (code D ref 26398); Sun, 09 Apr 2017 08:04:01 +0000 Original-Received: (at 26398-done) by debbugs.gnu.org; 9 Apr 2017 08:03:41 +0000 Original-Received: from localhost ([127.0.0.1]:38850 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cx7oy-0003R8-HC for submit@debbugs.gnu.org; Sun, 09 Apr 2017 04:03:40 -0400 Original-Received: from zimbra.cs.ucla.edu ([131.179.128.68]:54828) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cx7ow-0003Qs-FD for 26398-done@debbugs.gnu.org; Sun, 09 Apr 2017 04:03:39 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 5B44E160071; Sun, 9 Apr 2017 01:03:32 -0700 (PDT) Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id VD5KUrzaK6Ce; Sun, 9 Apr 2017 01:03:31 -0700 (PDT) Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 2745516009A; Sun, 9 Apr 2017 01:03:31 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id mcQMxshsJeGZ; Sun, 9 Apr 2017 01:03:31 -0700 (PDT) Original-Received: from [192.168.1.9] (unknown [47.153.188.248]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id D8A60160071; Sun, 9 Apr 2017 01:03:30 -0700 (PDT) In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:131398 Archived-At: This is a multi-part message in MIME format. --------------8D255D001D93AA73CBFB1205 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Zack Weinberg wrote: > This patch is incomplete. Yes, it was the Emacs patch, not the Gnulib patch. I'll attach a complete= Gnulib=20 patch. > If gnulib cannot use __nonnull in > getopt_{core,ext}.h, then there is no point trying to define it in > getopt_cdefs.h. Good point, I've removed that in the attached. > And you're going to need to put snippet/arg-nonnull > back in the module file for this to work at all, aren't you? Yes, that's in the attached patch. > From glibc's point of view, I think it would be better if > getopt_core.h and getopt_ext.h simply assumed _GL_ARG_NONNULL to be > available; we can add it to either our getopt.h wrapper or to > sys/cdefs.h - I don't want to make that call unilaterally. By "our getopt.h wrapper" do you mean a file in glibc but not in Gnulib? = If so,=20 this doesn't affect Gnulib. I suspect _GL_ARG_NONNULL logically belongs i= n=20 sys/cdefs.h but it should also work to put it into the getopt.h wrapper. > (Do you > know of a complete list of _GL_ macros that may appear in _public_ > header files?) I don't know of an explicit list. You can look at all the .h files listed= in the=20 Files: sections of gnulib/modules/snippet/*. For example, the=20 snippet/arg-nonnull module defines _GL_ARG_NONNULL, the snippet/_Noreturn= module=20 defines _Noreturn, and so forth. There are quite a few such macros, and (= as=20 _Noreturn indicates) they don't all begin with _GL_. I installed the attached into Gnulib and merged it into Emacs, and am bol= dly=20 marking the Emacs bug (Bug#26398) as done. I think there still needs to b= e some=20 changes done on the proposed change to glibc, to define _GL_ARG_NONNULL=20 somewhere for glibc. --------------8D255D001D93AA73CBFB1205 Content-Type: text/x-diff; name="0001-getopt-port-recent-getopt-changes-to-macOS.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="0001-getopt-port-recent-getopt-changes-to-macOS.patch" =46rom 141be0d810330ceec66ce3fab46aaeb4c633bd7e Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sat, 8 Apr 2017 17:26:03 -0700 Subject: [PATCH] getopt: port recent getopt changes to macOS Problem reported by Harald Maier (Bug#26398). The macOS C compiler uses __nonnull for its own purposes and that clashes with glibc's __nonnull. * lib/getopt.in.h: Add comment for _GL_ARG_NONNULL snippet. * lib/getopt_cdefs.in.h (__nonnull): Remove. * lib/getopt_core.h (getopt): * lib/getopt_ext.h (getopt_long, getopt_long_only): Use _GL_ARG_NONNULL, not __nonnull. * lib/unistd.in.h: Move snippet hooks to before where the getopt =2Eh files are included, so that _GL_ARG_NONNULL is defined in time. * modules/getopt-posix (Depends-on): Add snippet/arg-nonnull. (getopt.h): Interpolate _GL_ARG_NONNULL snippet. --- ChangeLog | 16 ++++++++++++++++ lib/getopt.in.h | 2 ++ lib/getopt_cdefs.in.h | 8 -------- lib/getopt_core.h | 2 +- lib/getopt_ext.h | 4 ++-- lib/unistd.in.h | 14 +++++++------- modules/getopt-posix | 2 ++ 7 files changed, 30 insertions(+), 18 deletions(-) diff --git a/ChangeLog b/ChangeLog index db893f5..595f2ba 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +2017-04-08 Paul Eggert + + getopt: port recent getopt changes to macOS + Problem reported by Harald Maier (Bug#26398). + The macOS C compiler uses __nonnull for its own purposes and that + clashes with glibc's __nonnull. + * lib/getopt.in.h: Add comment for _GL_ARG_NONNULL snippet. + * lib/getopt_cdefs.in.h (__nonnull): Remove. + * lib/getopt_core.h (getopt): + * lib/getopt_ext.h (getopt_long, getopt_long_only): + Use _GL_ARG_NONNULL, not __nonnull. + * lib/unistd.in.h: Move snippet hooks to before where the getopt + .h files are included, so that _GL_ARG_NONNULL is defined in time. + * modules/getopt-posix (Depends-on): Add snippet/arg-nonnull. + (getopt.h): Interpolate _GL_ARG_NONNULL snippet. + 2017-04-06 Paul Eggert =20 getopt-gnu: omit some duplicate code diff --git a/lib/getopt.in.h b/lib/getopt.in.h index c3ffd95..9f84c27 100644 --- a/lib/getopt.in.h +++ b/lib/getopt.in.h @@ -52,6 +52,8 @@ # endif #endif =20 +/* The definition of _GL_ARG_NONNULL is copied here. */ + #include #include #include diff --git a/lib/getopt_cdefs.in.h b/lib/getopt_cdefs.in.h index 35a2669..54da28d 100644 --- a/lib/getopt_cdefs.in.h +++ b/lib/getopt_cdefs.in.h @@ -64,12 +64,4 @@ # endif #endif =20 -#ifndef __nonnull -# if __GNUC_PREREQ (3,3) -# define __nonnull(params) __attribute__ ((__nonnull__ params)) -# else -# define __nonnull(params) -# endif -#endif - #endif /* getopt_cdefs.h */ diff --git a/lib/getopt_core.h b/lib/getopt_core.h index 1744c29..76ef466 100644 --- a/lib/getopt_core.h +++ b/lib/getopt_core.h @@ -89,7 +89,7 @@ extern int optopt; writable. */ =20 extern int getopt (int ___argc, char *const *___argv, const char *__shor= topts) - __THROW __nonnull ((2, 3)); + __THROW _GL_ARG_NONNULL ((2, 3)); =20 __END_DECLS =20 diff --git a/lib/getopt_ext.h b/lib/getopt_ext.h index c1a58da..a3a6750 100644 --- a/lib/getopt_ext.h +++ b/lib/getopt_ext.h @@ -66,11 +66,11 @@ struct option 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)); =20 __END_DECLS =20 diff --git a/lib/unistd.in.h b/lib/unistd.in.h index 38a0f0a..de619dc 100644 --- a/lib/unistd.in.h +++ b/lib/unistd.in.h @@ -127,6 +127,13 @@ # include #endif =20 +/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ + +/* The definition of _GL_ARG_NONNULL is copied here. */ + +/* The definition of _GL_WARN_ON_USE is copied here. */ + + /* Get getopt(), optarg, optind, opterr, optopt. But avoid namespace pollution on glibc systems. */ #if @GNULIB_UNISTD_H_GETOPT@ && !defined __GLIBC__ && !defined _GL_SYSTE= M_GETOPT @@ -142,13 +149,6 @@ _GL_INLINE_HEADER_BEGIN # define _GL_UNISTD_INLINE _GL_INLINE #endif =20 -/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ - -/* The definition of _GL_ARG_NONNULL is copied here. */ - -/* The definition of _GL_WARN_ON_USE is copied here. */ - - /* Hide some function declarations from . */ =20 #if @GNULIB_GETHOSTNAME@ && @UNISTD_H_HAVE_WINSOCK2_H@ diff --git a/modules/getopt-posix b/modules/getopt-posix index 5844217..2208756 100644 --- a/modules/getopt-posix +++ b/modules/getopt-posix @@ -18,6 +18,7 @@ unistd extensions include_next gettext-h [test $REPLACE_GETOPT =3D 1] +snippet/arg-nonnull =20 configure.ac: gl_FUNC_GETOPT_POSIX @@ -43,6 +44,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 $@ --=20 2.7.4 --------------8D255D001D93AA73CBFB1205--