Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!usc!samsung!think!ames!pioneer.arc.nasa.gov!dwhitney From: dwhitney@pioneer.arc.nasa.gov (David Whitney- RCD) Newsgroups: comp.lang.c Subject: Re: where to find all those #ifdef's and #defines. Summary Message-ID: <40129@ames.arc.nasa.gov> Date: 9 Jan 90 18:50:09 GMT References: <40059@ames.arc.nasa.gov> Sender: usenet@ames.arc.nasa.gov Reply-To: dwhitney@pioneer.arc.nasa.gov (David Whitney- RCD) Organization: NASA Ames Research Center, Mtn Vw CA 94035 Lines: 41 First off, thanks to all who replied, you were all very helpful. The summary of all responses to the "where does one look to find all values previously "#defined" is as follows: cpp: The C preprocessor defines a certain amount of hardware/OS definitions that are either listed in the documentation for one's particular compiler or in "man cpp" under the description of the -U option. (e.g. "unix" "lint" "sun" "sgi" "vax" ....) Randal Schwartz (merlyn@iwarp.intel.com) contributes this incredibly useful bit of hacking that lists all cpp #defines: #!/bin/sh strings -2 /lib/cpp | sort -u | awk '/^[a-zA-Z_][a-zA-Z0-9_]*$/ { print "#ifdef " $0 "\n__" $0 "\n#endif" }' | /lib/cpp | sed -n 's/^__//p' Also the -D option to cc can specify more #defined values to pass to a program. Unfortunately there is no way to find these unless they are in the Makefile. (e.g. cc -D DEBUG foo.c) makefiles: The makefile for a particular program sometimes has these -D options listed. header files: Most local #defines are in the header (#include foo.h) files for a particular program. (e.g. _XLIB_H_, macros, MAXFOO, MINFOO, NULL, etc.) There could conceivably be many many of these nested #includes within #include files. "Xlib.h", for example, includes "X.h" and as well. (whether you like it or not). Much recursive searching is required to find all of these. Again, thanks to all whose input makes up this post, and I hope this helps any others in need. _____________ David Whitney whitney@athena.arc.nasa.gov