resource.c (write_resource_constructor): Guard call to possibly NULL targetm.asm_out...
authorRoger Sayle <roger@eyesopen.com>
Thu, 22 Apr 2004 15:46:09 +0000 (15:46 +0000)
committerRoger Sayle <sayle@gcc.gnu.org>
Thu, 22 Apr 2004 15:46:09 +0000 (15:46 +0000)
* resource.c (write_resource_constructor): Guard call to possibly
NULL targetm.asm_out.constructor with targetm.have_ctors_dtors.

From-SVN: r81012

gcc/java/ChangeLog
gcc/java/resource.c

index e2933a8dcb438d733370426f3b9fd2226ec9994e..17e6794d31c02d8974a6de1f919cca1ce823882b 100644 (file)
@@ -1,3 +1,8 @@
+2004-04-22  Roger Sayle  <roger@eyesopen.com>
+
+       * resource.c (write_resource_constructor): Guard call to possibly
+       NULL targetm.asm_out.constructor with targetm.have_ctors_dtors.
+
 2004-04-19  Bryce McKinlay  <mckinlay@redhat.com>
 
        * class.c (make_class_data): Add new field aux_info.
index 5d4b72a13ae06b860aba45bc04309fa7ff25e375..bc2860dfd1f6561e3dfc8370655f59cd975cf8ac 100644 (file)
@@ -129,6 +129,9 @@ write_resource_constructor (void)
      to scan the object file to find its ctor/dtor routine.  */
   TREE_PUBLIC (init_decl) = ! targetm.have_ctors_dtors;
 
+  /* Suppress spurious warnings.  */
+  TREE_USED (init_decl) = 1;
+
   pushlevel (0);
   make_decl_rtl (init_decl, NULL);
   init_function_start (init_decl);
@@ -156,8 +159,9 @@ write_resource_constructor (void)
     flag_inline_functions = saved_flag;
   }
   current_function_decl = NULL_TREE;
-  (* targetm.asm_out.constructor) (XEXP (DECL_RTL (init_decl), 0),
-                                  DEFAULT_INIT_PRIORITY);
+  if (targetm.have_ctors_dtors)
+    targetm.asm_out.constructor (XEXP (DECL_RTL (init_decl), 0),
+                                DEFAULT_INIT_PRIORITY);
   input_location = saved_loc;
 }