gfortran.h (gfc_get_namespace): Add second argument to prototype.

fortran/
* gfortran.h (gfc_get_namespace): Add second argument to prototype.
* intrinsic.c (gfc_intrinsic_init_1): Pass second argument to
gfc_get_namespace.
* module.c (mio_namespace_ref, load_needed): Likewise.
* parse.c (parse_interface, parse_contained): Likewise.  Here the
correct second argument matters.
* symbol.c (gfc_get_namespace): Add parent_types argument, only copy
parent's implicit types if this is set.
(gfc_symbol_init_2): Pass second argument to gfc_get_namespace.
* trans-common.c (build_common_decl): Likewise.

testsuite/
* gfortran.dg/implicit_3.f90: New test.

From-SVN: r95463
This commit is contained in:
Tobias Schlüter 2005-02-23 20:02:29 +01:00 committed by Tobias Schlüter
parent 6b21174689
commit 0366dfe993
9 changed files with 41 additions and 11 deletions

View File

@ -1,3 +1,16 @@
2005-02-23 Tobias Schl"uter <tobias.schlueter@physik.uni-muenchen.de>
* gfortran.h (gfc_get_namespace): Add second argument to prototype.
* intrinsic.c (gfc_intrinsic_init_1): Pass second argument to
gfc_get_namespace.
* module.c (mio_namespace_ref, load_needed): Likewise.
* parse.c (parse_interface, parse_contained): Likewise. Here the
correct second argument matters.
* symbol.c (gfc_get_namespace): Add parent_types argument, only copy
parent's implicit types if this is set.
(gfc_symbol_init_2): Pass second argument to gfc_get_namespace.
* trans-common.c (build_common_decl): Likewise.
2005-02-23 Kazu Hirata <kazu@cs.umass.edu>
* intrinsic.h, st.c: Update copyright.

View File

@ -1619,7 +1619,7 @@ void gfc_free_st_label (gfc_st_label *);
void gfc_define_st_label (gfc_st_label *, gfc_sl_type, locus *);
try gfc_reference_st_label (gfc_st_label *, gfc_sl_type);
gfc_namespace *gfc_get_namespace (gfc_namespace *);
gfc_namespace *gfc_get_namespace (gfc_namespace *, int);
gfc_symtree *gfc_new_symtree (gfc_symtree **, const char *);
gfc_symtree *gfc_find_symtree (gfc_symtree *, const char *);
gfc_user_op *gfc_get_uop (const char *);

View File

@ -2241,7 +2241,7 @@ gfc_intrinsic_init_1 (void)
nargs = nfunc = nsub = nconv = 0;
/* Create a namespace to hold the resolved intrinsic symbols. */
gfc_intrinsic_namespace = gfc_get_namespace (NULL);
gfc_intrinsic_namespace = gfc_get_namespace (NULL, 0);
sizing = SZ_FUNCS;
add_functions ();

View File

@ -2627,7 +2627,7 @@ mio_namespace_ref (gfc_namespace ** nsp)
ns = (gfc_namespace *)p->u.pointer;
if (ns == NULL)
{
ns = gfc_get_namespace (NULL);
ns = gfc_get_namespace (NULL, 0);
associate_integer_pointer (p, ns);
}
else
@ -2878,7 +2878,7 @@ load_needed (pointer_info * p)
the namespaces that hold the formal parameters of module
procedures. */
ns = gfc_get_namespace (NULL);
ns = gfc_get_namespace (NULL, 0);
associate_integer_pointer (q, ns);
}

View File

@ -1405,7 +1405,7 @@ parse_interface (void)
current_state = COMP_NONE;
loop:
gfc_current_ns = gfc_get_namespace (current_interface.ns);
gfc_current_ns = gfc_get_namespace (current_interface.ns, 0);
st = next_statement ();
switch (st)
@ -2170,7 +2170,7 @@ parse_contained (int module)
do
{
gfc_current_ns = gfc_get_namespace (parent_ns);
gfc_current_ns = gfc_get_namespace (parent_ns, 1);
gfc_current_ns->sibling = parent_ns->contained;
parent_ns->contained = gfc_current_ns;

View File

@ -1531,10 +1531,11 @@ done:
this case, that symbol has been used as a host associated variable
at some previous time. */
/* Allocate a new namespace structure. */
/* Allocate a new namespace structure. Copies the implicit types from
PARENT if PARENT_TYPES is set. */
gfc_namespace *
gfc_get_namespace (gfc_namespace * parent)
gfc_get_namespace (gfc_namespace * parent, int parent_types)
{
gfc_namespace *ns;
gfc_typespec *ts;
@ -1556,7 +1557,7 @@ gfc_get_namespace (gfc_namespace * parent)
ns->set_flag[i - 'a'] = 0;
ts = &ns->default_type[i - 'a'];
if (ns->parent != NULL)
if (parent_types && ns->parent != NULL)
{
/* Copy parent settings */
*ts = ns->parent->default_type[i - 'a'];
@ -2243,7 +2244,7 @@ void
gfc_symbol_init_2 (void)
{
gfc_current_ns = gfc_get_namespace (NULL);
gfc_current_ns = gfc_get_namespace (NULL, 0);
}

View File

@ -288,7 +288,7 @@ build_common_decl (gfc_common_head *com, tree union_type, bool is_init)
/* Create a namespace to store symbols for common blocks. */
if (gfc_common_ns == NULL)
gfc_common_ns = gfc_get_namespace (NULL);
gfc_common_ns = gfc_get_namespace (NULL, 0);
gfc_get_symbol (com->name, gfc_common_ns, &common_sym);
decl = common_sym->backend_decl;

View File

@ -1,3 +1,7 @@
2005-02-23 Tobias Schl"uter <tobias.schlueter@physik.uni-muenchen.de>
* gfortran.dg/implicit_3.f90: New test.
2005-02-23 Alexandre Oliva <aoliva@redhat.com>
* g++.dg/lookup/anon2.C: Don't let access checks make it look like

View File

@ -0,0 +1,12 @@
! { dg-do compile }
! Verify that INTERFACEs don't inherit the implicit types of the
! surrounding namespace.
implicit complex (i-k)
interface
function f(k,l)
! k should be default INTEGER
dimension l(k)
end function f
end interface
end