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://*.com/questions/4900870/can-gcc-output-c-code-after-preprocessing

https://*.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
option effect
-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

 

上一篇:Chrome浏览器自定义设置个人信息存储路径


下一篇:pip安装阿里云镜像scipy————PyTorch