From 52f4993488d2dd12d66dd99c2937e59319d0b1b6 Mon Sep 17 00:00:00 2001 From: Daniel Kraft Date: Tue, 2 Sep 2008 10:13:21 +0200 Subject: gfortran.h (struct gfc_namespace): New member `implicit_loc'. 2008-09-02 Daniel Kraft * gfortran.h (struct gfc_namespace): New member `implicit_loc'. (gfc_add_abstract): New method. * decl.c (gfc_get_type_attr_spec): Match ABSTRACT attribute. (gfc_match_derived_decl): Copy abstract attribute in derived symbol. * dump-parse-tree.c (show_attr): Show ABSTRACT attribute as `ABSTRACT' only to allow for ABSTRACT types. * parse.c (parse_interface): Use new gfc_add_abstract. * primary.c (gfc_match_structure_constructor): Check that no ABSTRACT type is constructed. * resolve.c (resolve_typespec_used): New method. (resolve_fl_derived): Check type in respect to ABSTRACT attribute and check that no component is of an ABSTRACT type. (resolve_symbol): Check that no symbol is of an ABSTRACT type. (resolve_types): Check IMPLICIT declarations for ABSTRACT types. * symbol.c (gfc_merge_new_implicit): Remember loci of IMPLICIT's. (gfc_add_abstract): New method. 2008-09-02 Daniel Kraft * gfortran.dg/abstract_type_1.f90: New test. * gfortran.dg/abstract_type_2.f03: New test. * gfortran.dg/abstract_type_3.f03: New test. * gfortran.dg/abstract_type_4.f03: New test. From-SVN: r139885 --- gcc/fortran/decl.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'gcc/fortran/decl.c') diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c index b3ec1a6..7e4cabf 100644 --- a/gcc/fortran/decl.c +++ b/gcc/fortran/decl.c @@ -6361,7 +6361,7 @@ gfc_get_type_attr_spec (symbol_attribute *attr, char *name) if (gfc_add_access (attr, ACCESS_PUBLIC, NULL, NULL) == FAILURE) return MATCH_ERROR; } - else if (gfc_match(" , bind ( c )") == MATCH_YES) + else if (gfc_match (" , bind ( c )") == MATCH_YES) { /* If the type is defined to be bind(c) it then needs to make sure that all fields are interoperable. This will @@ -6372,6 +6372,15 @@ gfc_get_type_attr_spec (symbol_attribute *attr, char *name) /* TODO: attr conflicts need to be checked, probably in symbol.c. */ } + else if (gfc_match (" , abstract") == MATCH_YES) + { + if (gfc_notify_std (GFC_STD_F2003, "Fortran 2003: ABSTRACT type at %C") + == FAILURE) + return MATCH_ERROR; + + if (gfc_add_abstract (attr, &gfc_current_locus) == FAILURE) + return MATCH_ERROR; + } else if (name && gfc_match(" , extends ( %n )", name) == MATCH_YES) { if (gfc_add_extension (attr, &gfc_current_locus) == FAILURE) @@ -6479,11 +6488,9 @@ gfc_match_derived_decl (void) if (attr.is_bind_c != 0) sym->attr.is_bind_c = attr.is_bind_c; - /* Construct the f2k_derived namespace if it is not yet there. */ if (!sym->f2k_derived) sym->f2k_derived = gfc_get_namespace (NULL, 0); - if (extended && !sym->components) { @@ -6507,6 +6514,9 @@ gfc_match_derived_decl (void) st->n.sym = sym; } + /* Take over the ABSTRACT attribute. */ + sym->attr.abstract = attr.abstract; + gfc_new_block = sym; return MATCH_YES; -- cgit v1.1