]>
git.ipfire.org Git - thirdparty/systemd.git/blob - src/test/test-sizeof.c
1 /* SPDX-License-Identifier: LGPL-2.1+ */
3 This file is part of systemd.
5 Copyright 2016 Zbigniew Jędrzejewski-Szmek
11 #include "time-util.h"
13 /* Print information about various types. Useful when diagnosing
14 * gcc diagnostics on an unfamiliar architecture. */
16 #pragma GCC diagnostic ignored "-Wtype-limits"
19 printf("%s → %zu bits%s\n", STRINGIFY(t), \
21 strstr(STRINGIFY(t), "signed") ? "" : \
22 ((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
);
64 assert_cc(sizeof(enum BigEnum2
) == 8);
65 printf("big_enum2_pos → %zu\n", sizeof(big_enum2_pos
));
66 printf("big_enum2_neg → %zu\n", sizeof(big_enum2_neg
));