]> Savannah Git Hosting - gnulib.git/commitdiff
getopt-posix: port __GETOPT_PREFIX to macOS
authorPaul Eggert <eggert@cs.ucla.edu>
Wed, 25 Mar 2020 19:13:33 +0000 (12:13 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Wed, 25 Mar 2020 19:14:10 +0000 (12:14 -0700)
* lib/getopt-pfx-core.h (_GETOPT) [__APPLE__ && __GETOPT_PREFIX]:
Define to work around a problem with asm on macOS (Bug#40205).

ChangeLog
lib/getopt-pfx-core.h

index 53f61ebbe478f05c58ed3319f2456607bd123049..d91e44a7e6830178d0f77eb996fb453bcd5bf1ca 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2020-03-25  Paul Eggert  <eggert@cs.ucla.edu>
+
+       getopt-posix: port __GETOPT_PREFIX to macOS
+       * lib/getopt-pfx-core.h (_GETOPT) [__APPLE__ && __GETOPT_PREFIX]:
+       Define to work around a problem with asm on macOS (Bug#40205).
+
 2020-03-22  Bruno Haible  <bruno@clisp.org>
 
        MODULES.html.sh: Add support for reproducible builds.
index 31a747d67677705a9e56191849ddac17f25d2ba3..a4891bc802edb9910af3d2e298b7bf637f70e57c 100644 (file)
 # define optind __GETOPT_ID (optind)
 # define optopt __GETOPT_ID (optopt)
 
+/* Work around a a problem on macOS, which declares getopt with a
+   trailing __DARWIN_ALIAS(getopt) that would expand to something like
+   __asm("_" "rpl_getopt" "$UNIX2003") were it not for the following
+   hack to suppress the macOS declaration <https://bugs.gnu.org/40205>.  */
+# ifdef __APPLE__
+#  define _GETOPT
+# endif
+
 /* The system's getopt.h may have already included getopt-core.h to
    declare the unprefixed identifiers.  Undef _GETOPT_CORE_H so that
    getopt-core.h declares them with prefixes.  */