summaryrefslogtreecommitdiffstats
path: root/gcc/fortran/io.c
diff options
context:
space:
mode:
authorsayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4>2004-05-21 21:37:25 +0000
committersayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4>2004-05-21 21:37:25 +0000
commit61fa81cc91924163fd83420c2dcfcedfbe23a641 (patch)
treed8fe1bebb6dada99658d820fef0bcdf6b8789378 /gcc/fortran/io.c
parentc7fe03c012a11c8b641a4e140914034e11538ca3 (diff)
downloadppe42-gcc-61fa81cc91924163fd83420c2dcfcedfbe23a641.tar.gz
ppe42-gcc-61fa81cc91924163fd83420c2dcfcedfbe23a641.zip
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@82109 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran/io.c')
-rw-r--r--gcc/fortran/io.c36
1 files changed, 35 insertions, 1 deletions
diff --git a/gcc/fortran/io.c b/gcc/fortran/io.c
index 6a31bfa04fb..120b44003c4 100644
--- a/gcc/fortran/io.c
+++ b/gcc/fortran/io.c
@@ -481,9 +481,11 @@ format_item:
case FMT_SIGN:
case FMT_BLANK:
- case FMT_CHAR:
goto between_desc;
+ case FMT_CHAR:
+ goto extension_optional_comma;
+
case FMT_COLON:
case FMT_SLASH:
goto optional_comma;
@@ -728,6 +730,38 @@ optional_comma:
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:
/* Something went wrong. If the format we're checking is a string,
generate a warning, since the program is correct. If the format
OpenPOWER on IntegriCloud