[Cython] GCC 4.6 unused-but-set-variable warnings

Vitja Makarov vitja.makarov at gmail.com
Wed Aug 3 21:07:46 CEST 2011


2011/8/2 Vitja Makarov <vitja.makarov at gmail.com>:
> 2011/8/2 Vitja Makarov <vitja.makarov at gmail.com>:
>> 2011/8/2 Vitja Makarov <vitja.makarov at gmail.com>:
>>> 2011/7/29 Stefan Behnel <stefan_ml at behnel.de>:
>>>> Vitja Makarov, 29.07.2011 10:55:
>>>>>
>>>>> 2011/7/29 Stefan Behnel<stefan_ml at behnel.de>:
>>>>>>
>>>>>> Vitja Makarov, 29.07.2011 10:44:
>>>>>>>
>>>>>>> 2011/7/29 Stefan Behnel:
>>>>>>>>
>>>>>>>> Vitja Makarov, 29.07.2011 10:08:
>>>>>>>>>
>>>>>>>>> this issue isn't critical and even isn't a bug at all.
>>>>>>>>
>>>>>>>> Agreed. It's nothing that needs to be done for 0.15. I just thought you
>>>>>>>> might be interested. :D
>>>>>>>>
>>>>>>>
>>>>>>> Yeah, I tried to do this once but I've found some problems with buffer
>>>>>>> variables.
>>>>>>>
>>>>>>> What to do about local variables:
>>>>>>>
>>>>>>> def foo():
>>>>>>>     a = 1
>>>>>>>
>>>>>>> 'a' is unused here
>>>>>>
>>>>>> That's up to the user to fix. However, there may be restrictions
>>>>>> regarding
>>>>>> the signature (inheritance etc.) that the users cannot control, so unused
>>>>>> *parameters* must not produce warnings.
>>>>>>
>>>>>
>>>>> Sure. Because of that there is separate warn.unused_args option :)
>>>>
>>>> With the caveat that gcc 4.6 produces a warning with -Wall for them, because
>>>> it cannot know that they originally were parameters in the Cython code.
>>>>
>>>
>>>
>>> I tried to implement this for c[p]def functions:
>>>
>>> For required args I've added CYTHON_UNUSED qualifier and removed
>>> unused optionals.
>>>
>>
>>
>> Stefan, do you know why skip_dispatch argument is used for
>> module-level cpdef function?
>>
>> There is warning about that too.
>>
>
> I tried to fix the issue here:
> https://github.com/vitek/cython/commit/dc87be3f546ffe609fdce9514d939c147c99cf35
>
> And here is my branch for unused_arg:
>
> https://github.com/vitek/cython/commits/_unused_args
>

I've reverted skip_dispatch argument removal, that doesn't work this
way and is more general issue.
Now I mark all unused local entries and args with CYTHON_UNUSED.

That actually isn't an optimization just some warnings removal.

I think real optimization should be done when we start with DefNode refactoring.

If you like that I'm gonna start pull request.

-- 
vitja.


More information about the cython-devel mailing list