This is the mail archive of the binutils@sourceware.org mailing list for the binutils 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]

Re: ../../src/bfd/elf.c:3733: warning: suggest explicit braces to avoid ambiguous `else'


On Tue, Jul 31, 2007 at 01:37:20PM +0200, Christian Joensson wrote:
> With the recent change to elf.c, I get the following warning trying to
> compile using gcc 3.4.4...

Your gcc is too old and too buggy, there is nothing ambiguous on that else,
the inner if is nested in a for construct.

That said, guess we can work around it, ok?

2007-07-31  Jakub Jelinek  <jakub@redhat.com>

	* elf.c (_bfd_elf_map_sections_to_segments): Work around buggy
	GCC 3.4.x warning.

--- bfd/elf.c	31 Jul 2007 08:15:44 -0000	1.402
+++ bfd/elf.c	31 Jul 2007 11:42:50 -0000
@@ -3732,13 +3732,16 @@ _bfd_elf_map_sections_to_segments (bfd *
 	      amt = sizeof (struct elf_segment_map);
 	      if (s->alignment_power == 2)
 		for (s2 = s; s2->next != NULL; s2 = s2->next)
-		  if (s2->next->alignment_power == 2
-		      && (s2->next->flags & SEC_LOAD) != 0
-		      && CONST_STRNEQ (s2->next->name, ".note")
-		      && align_power (s2->vma + s2->size, 2) == s2->next->vma)
-		    count++;
-		  else
-		    break;
+		  {
+		    if (s2->next->alignment_power == 2
+			&& (s2->next->flags & SEC_LOAD) != 0
+			&& CONST_STRNEQ (s2->next->name, ".note")
+			&& align_power (s2->vma + s2->size, 2)
+			   == s2->next->vma)
+		      count++;
+		    else
+		      break;
+		  }
 	      amt += (count - 1) * sizeof (asection *);
 	      m = bfd_zalloc (abfd, amt);
 	      if (m == NULL)

	Jakub


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