On 05/05/2013 12:11 AM, Vinson Lee wrote:
The macro 'report' expands to multiple statements. Add braces to nest
all statements in expanded macro within if-statement.

Fixes "Nesting level does not match indentation" defect reported by
Coverity.

Signed-off-by: Vinson Lee<v...@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..a7edf47 100644
--- a/tests/spec/amd_performance_monitor/api.c
+++ b/tests/spec/amd_performance_monitor/api.c
@@ -436,8 +436,9 @@ test_group_string_normal_buffer(unsigned valid_group)
        /* Get the length; bail if unwritten to avoid huge allocations. */
        glGetPerfMonitorGroupStringAMD(valid_group, 0,&length, NULL);
        pass = pass&&  piglit_check_gl_error(GL_NO_ERROR);
-       if (length == 0xd0d0d0d0)
+       if (length == 0xd0d0d0d0) {
                report(false);
+       }

        name = malloc(length + 1);
        assert(name != NULL);
@@ -580,8 +581,9 @@ test_counter_string_normal_buffer(unsigned group, unsigned 
counter)
        /* Get the length; bail if unwritten to avoid huge allocations. */
        glGetPerfMonitorCounterStringAMD(group, counter, 0,&length, NULL);
        pass = pass&&  piglit_check_gl_error(GL_NO_ERROR);
-       if (length == 0xd0d0d0d0)
+       if (length == 0xd0d0d0d0) {
                report(false);
+       }

        name = malloc(length + 1);
        assert(name != NULL);

Since the report) macro is used in many places, it would probably be safer to fix the macro itself to future-proof it a bit:

#define report(pass) \
   do { \
piglit_report_subtest_result((pass) ? PIGLIT_PASS : PIGLIT_FAIL, __FUNCTION__); \
       return; \
   } while (0)

-Brian
_______________________________________________
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit

Reply via email to