Bug 447833 - cpp adds extraneous blank lines at beginning of output
cpp adds extraneous blank lines at beginning of output
Product: Fedora
Classification: Fedora
Component: gcc (Show other bugs)
All Linux
low Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
Fedora Extras Quality Assurance
: Reopened
Depends On:
  Show dependency treegraph
Reported: 2008-05-21 21:33 EDT by JW
Modified: 2008-05-29 10:38 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2008-05-29 10:38:57 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description JW 2008-05-21 21:33:32 EDT
Description of problem:
cpp adds extraneous blank lines at beginning of output

Version-Release number of selected component (if applicable):

How reproducible:

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
Comment 1 Jakub Jelinek 2008-05-29 06:57:03 EDT
cpp never makes any whitespace guarantees.
Comment 2 JW 2008-05-29 07:02:45 EDT
Yes, it does.

> When GCC is given the `-traditional-cpp' option, it attempts to emulate a
> traditional preprocessor.
Comment 3 Jakub Jelinek 2008-05-29 10:18:58 EDT
And how is that relevant to this?  You are not using -traditional-cpp, nor this
describes how traditional preprocessor should behave.
Comment 4 JW 2008-05-29 10:30:08 EDT
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
Comment 5 Jakub Jelinek 2008-05-29 10:38:57 EDT
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.

Note You need to log in before you can comment on or make changes to this bug.