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

Re: [Patch, fortran] PR19260 & not required when splitting a token in continuation


:REVIEWMAIL:

Jerry DeLisle wrote:


i) It is not perfect. In the case of splitting tokens, it will allow the matchers to flag an error for all cases except where the token continues on the first character of the next line. I have not figured out how to test for that yet.



I got an inspiration. The attached updated patch inserts a space when the '&' is missing. This then catches the case of splitting the token by a continuation mentioned in the F95 Standard 3.3.1.3.1:


"If a lexical token is split across the end of a line, the ïrst nonblank character on the ïrst following noncomment line shall be an "&" immediately followed by the successive characters of the split token."

Regression tested. I will update the test case continuation_2.f90 appropriately.

OK for trunk?

Regards,

Jerry
Index: scanner.c
===================================================================
*** scanner.c	(revision 117065)
--- scanner.c	(working copy)
*************** restart:
*** 679,690 ****
  	    c = next_char ();
  	}
  
!       if (c != '&')
  	{
! 	  if (in_string && gfc_option.warn_ampersand)
! 	    gfc_warning ("Missing '&' in continued character constant at %C");
! 
! 	  gfc_current_locus.nextc--;
  	}
      }
    else
--- 679,700 ----
  	    c = next_char ();
  	}
  
!       if (c != '&' )
  	{
! 	  if (in_string)
! 	    {
! 	      if (gfc_option.warn_ampersand)
! 		gfc_warning ("Missing '&' in continued character constant at %C");
! 	      gfc_current_locus.nextc--;
! 	    }
! 	  else
! 	    {
! 	      if (gfc_option.warn_ampersand)
! 		gfc_warning ("Missing '&' in continuation at %C");
! 	      c = ' ';
! 	      gfc_current_locus = old_loc;
! 	      goto done;
! 	    }
  	}
      }
    else
Index: options.c
===================================================================
*** options.c	(revision 117065)
--- options.c	(working copy)
*************** gfc_post_options (const char **pfilename
*** 278,286 ****
    if (!gfc_option.flag_automatic)
      gfc_option.flag_max_stack_var_size = 0;
    
-   if (pedantic)
-     gfc_option.warn_ampersand = 1;
- 
    if (gfc_option.flag_all_intrinsics)
      gfc_option.warn_nonstd_intrinsics = 0;
  
--- 278,283 ----

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