From owner-freebsd-bugs Thu Oct 7 17:20: 5 1999 Delivered-To: freebsd-bugs@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (Postfix) with ESMTP id AF02114BB7 for ; Thu, 7 Oct 1999 17:20:02 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id RAA77164; Thu, 7 Oct 1999 17:20:02 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Date: Thu, 7 Oct 1999 17:20:02 -0700 (PDT) Message-Id: <199910080020.RAA77164@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Jacques Vidrine Subject: Re: bin/13383 sys/netinet/in.h violates C++ spec. Reply-To: Jacques Vidrine Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org The following reply was made to PR bin/13383; it has been noted by GNATS. From: Jacques Vidrine 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" wrote: [snip] > This certainly will show the error, my complicated C++ program shows the > error, but your example does not: > foo.cc: > #include > #include "foo.h" > > int > main() > { > return 1; > } > > foo.h: > #include > > __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 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