This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran 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]

Re: [PATCH] Fix PR14569 again


Tobias Schlüter wrote:
> Richard Guenther wrote:
> 
>>Ok for mainline?
> 
> 
> Yes, but please add a free-form testcase also (132 columns IIRC).

This is what I re-checked and comitted:


2005-04-17  Richard Guenther  <rguenth@gcc.gnu.org>

        * scanner.c (gfc_next_char_literal): Reset truncation flag
        for lines ending in a comment for both fixed and free form.
        (load_line): Do not set truncated flag if only truncating
        the EOL marker.

        * gfortran.dg/wtruncate.f: New testcase.
        * gfortran.dg/wtruncate.f90: 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	17 Apr 2005 11:50:46 -0000
***************
*** 458,463 ****
--- 458,466 ----
  	    }
  	  while (c != '\n');
  
+ 	  /* Avoid truncation warnings for comment ending lines.  */
+ 	  gfc_current_locus.lb->truncated = 0;
+ 
  	  goto done;
  	}
  
***************
*** 525,530 ****
--- 528,536 ----
  	      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);
--- 764,776 ----
        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



! { dg-do compile }
! { dg-options "-Wall" }

! This long comment line should not trigger a line-truncation warning with -Wall even for free-form 132 character line limit (blah blah)

      PROGRAM foo
      WRITE (*,*) "Test"           ! Neither this comment which exceeds the 132 character limit with some random words, too (blah blah)
      WRITE (*,*) "This exactly 132 character long soruce line not, too.  How can people fill 132 characters without sensless stuff"
      END


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