From 16a6012154d4ceae6f5ab983005f43149c1d11c1 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Thu, 17 Apr 2025 00:09:05 +0200 Subject: [PATCH] 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. --- ChangeLog | 7 +++++++ lib/getopt-pfx-ext.h | 2 -- lib/getopt.in.h | 5 +++++ 3 files changed, 12 insertions(+), 2 deletions(-) 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 -- 2.39.5