This is the mail archive of the newlib@sourceware.org mailing list for the newlib 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: [PATCH] Fix "/*" within comment warning


On Mar 22 15:08, Eric Blake wrote:
> On 03/22/2016 02:32 PM, Yaakov Selkowitz wrote:
> 
> >>>>
> >>>> -/* These types are required by netinet/*.h on Cygwin */
> >>>> -#if __BSD_VISIBLE || defined(__CYGWIN__)
> >>>> +#if __MISC_VISIBLE
> >>>>   #ifndef _BSDTYPES_DEFINED
> >>>>   /* also defined in mingw/gmon.h and in w32api/winsock[2].h */
> >>>>   #ifndef __u_char_defined
> >>>
> >>> That only works if the parts of our netinet/*.h which use these are
> >>> similarly guarded, or their struct members converted to the u_intN_t
> >>> types
> >>> (as in netinet/ip6.h).'
> >>
> >> Again, the same headers in Linux use the same types, and these
> >> headers do NOT use similar guards.  They just include sys/types.h
> >> and expect these types to exist.  If that's good enough for glibc...
> > 
> > Not sure I understand; `grep -r __USE_ /usr/include/netinet/' shows lots
> > of __USE_MISC and even a __USE_GNU ...
> 
> POSIX reserves the _entire_ *_t namespace to the implementation, so it
> is NOT considered namespace pollution to blindly always expose u_int8_t
> and friends from <sys/types.h>, without needing to guard those names
> behind certain feature macros.  Note, however, that u_char does NOT fall
> into the same boat, and that you must not pollute u_char into the arena
> without appropriate guards.  And it is a different question altogether
> on whether it is nice to blindly expose non-standard but reserved names
> that POSIX saved for us, or whether it is nicer to still require apps to
> request those non-standard names with a feature macro.

Even though some glibc headers check if __USE_MISC is set before using
u_char, u_short and friends, some like fts.h and resolv.h don't.  The
only reason I can think of not to do that is if the headers are viewed
as being BSD headers, so the existence of the aforementioned types is
implied.


Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
Red Hat

Attachment: signature.asc
Description: PGP signature


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