]>
git.ipfire.org Git - thirdparty/systemd.git/blob - src/test/test-sizeof.c
1 /* SPDX-License-Identifier: LGPL-2.1+ */
7 #define __STDC_WANT_IEC_60559_TYPES_EXT__
10 #include "time-util.h"
12 /* Print information about various types. Useful when diagnosing
13 * gcc diagnostics on an unfamiliar architecture. */
15 #pragma GCC diagnostic ignored "-Wtype-limits"
18 printf("%s → %zu bits%s, %zu byte alignment\n", STRINGIFY(t), \
20 strstr(STRINGIFY(t), "signed") ? "" : \
21 (t)-1 < (t)0 ? ", signed" : ", unsigned", \
29 big_enum_value
= UINT64_C(1),
33 big_enum2_pos
= UINT64_C(1),
34 big_enum2_neg
= UINT64_C(-1),
44 info(long long unsigned);
45 info(__syscall_ulong_t
);
46 info(__syscall_slong_t
);
74 assert_cc(sizeof(enum BigEnum2
) == 8);
75 printf("big_enum2_pos → %zu\n", sizeof(big_enum2_pos
));
76 printf("big_enum2_neg → %zu\n", sizeof(big_enum2_neg
));