From: Simon McVittie Date: Thu, 16 Apr 2020 13:11:09 +0000 (+0100) Subject: _dbus_test_check: Wrap body of macro in do/while X-Git-Tag: dbus-1.13.14~2^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c46e002fe60a0b57a275463f2e42f4fad239d10e;p=thirdparty%2Fdbus.git _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 --- diff --git a/dbus/dbus-test-tap.h b/dbus/dbus-test-tap.h index 423cf48ea..19f041b6c 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