r17352 - gnucash/branches/gobject-engine-dev2/src/engine - Convert GncBudget to be a GObject with parameters and private section.

Phil Longstaff plongstaff at rogers.com
Sun Jul 27 20:27:28 EDT 2008


Andreas Köhler wrote:
> Hi Phil,
> 
> On So, 2008-07-20 at 15:12 -0400, Phil Longstaff wrote:
>> Author: plongstaff
>> Date: 2008-07-20 15:12:44 -0400 (Sun, 20 Jul 2008)
>> New Revision: 17352
>> Trac: http://svn.gnucash.org/trac/changeset/17352
>> Log:
>> Convert GncBudget to be a GObject with parameters and private section.
> 
> ---8<---
>> Modified: gnucash/branches/gobject-engine-dev2/src/engine/gnc-budget.c
>> ===================================================================
>>  static void
>>  gnc_budget_free(QofInstance *inst)
>>  {
>> -    GncBudget *budget = GNC_BUDGET(inst);
>> +    GncBudget *budget;
>> +	BudgetPrivate* priv;
>> +
>>      if (budget == NULL)
>>          return;
>> -
>>      g_return_if_fail(GNC_IS_BUDGET(budget));
>>  
>> +	budget = GNC_BUDGET(inst);
>> +	priv = GET_PRIVATE(budget);
>> +
> ---8<---
> 
> I cannot compile this file as gcc complains about "error: 'budget' is
> used uninitialized in this function".  Actually, I think this is a
> -Wuninitialized warning (from -Wall) treated as error given -Werror.
> That flag is added by configure when the source tree is found in an
> svn/svk/git checkout, so it should be active for you as well.

According to 'man gcc', -Wuninitialized is enabled by -Wall.  However,
-Wuninitialized also requires -O.  If -Wuninitialized is used without
-O, gcc gives a warning message.  If -Winitialized is *not* specified,
but -Wall is, and -O is not present, there is no warning message and no
check for uninitialized variables.

BTW, This is fixed in both the gobject-engine-dev2 tree (r17431) and
gda-dev2 (17432).

Phil



More information about the gnucash-devel mailing list