This is the mail archive of the
mailing list for the newlib project.
Re: [PATCH] Fix "/*" within comment warning
- From: Yaakov Selkowitz <yselkowitz at cygwin dot com>
- To: newlib at sourceware dot org
- Date: Tue, 22 Mar 2016 21:16:17 -0500
- Subject: Re: [PATCH] Fix "/*" within comment warning
- Authentication-results: sourceware.org; auth=none
- References: <20160321114442 dot GS3422 at calimero dot vinschen dot de> <56F0011B dot 6030603 at redhat dot com> <20160321145015 dot GA7179 at calimero dot vinschen dot de> <56F00EB8 dot 5010300 at cygwin dot com> <20160321151937 dot GC7179 at calimero dot vinschen dot de> <20160321152710 dot GD7179 at calimero dot vinschen dot de> <20160322094924 dot GI7179 at calimero dot vinschen dot de> <56F16E59 dot 2070903 at cygwin dot com> <20160322201409 dot GA21125 at calimero dot vinschen dot de> <56F1ABF3 dot 5050801 at cygwin dot com> <20160322214120 dot GD19423 at calimero dot vinschen dot de>
On 2016-03-22 16:41, Corinna Vinschen wrote:
On Mar 22 15:32, Yaakov Selkowitz wrote:
On 2016-03-22 15:14, Corinna Vinschen wrote:
On Mar 22 11:10, Yaakov Selkowitz wrote:
On 2016-03-22 04:49, Corinna Vinschen wrote:
On Mar 21 16:27, Corinna Vinschen wrote:
I mean, that was the whole point of asking this question. If you read
https://sourceware.org/ml/newlib/2016/msg00282.html you see that I
specificially refer to these types, u_char, u_short, etc. grep for them
on Linux and you'll see more then hundred header files using these
types. They are guarded with __USE_MISC in sys/types.h and there's no
explicit enabling invocation in any of the files using these types.
Due to the incompatibility in licences between glibc and newlib/cygwin, I
have been avoiding looking at the headers directly.
So my proposal is this:
diff --git a/newlib/libc/include/sys/types.h b/newlib/libc/include/sys/types.h
index 52530c5..8ab8670 100644
@@ -90,8 +90,7 @@ typedef quad_t * qaddr_t;
# define quad quad_t
-/* These types are required by netinet/*.h on Cygwin */
-#if __BSD_VISIBLE || defined(__CYGWIN__)
/* also defined in mingw/gmon.h and in w32api/winsock.h */
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 ...
Doh. How did I miss them? <checking glasses>
However, I also checked on multiple files outside netinet and there are
some headers which use u_short etc. without checking for __USE_MISC,
e.g. fts.h and resolv.h.
These two are not POSIX headers nor are they included by any; by
including them you must not declare POSIX compliance, e.g. on F23:
$ gcc -D_POSIX_C_SOURCE=200809L -include fts.h -x c - </dev/null
In file included from <command-line>:0:0:
/usr/include/fts.h:81:2: error: unknown type name âu_shortâ
/usr/include/fts.h:82:2: error: unknown type name âu_shortâ
/usr/include/fts.h:106:2: error: unknown type name âu_shortâ
/usr/include/fts.h:110:2: error: unknown type name âu_shortâ
/usr/include/fts.h:116:2: error: unknown type name âu_shortâ
But, anyway, since Cygwin's netinet headers don't do what glib's do, I
retract my proposal, at least in terms of __CYGWIN__.
Actually it's the right thing to do, as netinet/in.h and netinet/tcp.h
are required by POSIX, but the structs in question are not. I just need
some help cleanrooming the guards therein (unless such a thing doesn't
require that, IANAL).
But shouldn't we still use __MISC_VISIBLE instead of __BSD_VISIBLE in
sys/type.h to follow glibc more closely?
I do see such types mentioned in SVID, so yeah, that makes sense.