[ltt-dev] [LTTV PATCH] Fix warnings int the lttv/sync directory
Yannick Brosseau
yannick.brosseau at gmail.com
Tue Jan 25 10:09:58 EST 2011
On 2011-01-24 19:58, Benjamin Poirier wrote:
> On 24/01/11 01:05 PM, Yannick Brosseau wrote:
>> Mostly wrong usages of g_error
>>
> [...]
>> @@ -550,7 +550,7 @@ static void analyzeMessageEval(SyncState* const
>> syncState, Message* const
>> message)
>> {
>> AnalysisDataEval* analysisData= syncState->analysisData;
>> - MessageStats* messageStats;
>> + MessageStats* messageStats = NULL;
>
> I'd like to mention that the warning
> sync/event_analysis_eval.c:553: warning: ‘messageStats’ may be used
> uninitialized in this function
>
> goes away when you configure and compile with CFLAGS=-O0 so I thought
> it might be a compiler glitch. Any insight on that?
>
Probably that without reordering, the compiler is able to see that the
variable is not really used before initialization. (When you inspect the
code you see that in the current state, it does not cause a problem.)
But anyway, it's always a better habit to always initialize variable to
sane values when they are declared.
Yannck
More information about the lttng-dev
mailing list