-Wunused-but-set-variable warnings

Sune Vuorela nospam at vuorela.dk
Mon Jul 4 22:18:42 BST 2011


On 2011-07-04, Albert Astals Cid <aacid at kde.org> wrote:
> --Boundary-01=_YFgEOebgzUxkqvf
> Content-Type: text/plain;
>   charset="us-ascii"
> Content-Transfer-Encoding: 7bit
>
> A Monday, July 04, 2011, Dawit A va escriure:
>> The following files all contain set but unused variables:
>> 
>> snip
>>
>> Unlike the -Wunused-parameter fixing this warning messages requires
>> context because the variable may be set and unused due to a mistake
>> that can potentially be causing a bug. As such can kdelibs cmake file
>> be changed to error out, -Werror=unused-but-set-variable, for such
>> warnings ?
>
> You really want to make kdelibs uncompilable?

I expect him to make kdelibs clean for these warnings first.
(these=unused-but-set-variable).

it is for things like
{
int error = function_call()
}

or as I found in some code at work

{
QObject* obj = hash[key];
}

I don't think it is a bad idea to get rid of these warnings, and prevent
further of *this* kind of things.

/Sune





More information about the kde-core-devel mailing list