diff options
author | Simon McVittie <smcv@collabora.com> | 2020-04-16 14:11:09 +0100 |
---|---|---|
committer | Simon McVittie <smcv@collabora.com> | 2020-04-20 10:11:38 +0100 |
commit | c46e002fe60a0b57a275463f2e42f4fad239d10e (patch) | |
tree | f9167cb2da4fdf8852646dc2d2e7feda1be4e98d /dbus/dbus-test-tap.h | |
parent | 0ddc51013038f282dc9be5481a4965c36f50e4c8 (diff) | |
download | dbus-c46e002fe60a0b57a275463f2e42f4fad239d10e.tar.gz |
_dbus_test_check: Wrap body of macro in do/while
This avoids unexpected precedence when used as the body of an "if" or
"else" without being wrapped in {}.
Signed-off-by: Simon McVittie <smcv@collabora.com>
Diffstat (limited to 'dbus/dbus-test-tap.h')
-rw-r--r-- | dbus/dbus-test-tap.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/dbus/dbus-test-tap.h b/dbus/dbus-test-tap.h index 423cf48e..19f041b6 100644 --- a/dbus/dbus-test-tap.h +++ b/dbus/dbus-test-tap.h @@ -59,7 +59,10 @@ void _dbus_test_check_memleaks (const char *test_name); DBUS_PRIVATE_EXPORT int _dbus_test_done_testing (void); -#define _dbus_test_check(a) if (!(a)) _dbus_test_not_ok ("%s:%d - '%s' failed\n", __FILE__, __LINE__, #a) +#define _dbus_test_check(a) do { \ + if (!(a)) \ + _dbus_test_not_ok ("%s:%d - '%s' failed\n", __FILE__, __LINE__, #a); \ + } while (0) #endif |