This is the mail archive of the 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]

preprocessor/3571: cpp -traditional inserts line breaks

>Number:         3571
>Category:       preprocessor
>Synopsis:       cpp -traditional inserts line breaks
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Thu Jul 05 06:46:01 PDT 2001
>Originator:     Erik Schnetter
>Release:        3.0
Theoretische Astrophysik Tuebingen
System: Linux lilypond 2.4.4-4GB #1 Wed May 16 00:37:55 GMT 2001 i686 unknown
Architecture: i686

host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ../gcc-3.0/configure --prefix=/home/eschnett/gcc --enable-shared

I use "cpp -traditional" to preprocess Fortran 77 source code.  I
believe that many people do so, and that this is an important use of
cpp.  In Fortran 77, all statements have to begin in column 7.  "cpp
-traditional" inserts line breaks in macro invocations, and that leads
to syntax errors as certain lines are then broken into two.  I give an
example below.


The following input to the preprocessor (four lines)

#define ARGUMENTS a\

      subroutine yada (ARGUMENTS)

leads to the following output (seven lines)

# 1 "printit.F77"

      subroutine yada (a
# 4 "printit.F77"

when the precprcessor is called with "cpp -traditional printit.F77".
Note that the macro ARGUMENTS contains a newline character.  Contrary
to the cpp manual, the result of the macro expansion is not a single
line, but two lines.


You can use cpp without the -traditional switch to get correct newline
behaviour.  The disadvantage is then that apostrophes in Fortran
comments are treated a string delimiters and cause syntax errors.
This requires changes to Fortran comments.

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