其他分享
首页 > 其他分享> > GCC/CLANG 扩展宏并调试

GCC/CLANG 扩展宏并调试

作者:互联网


 

 

 

${CC} $(INC) -E demo.c > demo.i
${CC} $(INC) -E -P demo.c > demo.i
${CC} $(INC) -E demo.c | sed '/^\#/d' | indent -st -i2 > demo-e.c
${CC} $(INC) -E -P -C demo.c | indent -st -i2 > code-x.c
${CC} $(INC) -E -x c -P -C -traditional-cpp demo.c > demo-e.c
${CC} $(INC) -E -x c -C demo.c > demo-e.c

 

https://stackoverflow.com/questions/4900870/can-gcc-output-c-code-after-preprocessing

https://stackoverflow.com/questions/277258/how-do-i-see-a-c-c-source-file-after-preprocessing-in-visual-studio

 

 

https://jkorpela.fi/html/cpre.html

 

The options (switches) you need to give in such a case depend on the C compiler. The following instructions apply to the Gnu C compiler (gcc). For other compilers, the options could be similar, but please check the applicable manuals.

gcc options when using a preprocessor for non-C files
optioneffect
-E preprocessing only
-x c interpret files as C source files (instead of treating them as object files); this option is given to make the compiler preprocess them
-P don't generate #line directives (which would of course mess things up in HTML documents!)
-C do not ignore comments (since an HTML document might contain data which would be a comment in C)

When these options are used, gcc writes the preprocessed data (e.g. with #include directives replaced by the contents of the files referred to) to standard output. Thus, assuming you have a document demo.htm which is an HTML document except for the use of #include directives, you can generate an HTML document demo.html from it with the command
gcc -E -x c -P -C demo.htm >demo.html

 

标签:files,GCC,CC,demo,CLANG,HTML,options,调试,INC
来源: https://www.cnblogs.com/sinferwu/p/15821913.html