]> Savannah Git Hosting - gnulib.git/commitdiff
getopt-posix: Avoid trouble due to 'struct rpl_option'.
authorBruno Haible <bruno@clisp.org>
Wed, 16 Apr 2025 22:09:05 +0000 (00:09 +0200)
committerBruno Haible <bruno@clisp.org>
Wed, 16 Apr 2025 22:09:05 +0000 (00:09 +0200)
* lib/getopt.in.h: Arrange for the system's <getopt.h> to define
'struct sys_option' instead of 'struct option'.
* lib/getopt-pfx-ext.h (option): Don't rename to rpl_option.

ChangeLog
lib/getopt-pfx-ext.h
lib/getopt.in.h

index bdc4e026b893af30c1b49127ffda0677eabd76ec..58bf40c5ead5faabc06896dbe828b07bd26019cf 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2025-04-16  Bruno Haible  <bruno@clisp.org>
+
+       getopt-posix: Avoid trouble due to 'struct rpl_option'.
+       * lib/getopt.in.h: Arrange for the system's <getopt.h> to define
+       'struct sys_option' instead of 'struct option'.
+       * lib/getopt-pfx-ext.h (option): Don't rename to rpl_option.
+
 2025-04-16  Grisha Levit  <grishalevit@gmail.com>  (tiny change)
 
        Ensure that the configuration cleans up conftest.dSYM directories.
index 1f2b2d71bf71b0f35be2e03ec5c2eb3b3bd11527..a61c68c795e57aaf6d46df31142b06f6c0c72da5 100644 (file)
 # endif
 # undef getopt_long
 # undef getopt_long_only
-# undef option
 # undef _getopt_internal
 # define getopt_long __GETOPT_ID (getopt_long)
 # define getopt_long_only __GETOPT_ID (getopt_long_only)
-# define option __GETOPT_ID (option)
 # define _getopt_internal __GETOPT_ID (getopt_internal)
 
 /* The system's getopt.h may have already included getopt-ext.h to
index 79200ecdab97ba480351f54cac95f61c0aa8a79f..4a87a2d53bfccc28c1bdc9e34e545e4e0bf4774f 100644 (file)
    <getopt.h>; our definitions will be present soon enough.  */
 #if @HAVE_GETOPT_H@
 # define _GL_SYSTEM_GETOPT
+/* Rename the system's 'struct option' to 'struct sys_option',
+   so that we don't have to rename ours to 'struct rpl_option'
+   (which would cause significant trouble in C++ mode).  */
+# define option sys_option
 # @INCLUDE_NEXT@ @NEXT_GETOPT_H@
+# undef option
 # undef _GL_SYSTEM_GETOPT
 #endif