[Mesa-dev] [PATCH v2] amd_performance_monitor: Fix multi-statement macro 'report'.

Kenneth Graunke kenneth at whitecape.org
Tue May 7 22:16:03 PDT 2013


On 05/07/2013 02:04 PM, Vinson Lee wrote:
> Fixes "Nesting level does not match indentation" defect reported by
> Coverity.

That has to be the stupidest defect I've ever heard of.  But your patch 
looks reasonable nonetheless - most people use do-while blocks like 
that, so it's probably a good idea.

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

> Signed-off-by: Vinson Lee <vlee at freedesktop.org>
> ---
>   tests/spec/amd_performance_monitor/api.c | 6 ++++--
>   1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/tests/spec/amd_performance_monitor/api.c b/tests/spec/amd_performance_monitor/api.c
> index 7b321cf..3205fc0 100644
> --- a/tests/spec/amd_performance_monitor/api.c
> +++ b/tests/spec/amd_performance_monitor/api.c
> @@ -113,8 +113,10 @@ find_invalid_counter(unsigned *counters, int num_counters)
>   }
>
>   #define report(pass) \
> -    piglit_report_subtest_result((pass) ? PIGLIT_PASS : PIGLIT_FAIL, __FUNCTION__); \
> -    return
> +	do { \
> +		piglit_report_subtest_result((pass) ? PIGLIT_PASS : PIGLIT_FAIL, __FUNCTION__); \
> +		return; \
> +	} while (0)
>
>   /******************************************************************************/
>
>



More information about the mesa-dev mailing list