cpp -dM /dev/null
Here is example (with output I'm getting under Linux):
bash-2.04$ gcc -E -dM -x c /dev/null
#define __linux__ 1
#define linux 1
#define __i386__ 1
#define __i386 1
#define __GNUC_MINOR__ 95
#define i386 1
#define __unix 1
#define __unix__ 1
#define __GNUC__ 2
#define __linux 1
#define __ELF__ 1
#define unix 1
-dCHARS
CHARS is a sequence of one or more of the following characters, and
must not be preceded by a space. Other characters are interpreted
by the compiler proper, or reserved for future versions of GCC, and
so are silently ignored. If you specify characters whose behavior
conflicts, the result is undefined.
M Instead of the normal output, generate a list of #define direc-
tives for all the macros defined during the execution of the
preprocessor, including predefined macros. This gives you a
way of finding out what is predefined in your version of the
preprocessor. Assuming you have no file foo.h, the command
touch foo.h; cpp -dM foo.h
will show all the predefined macros.
-c
-S
-E If any of these options is used, then the linker is not run, and
object file names should not be used as arguments.
-x language
Specify explicitly the language for the following input files
(rather than letting the compiler choose a default based on the
file name suffix). This option applies to all following input
files until the next -x option. Possible values for language are:
c c-header cpp-output
c++ c++-cpp-output
objective-c objc-cpp-output
assembler assembler-with-cpp
ada
f77 f77-cpp-input ratfor
java
没有评论:
发表评论