On Sat, 04 Feb 2012 09:49:37 -0800
Bryan Kadzban <[email protected]> wrote:

> Andrew Benton wrote:
> > On Fri, 03 Feb 2012 21:44:34 -0800 Bryan Kadzban
> > <[email protected]> wrote:
> > 
> >> Do you get __USE_ISOC11 #define'd (to what value?) or #undef'ed?
> >> What about __cplusplus (again, what value)?
> >> 
> > 
> > andy@eccles:/mnt/lfs/sources$ /tools/bin/x86_64-lfs-linux-gnu-gcc  -E
> > -D_GNU_SOURCE -Wp,-dU /tools/include/stdio.h | grep __USE_ISOC11
> 
> Ah, sorry, no -- g++, not gcc.  :-)

The first pass of gcc only compiles a C compiler, so there is no
x86_64-lfs-linux-gnu-g++

> 
> > #define __USE_ISOC11 1
> > 
> > andy@eccles:/mnt/lfs/sources$ /tools/bin/x86_64-lfs-linux-gnu-gcc  -E
> > -D_GNU_SOURCE -Wp,-dU /tools/include/stdio.h | grep __cplusplus 
> > #undef __cplusplus
> 
> Yeah, that's because somewhere the header file tested for #ifdef
> __cplusplus (or equivalent) and it wasn't set.  But it wasn't set
> because this started by running gcc, not g++.  :-)
> 
> (Actually, I should probably have specified this as well: I don't know
> what other flags gcc pass2 is passing to g++ when compiling libstdc++,
> but matching those flags will be good as well.  In particular, -D<foo>
> and -std=<foo> flags are important here.  Double checking the output of
> your test g++ run for whether you see a prototype for "gets" is also a
> good idea.)
> 
> > I'm out of my depth here.
> 
> The important bit is the -dU passed to the preprocessor.  You can see
> docs in the cpp info pages, but basically, it dumps out the preprocessed
> output, along with all #define lines that it hits, but only for #define
> macros that are actually used.  (It dumps them when they're first used.)
> Also, if it sees a #if or #ifdef that's testing a macro that isn't set,
> a "#undef <macro-name>" line is dumped at that point.
> 
> It's rather useful for debugging preprocessor mazes like what glibc and
> gcc have created.  :-)
> 
> Actually, the full output will be useful as well. 

The full output of what? The full output of this:
/tools/bin/x86_64-lfs-linux-gnu-gcc  -E -D_GNU_SOURCE -Wp,-dU 
/tools/include/stdio.h > dump.txt
is here: http://www.linuxfromscratch.org/~andy/dump.txt
Thanks for helping with this.

Andy
-- 
http://linuxfromscratch.org/mailman/listinfo/lfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page

Reply via email to