io.c (check_format): As a GNU extension...
* io.c (check_format): As a GNU extension, allow the comma after a string literal to be optional in a format. Use gfc_notify_std to issue an error/warning as appropriate. * io/format.c (parse_format_list): Allow the comma after a string literal to be optional. From-SVN: r82109
This commit is contained in:
parent
0b817eb02d
commit
11670eebf3
|
@ -1,3 +1,9 @@
|
||||||
|
2004-05-21 Roger Sayle <roger@eyesopen.com>
|
||||||
|
|
||||||
|
* io.c (check_format): As a GNU extension, allow the comma after a
|
||||||
|
string literal to be optional in a format. Use gfc_notify_std to
|
||||||
|
issue an error/warning as appropriate.
|
||||||
|
|
||||||
2004-05-21 Roger Sayle <roger@eyesopen.com>
|
2004-05-21 Roger Sayle <roger@eyesopen.com>
|
||||||
|
|
||||||
* io.c (check_format): Use gfc_notify_std to determine whether to
|
* io.c (check_format): Use gfc_notify_std to determine whether to
|
||||||
|
|
|
@ -481,9 +481,11 @@ format_item:
|
||||||
|
|
||||||
case FMT_SIGN:
|
case FMT_SIGN:
|
||||||
case FMT_BLANK:
|
case FMT_BLANK:
|
||||||
case FMT_CHAR:
|
|
||||||
goto between_desc;
|
goto between_desc;
|
||||||
|
|
||||||
|
case FMT_CHAR:
|
||||||
|
goto extension_optional_comma;
|
||||||
|
|
||||||
case FMT_COLON:
|
case FMT_COLON:
|
||||||
case FMT_SLASH:
|
case FMT_SLASH:
|
||||||
goto optional_comma;
|
goto optional_comma;
|
||||||
|
@ -728,6 +730,38 @@ optional_comma:
|
||||||
|
|
||||||
goto format_item;
|
goto format_item;
|
||||||
|
|
||||||
|
extension_optional_comma:
|
||||||
|
/* As a GNU extension, permit a missing comma after a string literal. */
|
||||||
|
t = format_lex ();
|
||||||
|
switch (t)
|
||||||
|
{
|
||||||
|
case FMT_COMMA:
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FMT_RPAREN:
|
||||||
|
level--;
|
||||||
|
if (level < 0)
|
||||||
|
goto finished;
|
||||||
|
goto between_desc;
|
||||||
|
|
||||||
|
case FMT_COLON:
|
||||||
|
case FMT_SLASH:
|
||||||
|
goto optional_comma;
|
||||||
|
|
||||||
|
case FMT_END:
|
||||||
|
error = unexpected_end;
|
||||||
|
goto syntax;
|
||||||
|
|
||||||
|
default:
|
||||||
|
if (gfc_notify_std (GFC_STD_GNU, "Extension: Missing comma at %C")
|
||||||
|
== FAILURE)
|
||||||
|
return FAILURE;
|
||||||
|
saved_token = t;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
goto format_item;
|
||||||
|
|
||||||
syntax:
|
syntax:
|
||||||
/* Something went wrong. If the format we're checking is a string,
|
/* Something went wrong. If the format we're checking is a string,
|
||||||
generate a warning, since the program is correct. If the format
|
generate a warning, since the program is correct. If the format
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
2004-05-21 Roger Sayle <roger@eyesopen.com>
|
||||||
|
|
||||||
|
* io/format.c (parse_format_list): Allow the comma after a string
|
||||||
|
literal to be optional.
|
||||||
|
|
||||||
2004-05-18 Paul Brook <paul@codesourcery.com>
|
2004-05-18 Paul Brook <paul@codesourcery.com>
|
||||||
Feng Wang <fengwang@nudt.edu.cn>
|
Feng Wang <fengwang@nudt.edu.cn>
|
||||||
|
|
||||||
|
|
|
@ -543,7 +543,7 @@ format_item:
|
||||||
tail->u.string.p = string;
|
tail->u.string.p = string;
|
||||||
tail->u.string.length = value;
|
tail->u.string.length = value;
|
||||||
tail->repeat = 1;
|
tail->repeat = 1;
|
||||||
goto between_desc;
|
goto optional_comma;
|
||||||
|
|
||||||
case FMT_S:
|
case FMT_S:
|
||||||
case FMT_SS:
|
case FMT_SS:
|
||||||
|
|
Loading…
Reference in New Issue