On 02/06/14 23:04, Scott Duplichan wrote:
> Laszlo Ersek [mailto:ler...@redhat.com] wrote:
> 
> 
> ]On 02/05/14 20:28, Mauro Faccenda wrote:
> ]> Hi all,
> ]> 
> ]> When trying to compile OVMF in latest version it fails with the following 
> ]error:
> ]> 
> ]> edk2\ovmfpkg\library\platformbdslib\qemubootorder.c(888) : warning
> ]> C4701: potentially uninitialized local variable 'IsFinal' used.
> ]> 
> ]> The IsFinal variable should be initialized (assume FALSE?).
> ]
> ]No, MSVC is wrong.
> ]I added some new code in SVN r15197, and MSVC fails to see that the
> ]place where isFinal is used is never reached when isFinal is not set.
> ]
> ]MSVC is driving me nuts, honestly. I'm tired of babysitting it.
> 
> As a long term fix, consider customizing the Microsoft compiler
> warnings to disable broken ones such as this, and to use others
> in a more sane way. Microsoft warning level 4 is not suitable 
> for every project, http://notabs.org/coding/warningLevel4.htm.
> To disable this particular warning revise
> BaseTools/Conf/tools_def.template by replacing ' /W4 ' with
> ' /W4 /wd4701 '
> Disabling the integer assignment truncation warnings to
> match gcc would eliminate the need to litter new code
> with otherwise pointless type casts.

This is a great piece of advice, thank you.

The only problem is that this would have to be sanctioned by the
basetools maintainer(s), and I believe they won't. They likely want
maximum paranoia with warnings, in order to catch real problems as well,
even at the price of a lot of false positives. Eg. I'm extremely
conscious of integer conversions, so I either avoid them or perform them
on purpose, but most people aren't / don't. If your suggestion were to
be implemented in basetools, that would help me a great deal, but I
don't think it's going to be implemented.

I'm also thinking about initializing all locals (that I wouldn't
initialize otherwise) with a type-correct 0xDEADC0DE constant. It's
quite telling and it should shut up MSVC.

Thanks!
Laszlo


------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to