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 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.

Also, even though POSIX reserves u_int8_t and friends for our use as
extensions, I still think it would be nicer to directly use the standard
uint8_t instead.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


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