patch for libjava build failure

Per Bothner per@bothner.com
Thu Mar 1 23:21:00 GMT 2001


This patch fixes the failure I reported on Tuesday February 27
(with Subject: cannot build libjava).
While this fixes the problem, I have no idea what caused it to appear.
I.e. I don't understand what change caused it to manifest itself for me.
The error message I reported on Tuesday was because we called
rest_of_decl_compilation even when -fsyntax-only was set; we don't
want to do that. But adding a test for flag_syntax_only runs into
another problem: rest_of_decl_compilation would be called before the
assembler output file is opened, which doesn't work. This patch
avoids both problems, and has the side benefit of changing
class_dtable_decl from a global to a local.
Does this seem like a reasonable patch? (I would be happier if I
understood why there wasn't a problem before!)
2001年03月01日 Per Bothner <per@bothner.com>
	Fix a problem where rest_of_decl_compilation applied to
	class_dtable_decl casues problems because it was done too early,
	before output file was opened.
	* decl.c (init_decl_processing): Remove init of class_dtable_decl.
	* class.c (class_dtable_decl): Add macro - element of class_roots.
	* java-tree.h (JTI_CLASS_DTABLE_DECL, class_dtable_decl): Removed.
	(make_class_data): Define class_dtable_decl.
Index: decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/decl.c,v
retrieving revision 1.89
diff -u -p -r1.89 decl.c
--- decl.c	2001年02月23日 20:38:56	1.89
+++ decl.c	2001年03月02日 07:02:50
@@ -636,12 +636,6 @@ init_decl_processing ()
 FIELD_PRIVATE (t) = 1;
 FINISH_RECORD (object_type_node);
 
- class_dtable_decl = build_dtable_decl (class_type_node);
- TREE_STATIC (class_dtable_decl) = 1;
- DECL_ARTIFICIAL (class_dtable_decl) = 1;
- DECL_IGNORED_P (class_dtable_decl) = 1;
- rest_of_decl_compilation (class_dtable_decl, (char*) 0, 1, 0);
-
 field_type_node = make_node (RECORD_TYPE);
 field_ptr_type_node = build_pointer_type (field_type_node);
 method_type_node = make_node (RECORD_TYPE);
Index: class.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/class.c,v
retrieving revision 1.88
diff -u -p -r1.88 class.c
--- class.c	2001年02月04日 22:44:02	1.88
+++ class.c	2001年03月02日 07:02:51
@@ -84,12 +84,14 @@ static assume_compiled_node *find_assume
 
 static assume_compiled_node *assume_compiled_tree;
 
-static tree class_roots[4] = { NULL_TREE, NULL_TREE, NULL_TREE, NULL_TREE };
+static tree class_roots[5]
+= { NULL_TREE, NULL_TREE, NULL_TREE, NULL_TREE, NULL_TREE };
 #define registered_class class_roots[0]
 #define fields_ident class_roots[1] /* get_identifier ("fields") */
 #define info_ident class_roots[2] /* get_identifier ("info") */
 #define class_list class_roots[3]
+#define class_dtable_decl class_roots[4]
 
 /* Return the node that most closely represents the class whose name
 is IDENT. Start the search from NODE. Return NULL if an
 appropriate node does not exist. */
@@ -1347,6 +1350,17 @@ make_class_data (type)
 DECL_IGNORED_P (dtable_decl) = 1;
 TREE_PUBLIC (dtable_decl) = 1;
 rest_of_decl_compilation (dtable_decl, (char*) 0, 1, 0);
+ if (type == class_type_node)
+	class_dtable_decl = dtable_decl;
+ }
+
+ if (class_dtable_decl == NULL_TREE)
+ {
+ class_dtable_decl = build_dtable_decl (class_type_node);
+ TREE_STATIC (class_dtable_decl) = 1;
+ DECL_ARTIFICIAL (class_dtable_decl) = 1;
+ DECL_IGNORED_P (class_dtable_decl) = 1;
+ rest_of_decl_compilation (class_dtable_decl, (char*) 0, 1, 0);
 }
 
 super = CLASSTYPE_SUPER (type);
Index: java-tree.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/java-tree.h,v
retrieving revision 1.99
diff -u -p -r1.99 java-tree.h
--- java-tree.h	2001年02月24日 03:28:39	1.99
+++ java-tree.h	2001年03月02日 07:02:52
@@ -335,8 +335,6 @@ enum java_tree_index
 
 JTI_ACCESS_FLAGS_TYPE_NODE,
 
- JTI_CLASS_DTABLE_DECL,
-
 JTI_NATIVECODE_PTR_ARRAY_TYPE_NODE,
 
 JTI_WFL_OPERATOR,
@@ -583,9 +581,6 @@ extern tree throw_node[];
 
 #define access_flags_type_node \
 java_global_trees[JTI_ACCESS_FLAGS_TYPE_NODE]
-
-#define class_dtable_decl \
- java_global_trees[JTI_CLASS_DTABLE_DECL]
 
 #define nativecode_ptr_array_type_node \
 java_global_trees[JTI_NATIVECODE_PTR_ARRAY_TYPE_NODE]
-- 
	--Per Bothner
per@bothner.com http://www.bothner.com/~per/


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /