CPP defines...

Nick Crossley nick at ccicpg.UUCP
Fri Mar 11 09:38:46 AEST 1988


In article <179 at istop.ist.CO.UK> rb at ist.CO.UK (News reading a/c for rb) writes:
>Here's a nasty little script that comes in useful when you
>want to know what your cpp *really* predefines: we have found
>that the man page is sometimes economical with the truth.
> ...
>strings -a -2 /lib/cpp | sed '/^a-zA-Z0-9_/!s/.*/#ifdef &\
>"%&"\
>#endif/p' |/lib/cpp |sed -n '/%/s/[%"]//gp'

Ah, but not all systems have their predefined symbols defined by cpp!  I know
of some which define some symbols in cc!  Thus, a better? more complete?
approach might be :-

strings <options as required> /lib/cpp /bin/cc |
sort -u |
sed -n '/^[a-zA-Z0-9_]*$/s//#ifdef &\
"%&"\
#endif/p' >cpp_test.c

cc -E cpp_test.c |
sed -n '/%/s/[%"]//gp'
-- 

<<< standard disclaimers >>>
Nick Crossley, CCI, 9801 Muirlands, Irvine, CA 92718-2521, USA
Tel. (714) 458-7282,  uucp: ...!uunet!ccicpg!nick



More information about the Comp.lang.c mailing list