This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
preprocessor/3571: cpp -traditional inserts line breaks
- To: gcc-gnats at gcc dot gnu dot org
- Subject: preprocessor/3571: cpp -traditional inserts line breaks
- From: Erik Schnetter <schnetter at uni-tuebingen dot de>
- Date: Thu, 5 Jul 2001 15:38:19 +0200
>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
>Closed-Date:
>Last-Modified:
>Originator: Erik Schnetter
>Release: 3.0
>Organization:
Theoretische Astrophysik Tuebingen
>Environment:
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
>Description:
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.
>How-To-Repeat:
The following input to the preprocessor (four lines)
#define ARGUMENTS a\
subroutine yada (ARGUMENTS)
end
leads to the following output (seven lines)
# 1 "printit.F77"
subroutine yada (a
)
# 4 "printit.F77"
end
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.
>Fix:
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.
>Release-Note:
>Audit-Trail:
>Unformatted: