Description of problem: cpp adds extraneous blank lines at beginning of output Version-Release number of selected component (if applicable): gcc-4.1.2-33 How reproducible: Always Steps to Reproduce: 1. echo "/**/" >test 2. cpp -P -C test Actual results: Two extra empty lines inserted at beginning of output. Expected results: Output should be exactly the same as input because of -C (and -P) option. Additional info: Why is this a problem? Because if using cpp to preprocess other languages (eg for java code which needs C/C++ include definitions) then line numbers are not preserved.
cpp never makes any whitespace guarantees.
Yes, it does. > When GCC is given the `-traditional-cpp' option, it attempts to emulate a > traditional preprocessor.
And how is that relevant to this? You are not using -traditional-cpp, nor this describes how traditional preprocessor should behave.
Yes, I was also using -traditional-cpp but I inadvertently forgot to say so. There could be a bug in my bug entry mechanism. But that mechanism never makes any guarantees about accuracy. Also, cpp -P -C also adds the two extra lines. So the bug manifests itself in a variety of ways. Find the cause of this bug and you might find something bigger. Are you sure you wont?
As I said, cpp never does try to preserve the whitespace, never did. When you use -P you simply mean you don't care about mapping lines back to the original source. The two lines in the beginning in particular come from the builtin defines (try e.g. preprocessing with -dM to see what is there). Please stop reopening this.