summaryrefslogtreecommitdiff
path: root/gcc/fortran/match.c
diff options
context:
space:
mode:
authorTobias Schlüter <tobi@gcc.gnu.org>2005-05-09 20:26:20 +0200
committerTobias Schlüter <tobi@gcc.gnu.org>2005-05-09 20:26:20 +0200
commit7f42f27f33ae26a2be1c45e919ff25dbc62a3b36 (patch)
tree6cbc92e1a470f9ed0e5cfee87f772eefa3d3c7a6 /gcc/fortran/match.c
parent8d933e3147616e970f36e1b01d2b389ecc87b15c (diff)
downloadgcc-7f42f27f33ae26a2be1c45e919ff25dbc62a3b36.tar.gz
match.c (gfc_match_return): Only require space after keyword when it is obligatory.
fortran/ * match.c (gfc_match_return): Only require space after keyword when it is obligatory. Only give stdwarn to after matching is successful. * dump-parse-tree.c (gfc_show_symbol): Deal with alternate returns. testsuite/ * gfortran.dg/return_1.f90: New test. From-SVN: r99467
Diffstat (limited to 'gcc/fortran/match.c')
-rw-r--r--gcc/fortran/match.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/gcc/fortran/match.c b/gcc/fortran/match.c
index d81686bb134..741e1a30607 100644
--- a/gcc/fortran/match.c
+++ b/gcc/fortran/match.c
@@ -1983,12 +1983,7 @@ gfc_match_return (void)
gfc_expr *e;
match m;
gfc_compile_state s;
-
- gfc_enclosing_unit (&s);
- if (s == COMP_PROGRAM
- && gfc_notify_std (GFC_STD_GNU, "Extension: RETURN statement in "
- "main program at %C") == FAILURE)
- return MATCH_ERROR;
+ int c;
e = NULL;
if (gfc_match_eos () == MATCH_YES)
@@ -2001,7 +1996,18 @@ gfc_match_return (void)
goto cleanup;
}
- m = gfc_match ("% %e%t", &e);
+ if (gfc_current_form == FORM_FREE)
+ {
+ /* The following are valid, so we can't require a blank after the
+ RETURN keyword:
+ return+1
+ return(1) */
+ c = gfc_peek_char ();
+ if (ISALPHA (c) || ISDIGIT (c))
+ return MATCH_NO;
+ }
+
+ m = gfc_match (" %e%t", &e);
if (m == MATCH_YES)
goto done;
if (m == MATCH_ERROR)
@@ -2014,6 +2020,12 @@ cleanup:
return MATCH_ERROR;
done:
+ gfc_enclosing_unit (&s);
+ if (s == COMP_PROGRAM
+ && gfc_notify_std (GFC_STD_GNU, "Extension: RETURN statement in "
+ "main program at %C") == FAILURE)
+ return MATCH_ERROR;
+
new_st.op = EXEC_RETURN;
new_st.expr = e;