]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
basic/macro: move DECIMAL_STR_FMT to shared/tests
authorMike Yuan <me@yhndnzj.com>
Sun, 15 Sep 2024 13:00:06 +0000 (15:00 +0200)
committerMike Yuan <me@yhndnzj.com>
Fri, 20 Sep 2024 20:44:34 +0000 (22:44 +0200)
This shall never be used outside of test functions.

src/basic/macro.h
src/shared/tests.h

index 7e2bc628dbf95a6c3368e6e9463c568544165641..68eb7bbd0e544ffb8597bbad01a2239d1890cd2b 100644 (file)
@@ -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"
index 33180e7b371aa9527b7826f8a4766aa667695f6f..141bfe4f22d87bfab610163da3d8a1a6cf1b72e3 100644 (file)
@@ -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);                                                                  \