Date: Thu, 7 Oct 1999 17:20:02 -0700 (PDT) From: Jacques Vidrine <n@nectar.com> To: freebsd-bugs@FreeBSD.org Subject: Re: bin/13383 sys/netinet/in.h violates C++ spec. Message-ID: <199910080020.RAA77164@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/13383; it has been noted by GNATS. From: Jacques Vidrine <n@nectar.com> To: gibbs@caspian.plutotech.com Cc: freebsd-gnats-submit@freebsd.org Subject: Re: bin/13383 sys/netinet/in.h violates C++ spec. Date: Thu, 07 Oct 1999 19:18:55 -0500 On Thu, 07 Oct 1999 13:18:10 -0600, "Justin T. Gibbs" <gibbs@caspian.plutotech.com> wrote: [snip] > This certainly will show the error, my complicated C++ program shows the > error, but your example does not: > foo.cc: > #include <sys/types.h> > #include "foo.h" > > int > main() > { > return 1; > } > > foo.h: > #include <sys/cdefs.h> > > __BEGIN_DECLS /* extern C protection has no effect */ > struct in_addr { > u_int32_t s_addr; > }; > > struct ip_opts { > struct in_addr ip_dst; /* first hop, 0 w/o src rt */ > char ip_opts[40]; /* actually variable in size */ > }; > __END_DECLS Ah ha! Change "foo.h" to <foo.h> and use ``g++ -I$PWD [...]'' -- the compilation will complete successfully and without warnings. GCC is treating ``system'' headers specially. Seems reasonable to me. As far as I am concerned, there are two alternatives we can follow: 1) Do nothing, all versions of gcc and egcs seem to handle the situation in a reasonable and useful manner (aka if it isn't broke, don't fix it). 2) Adopt the change that OSF/1 and OpenBSD have (see patch at the end of this message). I'm going to research the C++ standards I can get my hands on this weekend to determine if the current behavior is conformant or not. If it is not conformant, I will do (2). --- in.h.orig Thu Oct 7 19:17:26 1999 +++ in.h Thu Oct 7 19:18:28 1999 @@ -289,7 +289,11 @@ */ struct ip_opts { struct in_addr ip_dst; /* first hop, 0 w/o src rt */ +#if defined(__cplusplus) + char Ip_opts[40]; /* the member name must be different */ +#else char ip_opts[40]; /* actually variable in size */ +#endif }; /* Jacques Vidrine / n@nectar.com / nectar@FreeBSD.org To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199910080020.RAA77164>