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: [GLIBC][PATCH v2] Remove strdup inlines


On 12 Dec 2016 23:13, Joseph Myers wrote:
> On Mon, 12 Dec 2016, Mike Frysinger wrote:
> > On 12 Dec 2016 13:02, Wilco Dijkstra wrote:
> > > --- a/string/string.h
> > > +++ b/string/string.h
> > >  
> > > +#if (defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8     \
> > > +     || __GLIBC_USE (LIB_EXT2))
> > > +# define strdup(s) __builtin_strdup (s)
> > > +#endif
> > > +
> > > +#if defined __USE_XOPEN2K8 || __GLIBC_USE (LIB_EXT2)
> > > +#define strndup(s,n) __builtin_strndup (s, n)
> > > +#endif
> > 
> > why do we need these at all ?  these seem like the sort of thing that
> > gcc should do automatically for us ?
> 
> GCC can only do that in general for C90 functions.  Consider someone 
> selecting strict POSIX with -std=c99 -D_POSIX_C_SOURCE=200809L; glibc 
> knows these names are reserved in that context, GCC doesn't.  (Well, for 
> str* there's strictly a general C reservation, but glibc doesn't take 
> advantage of it.)

we aren't doing this for many other mem/str funcs.  why should we do it
for these two ?  we should be all in, or not do any.  imo, we should just
omit them and be done unless there is strong/compelling evidence to show
otherwise.  if the only point is to support old/uncommon config combos,
then that isn't a great reason imo.
-mike

Attachment: signature.asc
Description: Digital signature


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