Skip to content

include: Don't evaluate format arguments to ok() unless we need them.

Yuxuan Shui requested to merge yshui/wine:ok-macro into master

Across the codebase there are several test cases where the arguments to ok() is not safe to evaluate unless the test case fails.

For example:

ok(i == ARRAY_SIZE(array), "i is too small: %d\n", array[i]);

Only when the test fails (i.e. i < ARRAY_SIZE(array)), is array[i] safe to evaluate.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=58320


The other option is to fix all such cases in the test suite, and add some documentation to make it clear arguments to ok() are always evaluated. I don't know which one is better.

Merge request reports

Loading