From 5a124e8ee1843f6e49db56fad66f96a5d4980878 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Sat, 12 Apr 2025 14:04:19 +0200 Subject: [PATCH] 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. --- src/basic/macro.h | 6 ------ src/fundamental/macro-fundamental.h | 6 ++++++ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/basic/macro.h b/src/basic/macro.h index 35b43f4a1b..2b3c02c324 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 6c6e02b6bc..06fca4a8e5 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[]