[cfe-commits] r135348 - /cfe/trunk/lib/Sema/AnalysisBasedWarnings.cpp

Douglas Gregor dgregor at apple.com
Mon Jul 18 09:18:11 PDT 2011


On Jul 18, 2011, at 9:17 AM, jahanian wrote:

> 
> On Jul 16, 2011, at 10:15 PM, Douglas Gregor wrote:
> 
>> 
>> On Jul 16, 2011, at 10:14 PM, Douglas Gregor wrote:
>> 
>>> 
>>> On Jul 16, 2011, at 11:31 AM, Fariborz Jahanian wrote:
>>> 
>>>> Author: fjahanian
>>>> Date: Sat Jul 16 13:31:33 2011
>>>> New Revision: 135348
>>>> 
>>>> URL: http://llvm.org/viewvc/llvm-project?rev=135348&view=rev
>>>> Log:
>>>> Remove a gcc warning.
>>>> 
>>>> 
>>>> Modified:
>>>> cfe/trunk/lib/Sema/AnalysisBasedWarnings.cpp
>>>> 
>>>> Modified: cfe/trunk/lib/Sema/AnalysisBasedWarnings.cpp
>>>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/AnalysisBasedWarnings.cpp?rev=135348&r1=135347&r2=135348&view=diff
>>>> ==============================================================================
>>>> --- cfe/trunk/lib/Sema/AnalysisBasedWarnings.cpp (original)
>>>> +++ cfe/trunk/lib/Sema/AnalysisBasedWarnings.cpp Sat Jul 16 13:31:33 2011
>>>> @@ -723,7 +723,7 @@
>>>>    != Diagnostic::Ignored) {
>>>>  if (CFG *cfg = AC.getCFG()) {
>>>>    UninitValsDiagReporter reporter(S);
>>>> -      UninitVariablesAnalysisStats stats = {};
>>>> +      UninitVariablesAnalysisStats stats;
>>> 
>>> Don't we need to make sure that the members of 'stats' get zero-initialized?
>> 
>> Hah, and I see that Benjamin fixed this already in r135351.
> 
> Yes, he fixed this already. But it is weird that we resort to hacks to do this. Can't the default constructor do this? I am not sure what the
> issue is that this cannot be done in a c++-way (Have not looked at it closely).

"= {}" is the correct C++ way, but GCC warns about it for some (unjustifiable) reason. Basically, we're hacking around a bogus GCC warning.

	- Doug



More information about the cfe-commits mailing list