Skip to content

Commit bc51214

Browse files
minimize message format for assume functions
1 parent 039f863 commit bc51214

File tree

1 file changed

+7
-13
lines changed

1 file changed

+7
-13
lines changed

code/logic/fossil/pizza/test.h

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -545,20 +545,14 @@ void _on_skip(const char *description);
545545
* runner. If the condition is false, the test runner will output the specified
546546
* message and may abort the execution of the test case or test suite.
547547
*/
548-
#ifdef _WIN32
549-
#define _FOSSIL_TEST_ASSUME_MESSAGE(message, ...) \
550-
pizza_test_assert_messagef((message), __VA_ARGS__)
551-
#elif defined(__APPLE__)
552-
#define _FOSSIL_TEST_ASSUME_MESSAGE(message, ...) \
553-
pizza_test_assert_messagef((message) __VA_OPT__(, __VA_ARGS__))
548+
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L
549+
// C23: __VA_OPT__ is available
550+
#define _FOSSIL_TEST_ASSUME_MESSAGE(message, ...) \
551+
pizza_test_assert_messagef((message) __VA_OPT__(, __VA_ARGS__))
554552
#else
555-
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201710L
556-
#define _FOSSIL_TEST_ASSUME_MESSAGE(message, ...) \
557-
pizza_test_assert_messagef((message) __VA_OPT__(, __VA_ARGS__))
558-
#else
559-
#define _FOSSIL_TEST_ASSUME_MESSAGE(message, ...) \
560-
pizza_test_assert_messagef((message) , __VA_ARGS__)
561-
#endif
553+
// C11 and earlier: use GCC/Clang extension for ##__VA_ARGS__
554+
#define _FOSSIL_TEST_ASSUME_MESSAGE(message, ...) \
555+
pizza_test_assert_messagef((message), ##__VA_ARGS__)
562556
#endif
563557

564558
/**

0 commit comments

Comments
 (0)