Community
cancel
Showing results for 
Search instead for 
Did you mean: 
eldiener
New Contributor I
169 Views

Preprocessor macro expansion

Is there any compiler option for Intel C++ 17.0 which will show me the expansion of a preprocessor macro step-by-step when compiling a source file ?

I know that I can compile a complete source file's preprocessor output to a file, but I need to see each macro expansion step for a particular macro expansion of a source file to determine why the compiler is not expanding the macro properly.

0 Kudos
6 Replies
Varsha_M_Intel
Employee
169 Views

Hi,

If you are using linux, you can use -
icc -dM -E source.c

For windows:
icl /QdM /E source.c

Please let me know if it works.

Thanks,
Varsha

 

Judith_W_Intel
Employee
169 Views

 

The dump macros option just dumps the macros -- it will not show you the macro expansions.

We do not have a switch that will show macros being expanded.

Judy

jimdempseyatthecove
Black Belt
169 Views

On Linux, you can get the sources to the C preprocessor. You can modify that to emit the macro line before and as it expands.

Someone may have done this, a little googling might find it.

Jim Dempsey

 

eldiener
New Contributor I
169 Views

jimdempseyatthecove wrote:

On Linux, you can get the sources to the C preprocessor. You can modify that to emit the macro line before and as it expands.

Someone may have done this, a little googling might find it.

Jim Dempsey

 

Currently I am working with Intel C++ 17.0 on Windows. But even if I were working with Intel C++ on Linux I would have to rebuild the compiler. Both gcc and clang have ways to show a macro expansion so I was hoping Intel C++ would have it also.

TimP
Black Belt
169 Views

-E -P work similarly with icc as with g++.

eldiener
New Contributor I
169 Views

Tim P. wrote:

-E -P work similarly with icc as with g++.

AFAIK -E -P shows complete macro expansion. I am looking for a means of showing step-by-step macro expansion for a particular macro.

 

Reply