Test/Fix potential macro bug
authorMyungJoo Ham <myungjoo.ham@samsung.com>
Fri, 24 Jul 2020 09:58:09 +0000 (18:58 +0900)
committerMyungJoo Ham <myungjoo.ham@samsung.com>
Mon, 27 Jul 2020 01:53:41 +0000 (10:53 +0900)
What if you do:
```
if (WHATSOEVER)
  _print_log (MESSAGE);
else
  do_something ();
```

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
tests/nnstreamer_plugins/unittest_plugins.cc

index 5b884bf..eac0e2d 100644 (file)
 /**
  * @brief Macro for debug message.
  */
-#define _print_log(...) if (DBG) g_message (__VA_ARGS__)
+#define _print_log(...) \
+  do { \
+    if (DBG) \
+      g_message (__VA_ARGS__); \
+  } while (0)
 
 #define str(s) #s
 #define TEST_TRANSFORM_TYPECAST(name, num_bufs, size, from_t, from_nns_t, to_t, str_to_t, to_nns_t, accel) \