GCC preprocessor deleting comments

Can I instruct the GCC preprocessor not to delete comments when processing files?

+3
source share
3 answers

GCC has the -C option to save comments.

`-C'
     Do not discard comments.  All comments are passed through to the
     output file, except for comments in processed directives, which
     are deleted along with the directive.

     You should be prepared for side effects when using `-C'; it causes
     the preprocessor to treat comments as tokens in their own right.
     For example, comments appearing at the start of what would be a
     directive line have the effect of turning that line into an
     ordinary source line, since the first token on the line is no
     longer a `#'.
+4
source

Yes, you can do this with the option -C. For instance.

gcc -C -E myfile.c
+2
source

man gccand use / -C(slash, space, dash, capitcal C) to make it smaller (which is probably your pager program), for the -C option, use nsearch again (description 3rd hit). Related parameters are listed above and below.

+2
source

Source: https://habr.com/ru/post/1731575/


All Articles