Laszlo Ersek [mailto:[email protected]] 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. Thanks, Scott ]If you ]send a patch, initializing IsFinal to whatever value, I'll ack it ]though. Also, in any new code I write I'll initialize block scope ]variables inside their definitions, no matter how match that clashes ]with the coding style. This warning crap is ridiculous. Should I ask Red ]Hat to shell out $$$ for an MSDN subscription for me, just to shut up ]these warnings? Also, should I ask for four versions of MSVC so that I ]can be sure each one of them is silenced appropriately? Please. ] ]If you look at SVN r15197, you're gonna notice that the ] ] NumNodes = 0; ] ]assignment *also* could have been moved under the "else" branch. Because ]NumNodes is never used if we take the other branch. But, I intentionally ]left the assignment in place, because I was sure that MSVC would ]complain if I had made the assignment conditional. Looks like you can ]never be paranoid enough. ] ]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 [email protected] https://lists.sourceforge.net/lists/listinfo/edk2-devel
