Warning build bfd library with gcc 4.6.0+fix

Alan Modra amodra@gmail.com
Tue May 11 04:44:00 GMT 2010


On Mon, May 10, 2010 at 10:01:21AM +0100, Duncan Simpson wrote:
> At least with my configuration gcc 4.6.0 complains about the initialisation
> but non-use of hasdebug in coff_write_object_contents (defined in
> bfd/coffcode.h). Since -Werror is in effect this stops the build.

Applied.

	* coffcode.h (coff_write_object_contents): Enclose all occurrences
	of hasdebug and is_reloc_section in #ifdef COFF_IMAGE_WITH_PE.

Index: bfd/coffcode.h
===================================================================
RCS file: /cvs/src/src/bfd/coffcode.h,v
retrieving revision 1.164
diff -u -p -r1.164 coffcode.h
--- bfd/coffcode.h	27 Apr 2010 17:26:03 -0000	1.164
+++ bfd/coffcode.h	11 May 2010 04:33:05 -0000
@@ -3533,7 +3533,9 @@ coff_write_object_contents (bfd * abfd)
   asection *current;
   bfd_boolean hasrelocs = FALSE;
   bfd_boolean haslinno = FALSE;
+#ifdef COFF_IMAGE_WITH_PE
   bfd_boolean hasdebug = FALSE;
+#endif
   file_ptr scn_base;
   file_ptr reloc_base;
   file_ptr lineno_base;
@@ -3636,9 +3638,9 @@ coff_write_object_contents (bfd * abfd)
        current = current->next)
     {
       struct internal_scnhdr section;
+#ifdef COFF_IMAGE_WITH_PE
       bfd_boolean is_reloc_section = FALSE;
 
-#ifdef COFF_IMAGE_WITH_PE
       if (strcmp (current->name, DOT_RELOC) == 0)
 	{
 	  is_reloc_section = TRUE;
@@ -3737,9 +3739,11 @@ coff_write_object_contents (bfd * abfd)
 #endif
       if (current->lineno_count != 0)
 	haslinno = TRUE;
+#ifdef COFF_IMAGE_WITH_PE
       if ((current->flags & SEC_DEBUGGING) != 0
 	  && ! is_reloc_section)
 	hasdebug = TRUE;
+#endif
 
 #ifdef RS6000COFF_C
 #ifndef XCOFF64

-- 
Alan Modra
Australia Development Lab, IBM



More information about the Binutils mailing list