From: Bruno Haible Date: Wed, 16 Apr 2025 22:09:05 +0000 (+0200) Subject: getopt-posix: Avoid trouble due to 'struct rpl_option'. X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=16a6012154d4ceae6f5ab983005f43149c1d11c1;p=gnulib.git getopt-posix: Avoid trouble due to 'struct rpl_option'. * lib/getopt.in.h: Arrange for the system's to define 'struct sys_option' instead of 'struct option'. * lib/getopt-pfx-ext.h (option): Don't rename to rpl_option. --- diff --git a/ChangeLog b/ChangeLog index bdc4e026b8..58bf40c5ea 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2025-04-16 Bruno Haible + + getopt-posix: Avoid trouble due to 'struct rpl_option'. + * lib/getopt.in.h: Arrange for the system's 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 (tiny change) Ensure that the configuration cleans up conftest.dSYM directories. diff --git a/lib/getopt-pfx-ext.h b/lib/getopt-pfx-ext.h index 1f2b2d71bf..a61c68c795 100644 --- a/lib/getopt-pfx-ext.h +++ b/lib/getopt-pfx-ext.h @@ -38,11 +38,9 @@ # 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 diff --git a/lib/getopt.in.h b/lib/getopt.in.h index 79200ecdab..4a87a2d53b 100644 --- a/lib/getopt.in.h +++ b/lib/getopt.in.h @@ -30,7 +30,12 @@ ; 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