Clang: Delete comments in pre-processed files?

Is there a way to tell clang to delete comment lines when generating preprocessed output?

Apparently this is the difference between gcc and clang, and I did not find a way to do this

thanks

Alex

To be more precise: it seems that I have a problem with input from a file, see this example: CONTENT="// \$REMOVE BEFORE FLIGHT\$\r\nprintf(\"HelloWorld!\");" echo "Original:\n$CONTENT" echo "-------------------------" echo "From stdin" echo $CONTENT | cpp -P -E -nostdinc -xc++ - echo "-------------------------" echo "From file" echo $CONTENT > foo.sample cpp -P -E -nostdinc -xc++ foo.sample echo "\n What gives?"

Addition: It seems that the argument has -xchanged. Using -v, I see what is actually passed on the command line -x c++, whereas when using a file as input, it changes to -x c.

Any idea why?

+4
source share

All Articles