On Wed, Sep 26, 2001 at 01:20:05PM -0400, Matt Zimmerman wrote: > > If I do > > > > g++ -E -c -D_BSD_SOURCE /usr/include/netinet/udp.h > > > > then I can see the BSD definitions (uh_sport etc), both on i386 and hppa. > > But if I do > > > > g++-3.0 -E -c udphdrtest.c > > > > then I see the non-BSD definition on both. Works ok with g++ 2.95.4 on > > i386, but hppa doesn't have g* 2.x. > > > > Looking at the output of g++{,-3.0} -c -E -dM, version 3 fails > > to define __FAVOR_BSD, which the header file uses to choose the > > definition. <features.h> only #defines __FAVOR_BSD if _GNU_SOURCE > > is undefined; on g++ 3.0, _GNU_SOURCE is defined. > > > > touch blah.c > > g++ -c -E -dM blah.c shows no _GNU_SOURCE; > > g++-3.0 -c -E -dM blash.c shows _GNU_SOURCE, hence no __FAVOR_BSD > > > > I'm not sure if there is a bug in the library or not (I can't work out > > where _GNU_SOURCE is being defined; it's only with g++-3.0, not with > > gcc-3.0, too). You could #undef _GNU_SOURCE in your source though; > > that might be a hack. > > Thanks for the analysis. I can't find anyplace where _GNU_SOURCE is > defined, even conditionally, in /usr/include or /usr/lib/gcc-lib. It isn't > defined by cpp (cpp -dM /dev/null doesn't show it). Hopefully the GCC > maintainers will have some ideas.
-D_GNU_SOURCE is absolutely necessary to use libstdc++ v3.0. Thus, G++ 3.0 automatically defines it. You're not going to be able to do anything about that :) I recommend you tweak the use of your structure to not rely on __FAVOR_BSD. -- Daniel Jacobowitz Carnegie Mellon University MontaVista Software Debian GNU/Linux Developer