This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: getopt.h and gnulib


On Wed, Mar 22, 2017 at 1:29 PM, Paul Eggert <eggert@cs.ucla.edu> wrote:
> On 03/22/2017 09:10 AM, Carlos O'Donell wrote:
>> The current status unknown. Someone needs to investigate and update the
>> wiki.
>
> I just now merged glibc changes into gnulib, and updated the wiki to say
> that the files are intended to be copies. The gnulib changes have not been
> merged back into glibc (this is a bigger task).

As you may suspect, I ask because of __need_getopt.  This is a bit of
a misnomer - what it appears to mean is "don't declare any of the GNU
extensions"; the idea (from glibc's perspective) is that those are
only available from getopt.h, not unistd.h.  Regardless, on the glibc
side we want to get rid of it.  We also want to avoid code in glibc's
installed headers which is only relevant for compatibility with
non-glibc C libraries.

This is not a fully baked plan, but what would you think of splitting
getopt.h in gnulib into three files?  getopt_posix.h with just the
stuff that glibc wants in unistd.h, getopt_ext.h with all the
extensions, and getopt.h which is the public wrapper that includes
both of them and has all the non-glibc compatibility logic.
getopt_posix.h and getopt_ext.h would be shared between gnulib and
glibc, but getopt.h would _not_ be shared.  glibc would install
getopt_posix.h and getopt_ext.h in the bits subdirectory, and it would
provide its own getopt.h that doesn't have any of the compatibility
logic.

zw


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]