diff options
author | Paul Thomas <pault@gcc.gnu.org> | 2008-07-29 20:44:09 +0000 |
---|---|---|
committer | Paul Thomas <pault@gcc.gnu.org> | 2008-07-29 20:44:09 +0000 |
commit | 7d1f1e6144bab4e9e2fadc324c5213b415efb952 (patch) | |
tree | 1d8aa1d99f6217a1f9fdc2522ae987cc7d2f9586 /gcc/fortran/module.c | |
parent | e54cf1573e36c71c5277d59fd1c1915984b06432 (diff) | |
download | gcc-7d1f1e6144bab4e9e2fadc324c5213b415efb952.zip gcc-7d1f1e6144bab4e9e2fadc324c5213b415efb952.tar.gz gcc-7d1f1e6144bab4e9e2fadc324c5213b415efb952.tar.bz2 |
trans-expr.c (conv_parent_component_references): New function to build missing parent references.
2008-07-29 Paul Thomas <pault@gcc.gnu.org>
fortran/
* trans-expr.c (conv_parent_component_references): New function
to build missing parent references.
(gfc_conv_variable): Call it
* symbol.c (gfc_add_component): Check that component name in a
derived type extension does not appear in parent.
(gfc_find_component): For a derived type extension, check if
the component appears in the parent derived type by calling
self. Separate errors for private components and private types.
* decl.c (match_data_constant): Add extra arg to call to
gfc_match_structure_constructor.
(check_extended_derived_type): New function to check that a
parent derived type exists and that it is OK for exension.
(gfc_get_type_attr_spec): Add extra argument 'name' and return
it if extends is specified.
(gfc_match_derived_decl): Match derived type extension and
build a first component of the parent derived type if OK. Add
the f2k namespace if not present.
* gfortran.h : Add the extension attribute.
* module.c : Handle attribute 'extension'.
* match.h : Modify prototypes for gfc_get_type_attr_spec and
gfc_match_structure_constructor.
* primary.c (build_actual_constructor): New function extracted
from gfc_match_structure_constructor and modified to call self
iteratively to build derived type extensions, when f2k named
components are used.
(gfc_match_structure_constructor): Do not throw error for too
many components if a parent type is being handled. Use
gfc_find_component to generate errors for non-existent or
private components. Iteratively call self for derived type
extensions so that parent constructor is built. If extension
and components left over, throw error.
(gfc_match_rvalue): Add extra arg to call to
gfc_match_structure_constructor.
* trans-array.c (gfc_conv_resolve_dependencies): If lhs and rhs
are the same symbol, aliassing does not matter.
testsuite/
* gfortran.dg/extends_1.f03: New test.
* gfortran.dg/extends_2.f03: New test.
* gfortran.dg/extends_3.f03: New test.
* gfortran.dg/extends_4.f03: New test.
* gfortran.dg/extends_5.f03: New test.
* gfortran.dg/extends_6.f03: New test.
* gfortran.dg/private_type_6.f90: Modify error message.
* gfortran.dg/structure_constructor_7.f03: Modify error message.
* gfortran.dg/structure_constructor_8.f03: Modify error message.
From-SVN: r138275
Diffstat (limited to 'gcc/fortran/module.c')
-rw-r--r-- | gcc/fortran/module.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/gcc/fortran/module.c b/gcc/fortran/module.c index a418bb9..ed575f9 100644 --- a/gcc/fortran/module.c +++ b/gcc/fortran/module.c @@ -1648,7 +1648,8 @@ typedef enum AB_ELEMENTAL, AB_PURE, AB_RECURSIVE, AB_GENERIC, AB_ALWAYS_EXPLICIT, AB_CRAY_POINTER, AB_CRAY_POINTEE, AB_THREADPRIVATE, AB_ALLOC_COMP, AB_POINTER_COMP, AB_PRIVATE_COMP, AB_VALUE, AB_VOLATILE, AB_PROTECTED, - AB_IS_BIND_C, AB_IS_C_INTEROP, AB_IS_ISO_C, AB_ABSTRACT, AB_ZERO_COMP + AB_IS_BIND_C, AB_IS_C_INTEROP, AB_IS_ISO_C, AB_ABSTRACT, AB_ZERO_COMP, + AB_EXTENSION } ab_attribute; @@ -1688,6 +1689,7 @@ static const mstring attr_bits[] = minit ("ZERO_COMP", AB_ZERO_COMP), minit ("PROTECTED", AB_PROTECTED), minit ("ABSTRACT", AB_ABSTRACT), + minit ("EXTENSION", AB_EXTENSION), minit (NULL, -1) }; @@ -1801,6 +1803,8 @@ mio_symbol_attribute (symbol_attribute *attr) MIO_NAME (ab_attribute) (AB_PRIVATE_COMP, attr_bits); if (attr->zero_comp) MIO_NAME (ab_attribute) (AB_ZERO_COMP, attr_bits); + if (attr->extension) + MIO_NAME (ab_attribute) (AB_EXTENSION, attr_bits); mio_rparen (); @@ -1919,6 +1923,9 @@ mio_symbol_attribute (symbol_attribute *attr) case AB_ZERO_COMP: attr->zero_comp = 1; break; + case AB_EXTENSION: + attr->extension = 1; + break; } } } |