bogus WaE: 'bValue' may be used uninitialized in this function
Change-Id: Ifde0f9370d093f447edac4899c5bbc7940da5a8c
This commit is contained in:
@@ -211,17 +211,13 @@ bool OCheckBoxModel::DbUseBool()
|
|||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
#if defined __GNUC__ && ! defined __clang__
|
|
||||||
#pragma GCC diagnostic push
|
|
||||||
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
|
|
||||||
#endif
|
|
||||||
Any OCheckBoxModel::translateDbColumnToControlValue()
|
Any OCheckBoxModel::translateDbColumnToControlValue()
|
||||||
{
|
{
|
||||||
Any aValue;
|
Any aValue;
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////
|
||||||
// Set value in ControlModel
|
// Set value in ControlModel
|
||||||
bool bValue;
|
bool bValue = bool(); // avoid warning
|
||||||
if(DbUseBool())
|
if(DbUseBool())
|
||||||
{
|
{
|
||||||
bValue = m_xColumn->getBoolean();
|
bValue = m_xColumn->getBoolean();
|
||||||
@@ -247,17 +243,13 @@ Any OCheckBoxModel::translateDbColumnToControlValue()
|
|||||||
{
|
{
|
||||||
// Since above either bValue is initialised, either aValue.hasValue(),
|
// Since above either bValue is initialised, either aValue.hasValue(),
|
||||||
// bValue cannot be used uninitialised here.
|
// bValue cannot be used uninitialised here.
|
||||||
// But GCC does not see/understand that, which breaks -Werror builds.
|
// But GCC does not see/understand that, which breaks -Werror builds,
|
||||||
// And Clang compiler does not support #pragma GCC diagnostic
|
// so we explicitly default-initialise it.
|
||||||
// within a function, moved them to outside the function.
|
|
||||||
aValue <<= (sal_Int16)( bValue ? STATE_CHECK : STATE_NOCHECK );
|
aValue <<= (sal_Int16)( bValue ? STATE_CHECK : STATE_NOCHECK );
|
||||||
}
|
}
|
||||||
|
|
||||||
return aValue;
|
return aValue;
|
||||||
}
|
}
|
||||||
#if defined __GNUC__ && ! defined __clang__
|
|
||||||
#pragma GCC diagnostic pop
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
sal_Bool OCheckBoxModel::commitControlValueToDbColumn( bool /*_bPostReset*/ )
|
sal_Bool OCheckBoxModel::commitControlValueToDbColumn( bool /*_bPostReset*/ )
|
||||||
|
Reference in New Issue
Block a user