On 06/20/17 14:00, Leif Lindholm wrote: > On Tue, Jun 20, 2017 at 01:28:38PM +0200, Ard Biesheuvel wrote: >> (+ Laszlo) >> >> On 20 June 2017 at 13:00, Leif Lindholm <[email protected]> wrote: >>> When building without LTO, gcc incorrectly resolves the hazards for >>> 'PciRegBase’ when inlining, leading to "may be used uninitialized" >>> warnings (and hence build failure with -Werror). >>> Eliminate this warning by explicitly initializing the variable to 0. >>> >>> Contributed-under: TianoCore Contribution Agreement 1.0 >>> Signed-off-by: Leif Lindholm <[email protected]> >> >> Reviewed-by: Ard Biesheuvel <[email protected]> > > Thanks! > >>> --- >>> >>> For those who have heard me mentioning this before but arguing against >>> upstreaming this patch: I only just tweaked that this warning doesn't >>> go away with more recent toolchains, but simply when switching to GCC5 >>> build profile, and hence LTO. Build failure still reproducible with >>> gcc 6.3.1 and GCC49. >> >> /me annoyed > > +1 > >> We keep hitting this with GCC, and I profoundly dislike having to add >> redundant initialization sequences. Is there any other solution >> possible, e.g., disable this warning for certain builds? > > I would really like to not disable it. > When it gets it right, that's usually a pretty horrific bug caught. > And if we switch to LTO as the norm, I guess these will become less > noticeable over time. > But it does bug me too.
Perhaps we should introduce two macros to "MdePkg/Include/Base.h", #define UNUSED_POINTER NULL #define UNUSED_INTEGER 0 These could be used to suppress such warnings, without the risk of misleading programmers (as to the real necessity of the variable assignment at hand). Thanks Laszlo _______________________________________________ edk2-devel mailing list [email protected] https://lists.01.org/mailman/listinfo/edk2-devel

