Commit e08b5a75 by Tobias Schlüter Committed by Tobias Schlüter

re PR fortran/16404 (should reject invalid code with -pedantic -std=f95 ? (x8))

PR fortran/16404
* match.c (gfc_match_program): A program name is obligatory.
(gfc_match_return): RETURN in main program is an extension.
(gfc_match_block_data): A space is required before a block data
name.

From-SVN: r84511
parent cdde7b65
...@@ -6,6 +6,12 @@ ...@@ -6,6 +6,12 @@
PR fortran/16404 PR fortran/16404
* io.c (match_io): Flag 'WRITE(...), ...' as extension. * io.c (match_io): Flag 'WRITE(...), ...' as extension.
PR fortran/16404
* match.c (gfc_match_program): A program name is obligatory.
(gfc_match_return): RETURN in main program is an extension.
(gfc_match_block_data): A space is required before a block data
name.
2004-07-11 Joseph S. Myers <jsm@polyomino.org.uk> 2004-07-11 Joseph S. Myers <jsm@polyomino.org.uk>
......
...@@ -791,7 +791,7 @@ not_yes: ...@@ -791,7 +791,7 @@ not_yes:
/*********************** Statement level matching **********************/ /*********************** Statement level matching **********************/
/* Matches the start of a program unit, which is the program keyword /* Matches the start of a program unit, which is the program keyword
followed by an optional symbol. */ followed by an obligatory symbol. */
match match
gfc_match_program (void) gfc_match_program (void)
...@@ -799,10 +799,6 @@ gfc_match_program (void) ...@@ -799,10 +799,6 @@ gfc_match_program (void)
gfc_symbol *sym; gfc_symbol *sym;
match m; match m;
m = gfc_match_eos ();
if (m == MATCH_YES)
return m;
m = gfc_match ("% %s%t", &sym); m = gfc_match ("% %s%t", &sym);
if (m == MATCH_NO) if (m == MATCH_NO)
...@@ -1897,6 +1893,13 @@ gfc_match_return (void) ...@@ -1897,6 +1893,13 @@ gfc_match_return (void)
{ {
gfc_expr *e; gfc_expr *e;
match m; match m;
gfc_compile_state s;
gfc_enclosing_unit (&s);
if (s == COMP_PROGRAM
&& gfc_notify_std (GFC_STD_GNU, "RETURN statement in a main "
"program at %C is an extension.") == FAILURE)
return MATCH_ERROR;
e = NULL; e = NULL;
if (gfc_match_eos () == MATCH_YES) if (gfc_match_eos () == MATCH_YES)
...@@ -2295,7 +2298,7 @@ gfc_match_block_data (void) ...@@ -2295,7 +2298,7 @@ gfc_match_block_data (void)
return MATCH_YES; return MATCH_YES;
} }
m = gfc_match (" %n%t", name); m = gfc_match ("% %n%t", name);
if (m != MATCH_YES) if (m != MATCH_YES)
return MATCH_ERROR; return MATCH_ERROR;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment