This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
[PATCH] Fix PR14569 again
- From: Richard Guenther <rguenth at tat dot physik dot uni-tuebingen dot de>
- To: fortran at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: Sat, 16 Apr 2005 21:11:58 +0200
- Subject: [PATCH] Fix PR14569 again
This second patch fixes a bug introduced by the previous fix to
PR14569 (warning for 72 character lines) and fixes the remaining
warning for comment ending lines in fixed form. It also adds
a testcase.
Bootstrapped and tested on x86-64_linux-gnu.
Ok for mainline?
Thanks,
Richard.
2005-04-16 Richard Guenther <rguenth@gcc.gnu.org>
PR fortran/14569
* scanner.c (gfc_next_char_literal): Reset truncation flag
for lines ending in a comment.
(load_line): Do not set truncated flag if only truncating
the EOL marker.
* gfortran.dg/wtruncate.f: New testcase.
Index: scanner.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fortran/scanner.c,v
retrieving revision 1.17
diff -c -3 -r1.17 scanner.c
*** scanner.c 15 Apr 2005 20:35:26 -0000 1.17
--- scanner.c 16 Apr 2005 19:01:36 -0000
***************
*** 525,530 ****
--- 525,533 ----
c = next_char ();
}
while (c != '\n');
+
+ /* Avoid truncation warnings for comment ending lines. */
+ gfc_current_locus.lb->truncated = 0;
}
if (c != '\n')
***************
*** 758,770 ****
else if (i >= buflen)
{
/* Truncate the rest of the line. */
- trunc_flag = 1;
-
for (;;)
{
c = fgetc (input);
if (c == '\n' || c == EOF)
break;
}
ungetc ('\n', input);
--- 761,773 ----
else if (i >= buflen)
{
/* Truncate the rest of the line. */
for (;;)
{
c = fgetc (input);
if (c == '\n' || c == EOF)
break;
+
+ trunc_flag = 1;
}
ungetc ('\n', input);
! { dg-do compile }
! { dg-options "-Wall" }
! This long comment line should not trigger a line-truncation warning with -Wall
PROGRAM foo
WRITE (*,*) "Test" ! Neither this comment which exceeds the 72 character limit, too
WRITE (*,*) "This exactly 72 character long soruce line not, too."
END