Patchwork [fortran] PR42852 -Wall warns about truncated lines when only a continuation character is truncated

login
register
mail settings
Submitter Jerry DeLisle
Date July 25, 2010, 6:51 p.m.
Message ID <4C4C87BC.3020507@verizon.net>
Download mbox | patch
Permalink /patch/59877/
State New
Headers show

Comments

Jerry DeLisle - July 25, 2010, 6:51 p.m.
On 07/25/2010 02:23 AM, Tobias Burnus wrote:
> integer :: a  [many spaces]&
> , b
> end
>
> The error is:
> , b
>   1
> Error: Invalid character in name at (1)
>
> Expected: Additionally, one should see
>     Warning: Line truncated at (1)
> In case of free form code, the '&' is significant - and it can easily
> happen that just the continuation character moves beyond column 132.
>

I will commit the following shortly as obvious to give the warning of free-form
continuation gets chopped.

Regression tested on x86-64-linux-gnu

Regards,

Jerry
Jerry DeLisle - July 25, 2010, 7:11 p.m.
On 07/25/2010 11:51 AM, Jerry DeLisle wrote:
> On 07/25/2010 02:23 AM, Tobias Burnus wrote:
>> integer :: a [many spaces]&
>> , b
>> end
>>
>> The error is:
>> , b
>> 1
>> Error: Invalid character in name at (1)
>>
>> Expected: Additionally, one should see
>> Warning: Line truncated at (1)
>> In case of free form code, the '&' is significant - and it can easily
>> happen that just the continuation character moves beyond column 132.
>>
>
> I will commit the following shortly as obvious to give the warning of
> free-form
> continuation gets chopped.
>

Committed revision 162518.

Patch

Index: scanner.c
===================================================================
--- scanner.c	(revision 162512)
+++ scanner.c	(working copy)
@@ -1581,7 +1581,8 @@  load_line (FILE *input, gfc_char_t **pbuf, int *pb
  	      if (!trunc_warn && c != '!')
  		trunc_warn = true;

-	      if (trunc_warn && (c == '&' || c == '!'))
+	      if (trunc_warn && ((gfc_current_form == FORM_FIXED && c == '&')
+		  || c == '!'))
  		trunc_warn = false;

  	      if (c == '!')