summaryrefslogtreecommitdiffstats
path: root/gcc/fortran/gfortran.h
diff options
context:
space:
mode:
authortobi <tobi@138bc75d-0d04-0410-961f-82ee72b054a4>2004-06-29 18:57:25 +0000
committertobi <tobi@138bc75d-0d04-0410-961f-82ee72b054a4>2004-06-29 18:57:25 +0000
commit82f5ee132c82157465f042ee2ed5fea3642e2224 (patch)
tree1b6d752026c3acc16fa03a6a9d17146fbf0fd272 /gcc/fortran/gfortran.h
parent8b780f471876d7e363f595e2f154e2af3d427f2d (diff)
downloadppe42-gcc-82f5ee132c82157465f042ee2ed5fea3642e2224.tar.gz
ppe42-gcc-82f5ee132c82157465f042ee2ed5fea3642e2224.zip
2004-06-29 Tobias Schlueter <tobias.schlueter@physik.uni-muenchen.de>
Andrew Vaught <andyv@firstinter.net> PR fortran/13249 PR fortran/15481 * declc (gfc_match_save): Adapt to new common structures, don't allow saving USE-associated common. * dump-parse-tree (gfc_show_attr): (saved_)common are not symbol attributes any longer. (gfc_show_symbol): Don't show old-style commons any longer. (gfc_show_namespace): Adapt call to gfc_traverse_symtree to new interface. * gfortran.h (symbol_attribute): Remove common and saved_common attributes. (gfc_symbol): Remove common_head element. (gfc_common_head): New struct. (gfc_get_common_head): New macro. (gfc_symtree): Add field 'common' to union. (gfc_namespace): Add field 'common_root'; change type of field 'blank_common' to blank_common. (gfc_add_data): New prototype. (gfc_traverse_symtree): Expect a symtree as first argument instead of namespace. * match.c (gfc_get_common): New function. (match_common_name): Change to take char * as argument, adapt, fix bug with empty name. (gfc_match_common): Adapt to new data structures. Disallow redeclaration of USE-associated COMMON-block. Fix bug with empty common. (var_element): Adapt to new common structures. * match.h (gfc_get_common): Declare. * module.c: Add 2004 to copyright years, add commons to module file layout description. (ab_attribute, attr_bits, mio_symbol_attributes): Remove code for removed attributes. (mio_symbol): Adapt to new way of storing common relations. (load_commons): New function. (read_module): Skip common list on first pass, load_commons at second. (write_commons): New function. (write_module): Call write_commons(). * symbol.c (gfc_add_saved_comon, gfc_add_common): Remove functions related to removed attributes. (gfc_add_data): New function. (gfc_clear_attr): Don't set removed attributes. (gfc_copy_attr): Don't copy removed attributes. (traverse_symtree): Remove. (gfc_traverse_symtree): Don't traverse symbol tree of the passed namespace, but require a symtree to be passed instead. Unify with traverse_symtree. (gfc_traverse_ns): Call gfc_traverse_symtree according to new interface. (save_symbol): Remove setting of removed attribute. * trans-common.c (gfc_sym_mangled_common_id): Change to take 'char *' argument instead of 'gfc_symbol'. (build_common_decl, new_segment, translate_common): Adapt to new data structures, add new argument name. (create_common): Adapt to new data structures, add new argument name. Fix typo in intialization of derived types. (finish_equivalences): Add second argument in call to create_common. (named_common): take 'gfc_symtree' instead of 'gfc_symbol'. (gfc_trans_common): Adapt to new data structures. * trans-decl.c (gfc_create_module_variables): Also output symbols from commons. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@83871 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran/gfortran.h')
-rw-r--r--gcc/fortran/gfortran.h30
1 files changed, 23 insertions, 7 deletions
diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h
index bfd52e4b656..d35506ae6e6 100644
--- a/gcc/fortran/gfortran.h
+++ b/gcc/fortran/gfortran.h
@@ -385,12 +385,12 @@ typedef struct
/* Variable attributes. */
unsigned allocatable:1, dimension:1, external:1, intrinsic:1,
optional:1, pointer:1, save:1, target:1,
- dummy:1, common:1, result:1, entry:1, assign:1;
+ dummy:1, result:1, entry:1, assign:1;
unsigned data:1, /* Symbol is named in a DATA statement. */
use_assoc:1; /* Symbol has been use-associated. */
- unsigned in_namelist:1, in_common:1, saved_common:1;
+ unsigned in_namelist:1, in_common:1;
unsigned function:1, subroutine:1, generic:1;
unsigned implicit_type:1; /* Type defined via implicit rules */
@@ -642,8 +642,7 @@ typedef struct gfc_symbol
struct gfc_symbol *result; /* function result symbol */
gfc_component *components; /* Derived type components */
- /* TODO: These three fields are mutually exclusive. */
- struct gfc_symbol *common_head, *common_next; /* Links for COMMON syms */
+ struct gfc_symbol *common_next; /* Links for COMMON syms */
/* Make sure setup code for dummy arguments is generated in the correct
order. */
int dummy_order;
@@ -671,6 +670,20 @@ typedef struct gfc_symbol
gfc_symbol;
+/* This structure is used to keep track of symbols in common blocks. */
+
+typedef struct
+{
+ locus where;
+ int use_assoc, saved;
+ gfc_symbol *head;
+}
+gfc_common_head;
+
+#define gfc_get_common_head() gfc_getmem(sizeof(gfc_common_head))
+
+
+
/* Within a namespace, symbols are pointed to by symtree nodes that
are linked together in a balanced binary tree. There can be
several symtrees pointing to the same symbol node via USE
@@ -687,6 +700,7 @@ typedef struct gfc_symtree
{
gfc_symbol *sym; /* Symbol associated with this node */
gfc_user_op *uop;
+ gfc_common_head *common;
}
n;
@@ -696,7 +710,8 @@ gfc_symtree;
typedef struct gfc_namespace
{
- gfc_symtree *sym_root, *uop_root; /* Roots of the red/black symbol trees */
+ /* Roots of the red/black symbol trees */
+ gfc_symtree *sym_root, *uop_root, *common_root;
int set_flag[GFC_LETTERS];
gfc_typespec default_type[GFC_LETTERS]; /* IMPLICIT typespecs */
@@ -705,7 +720,7 @@ typedef struct gfc_namespace
gfc_interface *operator[GFC_INTRINSIC_OPS];
struct gfc_namespace *parent, *contained, *sibling;
struct gfc_code *code;
- gfc_symbol *blank_common;
+ gfc_common_head blank_common;
struct gfc_equiv *equiv;
gfc_access default_access, operator_access[GFC_INTRINSIC_OPS];
@@ -1447,6 +1462,7 @@ try gfc_add_dummy (symbol_attribute *, locus *);
try gfc_add_generic (symbol_attribute *, locus *);
try gfc_add_common (symbol_attribute *, locus *);
try gfc_add_in_common (symbol_attribute *, locus *);
+try gfc_add_data (symbol_attribute *, locus *);
try gfc_add_in_namelist (symbol_attribute *, locus *);
try gfc_add_sequence (symbol_attribute *, locus *);
try gfc_add_elemental (symbol_attribute *, locus *);
@@ -1501,7 +1517,7 @@ void gfc_free_namespace (gfc_namespace *);
void gfc_symbol_init_2 (void);
void gfc_symbol_done_2 (void);
-void gfc_traverse_symtree (gfc_namespace *, void (*)(gfc_symtree *));
+void gfc_traverse_symtree (gfc_symtree *, void (*)(gfc_symtree *));
void gfc_traverse_ns (gfc_namespace *, void (*)(gfc_symbol *));
void gfc_traverse_user_op (gfc_namespace *, void (*)(gfc_user_op *));
void gfc_save_all (gfc_namespace *);
OpenPOWER on IntegriCloud