1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-22 17:35:35 +03:00

basic/macro: move DECIMAL_STR_FMT to shared/tests

This shall never be used outside of test functions.
This commit is contained in:
Mike Yuan 2024-09-15 15:00:06 +02:00
parent 0121b84e41
commit 175de2c28e
No known key found for this signature in database
GPG Key ID: 417471C0A40F58B3
2 changed files with 13 additions and 13 deletions

View 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"

View 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); \