This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: ../../src/bfd/elf.c:3733: warning: suggest explicit braces to avoid ambiguous `else'
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Christian Joensson <christian dot joensson at gmail dot com>
- Cc: binutils <binutils at sources dot redhat dot com>
- Date: Tue, 31 Jul 2007 13:55:12 +0200
- Subject: Re: ../../src/bfd/elf.c:3733: warning: suggest explicit braces to avoid ambiguous `else'
- References: <5460e3330707310437w7914406dk86980591057833fb@mail.gmail.com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
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