From: Daan De Meyer Date: Sat, 12 Apr 2025 12:04:19 +0000 (+0200) Subject: macro: Move definition of dummy_t to macro-fundamental.h X-Git-Tag: v258-rc1~780^2~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5a124e8ee1843f6e49db56fad66f96a5d4980878;p=thirdparty%2Fsystemd.git macro: Move definition of dummy_t to macro-fundamental.h There is code in macro-fundamental.h that makes use of dummy_t so let's make sure to declare dummy_t in macro-fundamental.h as well. --- diff --git a/src/basic/macro.h b/src/basic/macro.h index 35b43f4a1b0..2b3c02c3242 100644 --- a/src/basic/macro.h +++ b/src/basic/macro.h @@ -275,12 +275,6 @@ static inline size_t size_add(size_t x, size_t y) { return saturate_add(x, y, SIZE_MAX); } -typedef struct { - int _empty[0]; -} dummy_t; - -assert_cc(sizeof(dummy_t) == 0); - /* A little helper for subtracting 1 off a pointer in a safe UB-free way. This is intended to be used for * loops that count down from a high pointer until some base. A naive loop would implement this like this: * diff --git a/src/fundamental/macro-fundamental.h b/src/fundamental/macro-fundamental.h index 6c6e02b6bc8..06fca4a8e50 100644 --- a/src/fundamental/macro-fundamental.h +++ b/src/fundamental/macro-fundamental.h @@ -521,6 +521,12 @@ static inline uint64_t ALIGN_OFFSET_U64(uint64_t l, uint64_t ali) { #define FLAGS_SET(v, flags) \ ((~(v) & (flags)) == 0) +typedef struct { + int _empty[0]; +} dummy_t; + +assert_cc(sizeof(dummy_t) == 0); + /* Restriction/bug (see below) was fixed in GCC 15 and clang 19. */ #if __GNUC__ >= 15 || (defined(__clang__) && __clang_major__ >= 19) #define DECLARE_FLEX_ARRAY(type, name) type name[]