Don't emit unreachable dispatch tables

Andrew Haley aph@redhat.com
Wed Feb 15 16:18:00 GMT 2006


Compiling gcj apps with -Wall I notice a bunch of warnings like this:

p.java:1: warning: '_otable_syms_p' defined but not used
p.java:1: warning: '_itable_syms_p' defined but not used

It turns out that we're calling pushdecl on these symtabs even when
there are no references to them.

Andrew.


2006-02-15  Andrew Haley  <aph@redhat.com>

	* class.c (GEN_TABLE): Don't pushdecl *_SYMS_DECL here.
	(make_class_data): pushdecl_top_level TYPE_OTABLE_SYMS_DECL,
	TYPE_ATABLE_SYMS_DECL, TYPE_ITABLE_SYMS_DECL here.

Index: class.c
===================================================================
--- class.c	(revision 110789)
+++ class.c	(working copy)
@@ -375,7 +375,6 @@
   TREE_STATIC (TYPE_## TABLE ##_SYMS_DECL (TYPE)) = 1;			\
   TREE_CONSTANT (TYPE_## TABLE ##_SYMS_DECL (TYPE)) = 1;		\
   DECL_IGNORED_P (TYPE_## TABLE ##_SYMS_DECL (TYPE)) = 1;		\
-  pushdecl (TYPE_## TABLE ##_SYMS_DECL (TYPE));				\
 }									\
 while (0)
 
@@ -1821,6 +1820,7 @@
     }
   else
     {
+      pushdecl_top_level (TYPE_OTABLE_SYMS_DECL (type));
       PUSH_FIELD_VALUE (cons, "otable",
 			build1 (ADDR_EXPR, otable_ptr_type, TYPE_OTABLE_DECL (type)));
       PUSH_FIELD_VALUE (cons, "otable_syms",
@@ -1836,6 +1836,7 @@
     }
   else
     {
+      pushdecl_top_level (TYPE_ATABLE_SYMS_DECL (type));
       PUSH_FIELD_VALUE (cons, "atable",
 			build1 (ADDR_EXPR, atable_ptr_type, TYPE_ATABLE_DECL (type)));
       PUSH_FIELD_VALUE (cons, "atable_syms",
@@ -1851,6 +1852,7 @@
     }
   else
     {
+      pushdecl_top_level (TYPE_ITABLE_SYMS_DECL (type));
       PUSH_FIELD_VALUE (cons, "itable",
 			build1 (ADDR_EXPR, itable_ptr_type, TYPE_ITABLE_DECL (type)));
       PUSH_FIELD_VALUE (cons, "itable_syms",



More information about the Gcc-patches mailing list