aboutsummaryrefslogtreecommitdiff
path: root/gcc/java/jcf-parse.c
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2004-07-01 00:51:12 -0700
committerRichard Henderson <rth@gcc.gnu.org>2004-07-01 00:51:12 -0700
commitc9b9aa64e97f8ad913c0bfb7897ac187b082d40c (patch)
tree9e2f01325bb00a9ea11c2b59b1144a6756a6aa5f /gcc/java/jcf-parse.c
parent276b3fab875aed7ef28e942a09017f795f1bb2c6 (diff)
downloadgcc-c9b9aa64e97f8ad913c0bfb7897ac187b082d40c.zip
gcc-c9b9aa64e97f8ad913c0bfb7897ac187b082d40c.tar.gz
gcc-c9b9aa64e97f8ad913c0bfb7897ac187b082d40c.tar.bz2
cgraph.h (cgraph_build_static_cdtor): Declare.
* cgraph.h (cgraph_build_static_cdtor): Declare. * cgraphunit.c (cgraph_build_static_cdtor): New. * c-objc-common.c (build_cdtor): Use it. * coverage.c (create_coverage): Likewise. * libfuncs.h (LTI_gcov_init, gcov_init_libfunc): Remove. * optabs.c (init_optabs): Don't set gcov_init_libfunc. java/ * class.c (registerClass_libfunc): Remove. (init_class_processing): Don't set it. (emit_register_classes): Take list_p parameter. Fill it in with _Jv_RegisterClass calls. * decl.c (java_init_decl_processing): Don't call init_resource_processing. * jcf-parse.c (java_emit_static_constructor): New. (java_parse_file): Call it. * resource.c (registerResource_libfunc): Remove. (init_resource_processing): Remove. (write_resource_constructor): Take list_p parameter. Fill it in with _Jv_RegisterResource calls. * java-tree.h: Update prototypes. From-SVN: r83958
Diffstat (limited to 'gcc/java/jcf-parse.c')
-rw-r--r--gcc/java/jcf-parse.c47
1 files changed, 31 insertions, 16 deletions
diff --git a/gcc/java/jcf-parse.c b/gcc/java/jcf-parse.c
index 42c3df3..0503ef9 100644
--- a/gcc/java/jcf-parse.c
+++ b/gcc/java/jcf-parse.c
@@ -875,6 +875,21 @@ predefined_filename_p (tree node)
return 0;
}
+/* Generate a function that does all static initialization for this
+ translation unit. */
+
+static void
+java_emit_static_constructor (void)
+{
+ tree body = NULL;
+
+ emit_register_classes (&body);
+ write_resource_constructor (&body);
+
+ if (body)
+ cgraph_build_static_cdtor ('I', body);
+}
+
void
java_parse_file (int set_yydebug ATTRIBUTE_UNUSED)
{
@@ -1013,7 +1028,7 @@ java_parse_file (int set_yydebug ATTRIBUTE_UNUSED)
resource_filename = IDENTIFIER_POINTER (TREE_VALUE (current_file_list));
compile_resource_file (resource_name, resource_filename);
- return;
+ goto finish;
}
current_jcf = main_jcf;
@@ -1120,23 +1135,23 @@ java_parse_file (int set_yydebug ATTRIBUTE_UNUSED)
input_filename = main_input_filename;
java_expand_classes ();
- if (!java_report_errors () && !flag_syntax_only)
- {
- /* Expand all classes compiled from source. */
- java_finish_classes ();
-
- /* Emit the .jcf section. */
- emit_register_classes ();
-
- /* Only finalize the compilation unit after we've told cgraph which
- functions have their addresses stored. */
- cgraph_finalize_compilation_unit ();
- cgraph_optimize ();
- }
-
- write_resource_constructor ();
+ if (java_report_errors () || flag_syntax_only)
+ return;
+
+ /* Expand all classes compiled from source. */
+ java_finish_classes ();
+
+ finish:
+ /* Arrange for any necessary initialization to happen. */
+ java_emit_static_constructor ();
+
+ /* Only finalize the compilation unit after we've told cgraph which
+ functions have their addresses stored. */
+ cgraph_finalize_compilation_unit ();
+ cgraph_optimize ();
}
+
/* Return the name of the class corresponding to the name of the file
in this zip entry. The result is newly allocated using ALLOC. */
static char *