I wanted to write something like this in a test:
if (cond)
fail("message 1");
else
fail("message 2");
And was met with
CC test_action.o
/home/simark/src/lttng-tools/tests/unit/test_action.c: In function ‘main’:
/home/simark/src/lttng-tools/tests/unit/test_action.c:544:9: error: ‘else’ without a previous ‘if’
544 | else
| ^~~~
I then remembered that it was in our coding style to use braces:
if (cond) {
fail("message 1");
} else {
fail("message 2");
}
... which avoids the error. But still, the former form should work.
Fix this by removing the semi-colons in the pass and fail definitions, I
don't think they belong there. Doing so finds a spot in ini_config.c
where a semi-colon is missing, add it.
Change-Id: I6ff09d496a0b12f34baa6f993cffc69eef611df0
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
}
path = utils_expand_path(argv[1]);
if (!path) {
}
path = utils_expand_path(argv[1]);
if (!path) {
- fail("Failed to resolve sample INI file path")
+ fail("Failed to resolve sample INI file path");
_gen_result(1, __func__, __FILE__, __LINE__, "%s", #e) : \
_gen_result(0, __func__, __FILE__, __LINE__, "%s", #e))
_gen_result(1, __func__, __FILE__, __LINE__, "%s", #e) : \
_gen_result(0, __func__, __FILE__, __LINE__, "%s", #e))
-# define pass(test, ...) ok(1, test, ## __VA_ARGS__);
-# define fail(test, ...) ok(0, test, ## __VA_ARGS__);
+# define pass(test, ...) ok(1, test, ## __VA_ARGS__)
+# define fail(test, ...) ok(0, test, ## __VA_ARGS__)
# define skip_start(test, n, fmt, ...) \
do { \
# define skip_start(test, n, fmt, ...) \
do { \
_gen_result(1, __func__, __FILE__, __LINE__, "%s", #e) : \
_gen_result(0, __func__, __FILE__, __LINE__, "%s", #e))
_gen_result(1, __func__, __FILE__, __LINE__, "%s", #e) : \
_gen_result(0, __func__, __FILE__, __LINE__, "%s", #e))
-# define pass(...) ok(1, __VA_ARGS__);
-# define fail(...) ok(0, __VA_ARGS__);
+# define pass(...) ok(1, __VA_ARGS__)
+# define fail(...) ok(0, __VA_ARGS__)
# define skip_start(test, n, ...) \
do { \
# define skip_start(test, n, ...) \
do { \