This is the mail archive of the 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: [PATCH] Fixes for a small number of compiler warnings

Hi H.J.,

2015-03-27 14:05 GMT+01:00 H.J. Lu <>:
> I think we should add a micro
> and do
> struct bfd_link_hash_entry ehdr_start_save =

I'm not entirely sure that's easy to accomplish. As a sidenote, GCC
also has the -Winit-self compiler warning that triggers for exactly
these cases:

The only sane thing to do would be to zero-initialize the variable.
This is typically not a problem, as a decent optimizer will optimize
this away if it discovers that the initialization has no effect.

The problem with coming up with a uniform macro for this, as you
proposed, is that the syntax needed to zero-initialize depends on the
type. In some cases it needs to be 0 and in others it needs to be {}.
This is a case where the C++11 uniform initialization syntax would
have helped.

I'd suggest that we'd keep it simple for now and use just use {} here. Thoughts?

Ed Schouten <>

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