-E Stop after the preprocessing stage; do not run the compiler proper. The output is in the form of preprocessed source code, which is sent to the standard output.
Input files which don't require preprocessing are ignored.
After setting the proper macros and running gcc with -E, I could immediately focus on the component to get what I wanted.
I have been using gcc for more than ten years, still there are more handy tricks to uncover.
Here is a simplified example showing the effect of the -E option. The following C function is saved in file "check_gcc_E.c".
--------------------------------------------------------------------------
#define GREETING "Hello World"
void check_gcc_E(void) {
#ifdef VERBOSE
printf("Macro VERBOSE is defined.\n");
printf("So you see: '%s'\n", GREETING);
#endif
printf("Hello everyone!\n");
}
--------------------------------------------------------------------------
gcc -E -DVERBOSE check_gcc_E.c
--------------------------------------------------------------------------
# 1 "check_gcc_E.c"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "check_gcc_E.c"
void check_gcc_E(void) {
printf("Macro VERBOSE defined\n");
printf("So you see: '%s'\n", "Hello World");
printf("Hello everyone!\n");
}
--------------------------------------------------------------------------
gcc -E check_gcc_E.c
--------------------------------------------------------------------------
# 1 "check_gcc_E.c"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "check_gcc_E.c"
void check_gcc_E(void) {
printf("Hello everyone!\n");
}
--------------------------------------------------------------------------