libsel4test: Put whitespace in-between adjacent string literals. Later C++ standards interpret characters immediately adjacent to a string literal to be an encoding modifier (similar to unicode literals). This commit inserts whitespace to avoid this ambiguity. It should have no effect when compiling under standards without this interpretation.
diff --git a/libsel4test/include/sel4test/test.h b/libsel4test/include/sel4test/test.h index fda5a5e..daaa078 100644 --- a/libsel4test/include/sel4test/test.h +++ b/libsel4test/include/sel4test/test.h
@@ -116,10 +116,10 @@ #define test_op_type(a, b, op, t, name_a, name_b, cast) \ do {\ if (!(a op b)) { \ - int len = snprintf(NULL, 0, "Check %s("t") %s %s("t") failed.",\ + int len = snprintf(NULL, 0, "Check %s(" t ") %s %s(" t ") failed.",\ #name_a, (cast) a, #op, #name_b, (cast) b) + 1; \ char buffer[len]; \ - snprintf(buffer, len, "Check %s("t") %s %s("t") failed.",\ + snprintf(buffer, len, "Check %s(" t ") %s %s(" t ") failed.",\ #name_a, (cast) a, #op, #name_b, (cast) b); \ _test_error(buffer, __FILE__, __LINE__); \ }\ @@ -151,7 +151,7 @@ } else if (TYPES_COMPATIBLE(typeof(_a), char)) {\ test_op_type(_a, _b, op, "%c", a, b, char); \ } else if (TYPES_COMPATIBLE(typeof(_a), uintptr_t)) {\ - test_op_type(_a, _b, op, "0x%"PRIxPTR, a, b, uintptr_t);\ + test_op_type(_a, _b, op, "0x%" PRIxPTR, a, b, uintptr_t);\ } else { \ _test_error("Cannot use test_op on this type", __FILE__, __LINE__);\ }\ @@ -170,9 +170,9 @@ #define test_strop(a, b, op) \ do {\ if (strnlen(a, __TEST_MAX_STRING) == __TEST_MAX_STRING) {\ - _test_error("String "#a" too long for test_str* macros", __FILE__, __LINE__);\ + _test_error("String " #a " too long for test_str* macros", __FILE__, __LINE__);\ } else if (strnlen(b, __TEST_MAX_STRING) == __TEST_MAX_STRING) {\ - _test_error("String "#b" too long for test_str* macros", __FILE__, __LINE__);\ + _test_error("String " #b " too long for test_str* macros", __FILE__, __LINE__);\ } else if (!(strncmp(a, b, __TEST_MAX_STRING)) op 0) {\ char buffer[__TEST_BUFFER_SIZE + 2 * __TEST_MAX_STRING];\ snprintf(buffer, sizeof(buffer),\