This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Patch installed to zap 'defined but not used' warnings in {cpu}.c


I drew inspiration from:

 > 2001-11-22  Nick Clifton  <nickc@cambridge.redhat.com>
 > 
 > 	* config/arm/arm.c (arm_elf_asm_named_section): Only build for elf
 > 	targets.


This patch zaps these unique warnings:

< config/h8300/h8300.c:3480: warning: `h8300_asm_named_section' defined but not used
< config/m88k/m88k.c:3300: warning: `m88k_svr3_asm_out_constructor' defined but not used
< config/m88k/m88k.c:3316: warning: `m88k_svr3_asm_out_destructor' defined but not used
< config/mcore/mcore.c:3551: warning: `mcore_asm_named_section' defined but not used
< config/sh/sh.c:5638: warning: `sh_asm_named_section' defined but not used
< config/sparc/sparc.c:8746: warning: `sparc_elf_asm_named_section' defined but not used

It also allows two previously broken targets to compile: m88k-dg-dgux
and m88k-unknown-sysv4.  They used to break like this:

 > Undefined
 > first referenced
 >  symbol                             in file
 > fini_section                        libbackend.a(m88k.o)
 > init_section                        libbackend.a(m88k.o)
 > ld: fatal: Symbol referencing errors. No output written to cc1


Tested via cross compiles from sparc-sun-solaris2.7 to:

h8300-unknown-rtems
h8300-unknown-elf
h8300-unknown-aout

m88k-dg-dgux
m88k-dolphin-sysv3
m88k-tektronix-sysv3
m88k-unknown-aout
m88k-unknown-coff
m88k-unknown-luna
m88k-unknown-openbsd
m88k-unknown-sysv3
m88k-unknown-sysv4

mcore-unknown-elf
mcore-unknown-pe

sh-unknown-elf
sh-unknown-rtemself
sh-unknown-rtems
sh-unknown-linux-gnu
sh-unknown-aout

sparc-tti-bsd
sparc64-wrs-vxworks
sparc-wrs-vxworks
sparc-unknown-aout
sparc-unknown-netbsd
sparc-unknown-openbsd
sparc-unknown-bsd
sparc-chorusos
sparc-unknown-elf
sparc-unknown-linux-gnuaout
sparc-unknown-linux-gnulibc1
sparc-unknown-linux
sparc-unknown-lynxos
sparc-unknown-rtemsaout
sparc-unknown-rtems
sparcv9-sun-solaris2.8
sparc-hal-solaris2.4
sparc-sun-solaris2.0
sparc-sun-solaris2.7
sparc-sun-sunos4.0
sparc-sun-sunos4.1
sparc-sun-sunos3
sparc-unknown-sysv4
sparc-unknown-vxsim
sparclet-unknown-aout
sparclite-unknown-coff
sparclite-unknown-aout
sparclite-unknown-elf
sparc86x-unknown-aout
sparc86x-unknown-elf
sparc64-unknown-aout
sparc64-unknown-elf
sparc64-unknown-linux-gnu

I installed it as an "obvious" change.

		--Kaveh


2001-12-01  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>

	* h8300.c (h8300_asm_named_section): Wrap with
	!OBJECT_FORMAT_ELF.
	* m88k.c (m88k_svr3_asm_out_constructor,
	m88k_svr3_asm_out_destructor): Wrap with CTOR_LIST_BEGIN &&
	!OBJECT_FORMAT_ELF.
	* mcore.c (mcore_asm_named_section): Wrap with OBJECT_FORMAT_ELF.
	* sh.c (sh_asm_named_section): Wrap with !OBJECT_FORMAT_ELF.
	* sparc.c (sparc_elf_asm_named_section): Wrap with
	OBJECT_FORMAT_ELF.

diff -rup orig/egcs-CVS20011121/gcc/config/h8300/h8300.c egcs-CVS20011121/gcc/config/h8300/h8300.c
--- orig/egcs-CVS20011121/gcc/config/h8300/h8300.c	Fri Nov 16 07:30:21 2001
+++ egcs-CVS20011121/gcc/config/h8300/h8300.c	Thu Nov 22 12:42:18 2001
@@ -59,7 +59,9 @@ static tree h8300_handle_eightbit_data_a
 static tree h8300_handle_tiny_data_attribute PARAMS ((tree *, tree, tree, int, bool *));
 static void h8300_output_function_prologue PARAMS ((FILE *, HOST_WIDE_INT));
 static void h8300_output_function_epilogue PARAMS ((FILE *, HOST_WIDE_INT));
+#ifndef OBJECT_FORMAT_ELF
 static void h8300_asm_named_section PARAMS ((const char *, unsigned int));
+#endif
 
 /* CPU_TYPE, says what cpu we're compiling for.  */
 int cpu_type;
@@ -3473,6 +3475,7 @@ h8300_adjust_insn_length (insn, length)
   return 0;
 }
 
+#ifndef OBJECT_FORMAT_ELF
 static void
 h8300_asm_named_section (name, flags)
      const char *name;
@@ -3481,3 +3484,4 @@ h8300_asm_named_section (name, flags)
   /* ??? Perhaps we should be using default_coff_asm_named_section.  */
   fprintf (asm_out_file, "\t.section %s\n", name);
 }
+#endif /* ! OBJECT_FORMAT_ELF */
diff -rup orig/egcs-CVS20011121/gcc/config/m88k/m88k.c egcs-CVS20011121/gcc/config/m88k/m88k.c
--- orig/egcs-CVS20011121/gcc/config/m88k/m88k.c	Tue Nov 20 23:54:21 2001
+++ egcs-CVS20011121/gcc/config/m88k/m88k.c	Thu Nov 22 11:01:39 2001
@@ -68,7 +68,7 @@ static void m88k_output_function_prologu
 static void m88k_output_function_epilogue PARAMS ((FILE *, HOST_WIDE_INT));
 static void m88k_output_function_end_prologue PARAMS ((FILE *));
 static void m88k_output_function_begin_epilogue PARAMS ((FILE *));
-#ifdef INIT_SECTION_ASM_OP
+#if defined (CTOR_LIST_BEGIN) && !defined (OBJECT_FORMAT_ELF)
 static void m88k_svr3_asm_out_constructor PARAMS ((rtx, int));
 static void m88k_svr3_asm_out_destructor PARAMS ((rtx, int));
 #endif
@@ -3292,7 +3292,7 @@ symbolic_operand (op, mode)
     }
 }
 
-#ifdef INIT_SECTION_ASM_OP
+#if defined (CTOR_LIST_BEGIN) && !defined (OBJECT_FORMAT_ELF)
 static void
 m88k_svr3_asm_out_constructor (symbol, priority)
      rtx symbol;
@@ -3321,7 +3321,7 @@ m88k_svr3_asm_out_destructor (symbol, pr
   for (i = 1; i < 4; i++)
     assemble_integer (constm1_rtx, UNITS_PER_WORD, BITS_PER_WORD, 1);
 }
-#endif
+#endif /* INIT_SECTION_ASM_OP && ! OBJECT_FORMAT_ELF */
 
 /* Adjust the cost of INSN based on the relationship between INSN that
    is dependent on DEP_INSN through the dependence LINK.  The default
diff -rup orig/egcs-CVS20011121/gcc/config/mcore/mcore.c egcs-CVS20011121/gcc/config/mcore/mcore.c
--- orig/egcs-CVS20011121/gcc/config/mcore/mcore.c	Thu Nov 22 09:57:45 2001
+++ egcs-CVS20011121/gcc/config/mcore/mcore.c	Thu Nov 22 10:17:31 2001
@@ -133,8 +133,10 @@ static int        mcore_dllexport_p     
 static int        mcore_dllimport_p            PARAMS ((tree));
 const struct attribute_spec mcore_attribute_table[];
 static tree       mcore_handle_naked_attribute PARAMS ((tree *, tree, tree, int, bool *));
+#ifdef OBJECT_FORMAT_ELF
 static void	  mcore_asm_named_section      PARAMS ((const char *,
 							unsigned int));
+#endif
 
 /* Initialize the GCC target structure.  */
 #ifdef TARGET_DLLIMPORT_DECL_ATTRIBUTES
@@ -3544,6 +3546,7 @@ mcore_naked_function_p ()
   return lookup_attribute ("naked", DECL_ATTRIBUTES (current_function_decl)) != NULL_TREE;
 }
 
+#ifdef OBJECT_FORMAT_ELF
 static void
 mcore_asm_named_section (name, flags)
      const char *name;
@@ -3551,3 +3554,4 @@ mcore_asm_named_section (name, flags)
 {
   fprintf (asm_out_file, "\t.section %s\n", name);
 }
+#endif /* OBJECT_FORMAT_ELF */
diff -rup orig/egcs-CVS20011121/gcc/config/sh/sh.c egcs-CVS20011121/gcc/config/sh/sh.c
--- orig/egcs-CVS20011121/gcc/config/sh/sh.c	Thu Nov 22 09:57:45 2001
+++ egcs-CVS20011121/gcc/config/sh/sh.c	Thu Nov 22 10:35:16 2001
@@ -161,7 +161,9 @@ static tree sh_handle_sp_switch_attribut
 static tree sh_handle_trap_exit_attribute PARAMS ((tree *, tree, tree, int, bool *));
 static void sh_output_function_epilogue PARAMS ((FILE *, HOST_WIDE_INT));
 static void sh_insert_attributes PARAMS ((tree, tree *));
+#ifndef OBJECT_FORMAT_ELF
 static void sh_asm_named_section PARAMS ((const char *, unsigned int));
+#endif
 static int sh_adjust_cost PARAMS ((rtx, rtx, rtx, int));
 
 /* Initialize the GCC target structure.  */
@@ -5632,6 +5634,7 @@ sh_can_redirect_branch (branch1, branch2
   return 0;
 }
 
+#ifndef OBJECT_FORMAT_ELF
 static void
 sh_asm_named_section (name, flags)
      const char *name;
@@ -5640,6 +5643,7 @@ sh_asm_named_section (name, flags)
   /* ??? Perhaps we should be using default_coff_asm_named_section.  */
   fprintf (asm_out_file, "\t.section %s\n", name);
 }
+#endif /* ! OBJECT_FORMAT_ELF */
 
 /* A C statement (sans semicolon) to update the integer variable COST
    based on the relationship between INSN that is dependent on
diff -rup orig/egcs-CVS20011121/gcc/config/sparc/sparc.c egcs-CVS20011121/gcc/config/sparc/sparc.c
--- orig/egcs-CVS20011121/gcc/config/sparc/sparc.c	Fri Nov 16 07:30:22 2001
+++ egcs-CVS20011121/gcc/config/sparc/sparc.c	Thu Nov 22 10:07:07 2001
@@ -167,8 +167,9 @@ static void sparc_nonflat_function_epilo
 						     int));
 static void sparc_nonflat_function_prologue PARAMS ((FILE *, HOST_WIDE_INT,
 						     int));
+#ifdef OBJECT_FORMAT_ELF
 static void sparc_elf_asm_named_section PARAMS ((const char *, unsigned int));
-
+#endif
 static void ultrasparc_sched_reorder PARAMS ((FILE *, int, rtx *, int));
 static int ultrasparc_variable_issue PARAMS ((rtx));
 static void ultrasparc_sched_init PARAMS ((void));
@@ -8743,6 +8744,7 @@ sparc_add_gc_roots ()
 		sizeof (ultra_pipe_hist[0]), &mark_ultrasparc_pipeline_state);
 }
 
+#ifdef OBJECT_FORMAT_ELF
 static void
 sparc_elf_asm_named_section (name, flags)
      const char *name;
@@ -8769,3 +8771,4 @@ sparc_elf_asm_named_section (name, flags
 
   fputc ('\n', asm_out_file);
 }
+#endif /* OBJECT_FORMAT_ELF */


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]