Bug 447833

Summary: cpp adds extraneous blank lines at beginning of output
Product: [Fedora] Fedora Reporter: JW <ohtmvyyn>
Component: gccAssignee: Jakub Jelinek <jakub>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 8Keywords: Reopened
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2008-05-29 14:38:57 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description JW 2008-05-22 01:33:32 UTC
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.

Comment 1 Jakub Jelinek 2008-05-29 10:57:03 UTC
cpp never makes any whitespace guarantees.

Comment 2 JW 2008-05-29 11:02:45 UTC
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 14:18:58 UTC
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 14:30:08 UTC
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?


Comment 5 Jakub Jelinek 2008-05-29 14:38:57 UTC
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.