This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug preprocessor/24024] New: gcc -E -C processes "\" incorrectly inside C comments


Try the following stripped-down example file:

---------------------- dummy.txt -----------------------------
/* Execute example with: gcc -E -P -C -x c dummy.txt
a \
b \
c
*/
---------------------- dummy.txt -----------------------------

i.e. there are continuation lines *inside* C comments.


Result with GCC <= 3.4 (verified with 3.2.3, 3.3.2):

----------------------------------------------------------------
/* Execute example with: gcc -E -P -C -x c dummy.txt
a \
b \
c
*/
----------------------------------------------------------------

i.e. unchanged.


Result with GCC >= 3.4 (verified with 3.4.1, 3.4.3 [RHEL4], 3.4.4, 4.0.0,
4.1-20050625):

----------------------------------------------------------------
/* Execute example with: gcc -E -P -C -x c dummy.txt
a b c
\
c
*/
----------------------------------------------------------------

i.e. the lines were merged but the some of the original contents are still
there! I know this is arcane but I'm using cpp to process #if's and it should
leave the contents of the comments untouched as it is used by another tool down
the line.


I'm not so sure what the standard says about line continuation inside C comments
but if the lines should be merged I would expect the following result:

----------------------------------------------------------------
/* Execute example with: gcc -E -P -C -x c dummy.txt
a b c
*/
----------------------------------------------------------------

which would be OK.

-- 
           Summary: gcc -E -C processes "\" incorrectly inside C comments
           Product: gcc
           Version: 3.4.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: preprocessor
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: stefan dot becker at nokia dot com
                CC: gcc-bugs at gcc dot gnu dot org
  GCC host triplet: i386-redhat-linux
GCC target triplet: i386-redhat-linux


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24024


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]