From: Yu Watanabe Date: Wed, 31 May 2023 23:20:04 +0000 (+0900) Subject: test: check size detections by meson X-Git-Tag: v254-rc1~125^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a10093684789d1bf88b1d3ab881d73a25b9403ed;p=thirdparty%2Fsystemd.git test: check size detections by meson --- diff --git a/src/test/test-sizeof.c b/src/test/test-sizeof.c index 5dd8a04bbd7..18378b04500 100644 --- a/src/test/test-sizeof.c +++ b/src/test/test-sizeof.c @@ -3,8 +3,9 @@ #include #include #include -#include +#include #include +#include #define __STDC_WANT_IEC_60559_TYPES_EXT__ #include @@ -28,6 +29,18 @@ DISABLE_WARNING_TYPE_LIMITS; (t)-1 < (t)0 ? ", signed" : ", unsigned", \ alignof(t)) +#define check_no_sign(t, size) \ + do { \ + info_no_sign(t); \ + assert_se(sizeof(t) == size); \ + } while (false) + +#define check(t, size) \ + do { \ + info(t); \ + assert_se(sizeof(t) == size); \ + } while (false) + enum Enum { enum_value, }; @@ -44,6 +57,12 @@ enum BigEnum2 { int main(void) { int (*function_pointer)(void); + check_no_sign(dev_t, SIZEOF_DEV_T); + check_no_sign(ino_t, SIZEOF_INO_T); + check_no_sign(rlim_t, SIZEOF_RLIM_T); + check(time_t, SIZEOF_TIME_T); + check(typeof(((struct timex *)0)->freq), SIZEOF_TIMEX_MEMBER); + info_no_sign(typeof(function_pointer)); info_no_sign(void*); info(char*); @@ -76,7 +95,6 @@ int main(void) { info(size_t); info(ssize_t); - info(time_t); info(usec_t); #ifdef __GLIBC__ info(__time_t);