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
This commit is contained in:
Tobias Schlüter 2005-05-09 20:26:20 +02:00
parent 8d933e3147
commit 7f42f27f33
5 changed files with 42 additions and 9 deletions

View File

@ -1,3 +1,9 @@
2005-05-09 Tobias Schl"uter <tobias.schlueter@physik.uni-muenchen.de>
* 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.
2005-05-08 Kazu Hirata <kazu@cs.umass.edu>
* intrinsic.texi: Fix typos.

View File

@ -665,7 +665,12 @@ gfc_show_symbol (gfc_symbol * sym)
gfc_status ("Formal arglist:");
for (formal = sym->formal; formal; formal = formal->next)
gfc_status (" %s", formal->sym->name);
{
if (formal->sym != NULL)
gfc_status (" %s", formal->sym->name);
else
gfc_status (" [Alt Return]");
}
}
if (sym->formal_ns)

View File

@ -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;

View File

@ -1,4 +1,8 @@
2005-05-06 J"orn Rennecke <joern.rennecke@st.com>
2005-05-09 Tobias Schl"uter <tobias.schlueter@physik.uni-muenchen.de>
* gfortran.dg/return_1.f90: New test.
2005-05-09 J"orn Rennecke <joern.rennecke@st.com>
* gcc.dg/pr15784-3.c: Add -fno-finite-math-only option.

View File

@ -0,0 +1,6 @@
! { dg-do compile }
! Test cases where no blank is required after RETURN
subroutine sub(*)
return(1)
return1 ! { dg-error }
end subroutine