This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] Fixes for a small number of compiler warnings
- From: Alan Modra <amodra at gmail dot com>
- To: Hans-Peter Nilsson <hp at bitrange dot com>
- Cc: Ed Schouten <ed at nuxi dot nl>, "H.J. Lu" <hjl dot tools at gmail dot com>, Binutils <binutils at sourceware dot org>
- Date: Wed, 1 Apr 2015 13:17:07 +1030
- Subject: Re: [PATCH] Fixes for a small number of compiler warnings
- Authentication-results: sourceware.org; auth=none
- References: <CABh_MK=meHjQHZH9Cssu3xSgsrehcar0-COMZSJf0cHZTKxH4A at mail dot gmail dot com> <20150327000715 dot GY26234 at bubble dot grove dot modra dot org> <CABh_MKmxfVGU9b=vD9yHdUWXtkN7==Ptmu4h3izQPGCzsa=b=g at mail dot gmail dot com> <CAMe9rOrys_QG+0opphc9AXn5=Z-Df4Nk0WUFTJEy-dy_ux8Y=g at mail dot gmail dot com> <CABh_MKmKPHAfVo5Q2BkBnQuGFk-x+5a3j46KtXgF9_af2UHrCg at mail dot gmail dot com> <CABh_MKnE8EBOCuTCofXi2CsWsOVq5xtC+cPqZB-NgotzKFFGLg at mail dot gmail dot com> <20150401003744 dot GN26234 at bubble dot grove dot modra dot org> <alpine dot BSF dot 2 dot 02 dot 1503312120010 dot 87955 at arjuna dot pair dot com>
On Tue, Mar 31, 2015 at 09:25:41PM -0400, Hans-Peter Nilsson wrote:
> On Wed, 1 Apr 2015, Alan Modra wrote:
> > On Tue, Mar 31, 2015 at 04:47:10PM +0200, Ed Schouten wrote:
> > > --- a/ld/emultempl/elf32.em
> > > +++ b/ld/emultempl/elf32.em
> > > @@ -1412,7 +1412,7 @@ gld${EMULATION_NAME}_before_allocation (void)
> > > asection *sinterp;
> > > bfd *abfd;
> > > struct elf_link_hash_entry *ehdr_start = NULL;
> > > - struct bfd_link_hash_entry ehdr_start_save = ehdr_start_save;
> > > + struct bfd_link_hash_entry ehdr_start_save = {};
> > >
> > > if (is_elf_hash_table (link_info.hash))
> > > {
> >
> > Committed.
>
> earmelf.c: In function 'gldarmelf_before_allocation':
> earmelf.c:1448:10: error: missing initializer
> [-Werror=missing-field-initializers]earmelf.c:1448:10: error: (near initialization for 'ehdr_start_save.root') [-Werror=missing-field-initializers]
> cc1: all warnings being treated as errors
Let's just remove the init then.
Older compilers that warn wrongly will just need -Wno-error. No way
am I going to init every single field, then have to edit this code
whenever bfd_link_hash_entry changes. Another option, making the
struct static, isn't very nice since it means larger binaries and
worse code.
* emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Don't
init ehdr_start_save.
diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em
index 2caddbe..ece2fb0 100644
--- a/ld/emultempl/elf32.em
+++ b/ld/emultempl/elf32.em
@@ -1412,7 +1412,7 @@ gld${EMULATION_NAME}_before_allocation (void)
asection *sinterp;
bfd *abfd;
struct elf_link_hash_entry *ehdr_start = NULL;
- struct bfd_link_hash_entry ehdr_start_save = {};
+ struct bfd_link_hash_entry ehdr_start_save;
if (is_elf_hash_table (link_info.hash))
{