From eeae6098b65da4e5be07f7b84c763846f0cb74cf Mon Sep 17 00:00:00 2001 From: Nigel Tao Date: Wed, 8 Jan 2020 13:59:50 +1100 Subject: [PATCH] Add "do ... while(0)" around CHECK_ETC test macros --- test/c/testlib/testlib.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/c/testlib/testlib.c b/test/c/testlib/testlib.c index 9dc8e7ed..853d23ae 100644 --- a/test/c/testlib/testlib.c +++ b/test/c/testlib/testlib.c @@ -66,20 +66,20 @@ char fail_msg[65536] = {0}; msg += snprintf(msg, sizeof(fail_msg) - (msg - fail_msg), ##__VA_ARGS__) #define CHECK_STATUS(prefix, status) \ - { \ + do { \ wuffs_base__status z = status; \ if (z.repr) { \ RETURN_FAIL("%s: \"%s\"", prefix, z.repr); \ } \ - } + } while (0) #define CHECK_STRING(string) \ - { \ + do { \ const char* z = string; \ if (z) { \ return z; \ } \ - } + } while (0) int tests_run = 0;