aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/decl.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/fortran/decl.c')
-rw-r--r--gcc/fortran/decl.c52
1 files changed, 51 insertions, 1 deletions
diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c
index 0e0364c..a089be4 100644
--- a/gcc/fortran/decl.c
+++ b/gcc/fortran/decl.c
@@ -2946,7 +2946,50 @@ get_kind:
match
gfc_match_implicit_none (void)
{
- return (gfc_match_eos () == MATCH_YES) ? MATCH_YES : MATCH_NO;
+ char c;
+ match m;
+ char name[GFC_MAX_SYMBOL_LEN + 1];
+ bool type = false;
+ bool external = false;
+
+ gfc_gobble_whitespace ();
+ c = gfc_peek_ascii_char ();
+ if (c == '(')
+ {
+ (void) gfc_next_ascii_char ();
+ if (!gfc_notify_std (GFC_STD_F2015, "IMPORT NONE with spec list at %C"))
+ return MATCH_ERROR;
+ for(;;)
+ {
+ m = gfc_match (" %n", name);
+ if (m != MATCH_YES)
+ return MATCH_ERROR;
+
+ if (strcmp (name, "type") == 0)
+ type = true;
+ else if (strcmp (name, "external") == 0)
+ external = true;
+ else
+ return MATCH_ERROR;
+
+ gfc_gobble_whitespace ();
+ c = gfc_next_ascii_char ();
+ if (c == ',')
+ continue;
+ if (c == ')')
+ break;
+ return MATCH_ERROR;
+ }
+ }
+ else
+ type = true;
+
+ if (gfc_match_eos () != MATCH_YES)
+ return MATCH_ERROR;
+
+ gfc_set_implicit_none (type, external);
+
+ return MATCH_YES;
}
@@ -3062,6 +3105,13 @@ gfc_match_implicit (void)
char c;
match m;
+ if (gfc_current_ns->seen_implicit_none)
+ {
+ gfc_error ("IMPLICIT statement at %C following an IMPLICIT NONE (type) "
+ "statement");
+ return MATCH_ERROR;
+ }
+
gfc_clear_ts (&ts);
/* We don't allow empty implicit statements. */