summaryrefslogtreecommitdiff
path: root/gcc/fortran/f95-lang.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/fortran/f95-lang.c')
-rw-r--r--gcc/fortran/f95-lang.c41
1 files changed, 12 insertions, 29 deletions
diff --git a/gcc/fortran/f95-lang.c b/gcc/fortran/f95-lang.c
index fbfc72d2417..f439427aca3 100644
--- a/gcc/fortran/f95-lang.c
+++ b/gcc/fortran/f95-lang.c
@@ -94,7 +94,6 @@ static bool global_bindings_p (void);
/* Each front end provides its own. */
static bool gfc_init (void);
static void gfc_finish (void);
-static void gfc_write_global_declarations (void);
static void gfc_be_parse_file (void);
static alias_set_type gfc_get_alias_set (tree);
static void gfc_init_ts (void);
@@ -121,7 +120,6 @@ static const struct attribute_spec gfc_attribute_table[] =
#undef LANG_HOOKS_NAME
#undef LANG_HOOKS_INIT
#undef LANG_HOOKS_FINISH
-#undef LANG_HOOKS_WRITE_GLOBALS
#undef LANG_HOOKS_OPTION_LANG_MASK
#undef LANG_HOOKS_INIT_OPTIONS_STRUCT
#undef LANG_HOOKS_INIT_OPTIONS
@@ -155,7 +153,6 @@ static const struct attribute_spec gfc_attribute_table[] =
#define LANG_HOOKS_NAME "GNU Fortran"
#define LANG_HOOKS_INIT gfc_init
#define LANG_HOOKS_FINISH gfc_finish
-#define LANG_HOOKS_WRITE_GLOBALS gfc_write_global_declarations
#define LANG_HOOKS_OPTION_LANG_MASK gfc_option_lang_mask
#define LANG_HOOKS_INIT_OPTIONS_STRUCT gfc_init_options_struct
#define LANG_HOOKS_INIT_OPTIONS gfc_init_options
@@ -226,9 +223,21 @@ gfc_be_parse_file (void)
while (!global_bindings_p ())
poplevel (0, 0);
+ /* Finalize all of the globals.
+
+ Emulated tls lowering needs to see all TLS variables before we
+ call finalize_compilation_unit. The C/C++ front ends manage this
+ by calling decl_rest_of_compilation on each global and static
+ variable as they are seen. The Fortran front end waits until
+ here. */
+ for (tree decl = getdecls (); decl ; decl = DECL_CHAIN (decl))
+ rest_of_decl_compilation (decl, true, true);
+
/* Switch to the default tree diagnostics here, because there may be
diagnostics before gfc_finish(). */
gfc_diagnostics_finish ();
+
+ global_decl_processing ();
}
@@ -272,32 +281,6 @@ gfc_finish (void)
return;
}
-/* ??? This is something of a hack.
-
- Emulated tls lowering needs to see all TLS variables before we call
- finalize_compilation_unit. The C/C++ front ends manage this
- by calling decl_rest_of_compilation on each global and static variable
- as they are seen. The Fortran front end waits until this hook.
-
- A Correct solution is for finalize_compilation_unit not to be
- called during the WRITE_GLOBALS langhook, and have that hook only do what
- its name suggests and write out globals. But the C++ and Java front ends
- have (unspecified) problems with aliases that gets in the way. It has
- been suggested that these problems would be solved by completing the
- conversion to cgraph-based aliases. */
-
-static void
-gfc_write_global_declarations (void)
-{
- tree decl;
-
- /* Finalize all of the globals. */
- for (decl = getdecls(); decl ; decl = DECL_CHAIN (decl))
- rest_of_decl_compilation (decl, true, true);
-
- write_global_declarations ();
-}
-
/* These functions and variables deal with binding contours. We only
need these functions for the list of PARM_DECLs, but we leave the
functions more general; these are a simplified version of the