From: Mike Yuan Date: Sun, 15 Sep 2024 13:00:06 +0000 (+0200) Subject: basic/macro: move DECIMAL_STR_FMT to shared/tests X-Git-Tag: v257-rc1~378^2~6 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=175de2c28ea3dbd0b60c471d6f9e48f5e88f0901;p=thirdparty%2Fsystemd.git basic/macro: move DECIMAL_STR_FMT to shared/tests This shall never be used outside of test functions. --- diff --git a/src/basic/macro.h b/src/basic/macro.h index 7e2bc628dbf..68eb7bbd0e5 100644 --- a/src/basic/macro.h +++ b/src/basic/macro.h @@ -368,17 +368,4 @@ assert_cc(sizeof(dummy_t) == 0); ((long)(_current_ - _entries_) < (long)(ELEMENTSOF(_entries_) - 1)) && ({ entry = *_current_; true; }); \ _current_++) -#define DECIMAL_STR_FMT(x) _Generic((x), \ - char: "%c", \ - bool: "%d", \ - unsigned char: "%d", \ - short: "%hd", \ - unsigned short: "%hu", \ - int: "%d", \ - unsigned: "%u", \ - long: "%ld", \ - unsigned long: "%lu", \ - long long: "%lld", \ - unsigned long long: "%llu") - #include "log.h" diff --git a/src/shared/tests.h b/src/shared/tests.h index 33180e7b371..141bfe4f22d 100644 --- a/src/shared/tests.h +++ b/src/shared/tests.h @@ -208,6 +208,19 @@ static inline int run_test_table(void) { #define DEFINE_TEST_MAIN(log_level) \ DEFINE_TEST_MAIN_FULL(log_level, NULL, NULL) +#define DECIMAL_STR_FMT(x) _Generic((x), \ + char: "%c", \ + bool: "%d", \ + unsigned char: "%d", \ + short: "%hd", \ + unsigned short: "%hu", \ + int: "%d", \ + unsigned: "%u", \ + long: "%ld", \ + unsigned long: "%lu", \ + long long: "%lld", \ + unsigned long long: "%llu") + #define ASSERT_OK(expr) \ ({ \ typeof(expr) _result = (expr); \