I need to see what is happeing under the hood before compilation. How? The following is an example out of many...
I am compiling the Intel Math Lib and that works fine. There are different options to get it running that influence how symbols are defined during precompilation.
I can deduct from the "build code" (make/cmake), what should happen, but my expectations don't match the results. Therefore I would now like to "look into it" and see what actually happens.
Example (simplyfied from bid_conf.h
in the mentioned Intel library): The client code using the math library calls this:
num_to_string(s, num);
The code that defines num_to_string
is defined further up during precompilation:
BID_EXTERN_C void bid128_to_string (char *str, BID_UINT128 x _EXC_FLAGS_PARAM);
Now _EXC_FLAGS_PARAM
is evaluated depending on build arguments, defined here:
#if !DECIMAL_GLOBAL_EXCEPTION_FLAGS
#define _EXC_FLAGS_PARAM , _IDEC_flags *pfpsf
#else
#define _EXC_FLAGS_ARG
#endif
That reads: If the exception flags are not set, then _EXC_FLAGS_PARAM
becomes ", _IDEC_flags *pfpsf
" or else "" (nada).
The flag is? set but I still get:
error: too few arguments to function call, expected 3, have 2
num_to_string(s, num);
So _EXC_FLAGS_PARAM
becomes ", _IDEC_flags *pfpsf
". But DECIMAL_GLOBAL_EXCEPTION_FLAGS
is set!...
...or is it not?
How can I print out what is actually set while it is happening, like:
#please_print_this(DECIMAL_GLOBAL_EXCEPTION_FLAGS)
Or even better: see the intermediate output, basically what the compiler ultimately gets fed with...
(No C compiler expert but could not find an answer yet).
If you're using gcc, compile with the
-E
option. That will run just the preprocessor and output the result to stdout. Then you can see what the macros expand to.