[comp.lang.c] How can I find out cc or cpp symbols?

meissner@tiktok.dg.com (Michael Meissner) (04/27/89)

In article <1954@trantor.harris-atd.com> bbadger@x102c.harris-atd.com (Bernie Badger Jr.) writes:
	/* ... */
| What I want is a way to find out *all* the names that are defined.
| 
| I don't believe that the current cpp implementations have a way to do this,
| so I am really proposing defining a ``standard option'' which could be 
| implemented in future cpp's.

Actually the cpp that comes with GNU 1.34 has a switch to do what you
want, though it is undocumented.  If you invoke /usr/local/lib/gcc-cpp
with the -d switch, it will do the preprocessing, but only emit the
#defines (including the default definitions).  Thus, you wound say:

	/usr/local/lib/gcc-cpp -d </dev/null

to get the names that are defined.

Also note that both the Sun /bin/cc and GNU GCC have a switch: -v
which prints a verbose trace of each program executed, and the
switches passed to it.  Both of these compilers pass -undef to the
preprocessor, which means ignore the default defines, only use the
defines as defined with -D on the cpp command line.  The -v switch
also prints all of these names.

I've redirected followups to comp.lang.c, which seems a more
appropriate newsgroup than either comp.unix.questions, or comp.std.c.

--
Michael Meissner, Data General.
Uucp:		...!mcnc!rti!xyzzy!meissner		If compiles were much
Internet:	meissner@dg-rtp.DG.COM			faster, when would we
Old Internet:	meissner%dg-rtp.DG.COM@relay.cs.net	have time for netnews?