Bad usage of ok() macro in tests

Austin English austinenglish at gmail.com
Wed Feb 24 10:59:52 CST 2010


On Wed, Feb 24, 2010 at 9:25 AM, Yann Droneaud <yann at droneaud.fr> wrote:
> Le mercredi 24 février 2010 à 15:47 +0100, Yann Droneaud a écrit :
>> Hi,
>>
>> While trying to manage to fix warning about unused values, I've found a
>> problem about some usages of ok() macro.
>>
>> ok() macros is defined in include/wine/test.h as:
>>
>>    #define ok_(file, line)       (winetest_set_location(file, line),
>> 0) ? 0 : winetest_ok
>>    #define ok       ok_(__FILE__, __LINE__)
>>
>
>> Hopefully, this is only of limited use in wine test suite: find . -type
>> d -name tests | xargs grep -r '[=\!][[:space:](]*ok[[:space:]]*('
>> returns only four cases:
>>
>
> In fact, it seems there's no more than those construct which use ok()
> return value.
>
> Try :
>
> find . -type d -and -name 'tests' | xargs grep -nr
> 'if[[:space:]]*([[:space:]]*\!\?[[:space:](]*ok[[:space:]]*('
> find . -type d -and -name 'tests' | xargs grep -r '[=\!]\
> +[[:space:](]*ok[[:space:]]*('
>
>
> So I think it's a good opportunity to simplify ok() and let's it return
> void:
>
> #define ok       winetest_set_location(__FILE__, __LINE__), winetest_ok

Nice catch! Seems Alexandre fixed these issues:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=69ee0ad151b4ae14fa017d3f5a284af587d7de01
http://source.winehq.org/git/wine.git/?a=commitdiff;h=fbbac38e4ed9fd95d5ab3d0422bcc55ee2d39498
http://source.winehq.org/git/wine.git/?a=commitdiff;h=2432b0f6b91e57e886dfe39db83d991fde00c2b5
http://source.winehq.org/git/wine.git/?a=commitdiff;h=d5a54642f478a530cf7672332c423233d11f157f
http://source.winehq.org/git/wine.git/?a=commitdiff;h=d279227538a32130c437ba8523f7c928e1b1d109

-- 
-Austin



More information about the wine-devel mailing list