]>
Commit | Line | Data |
---|---|---|
53e1b683 | 1 | /* SPDX-License-Identifier: LGPL-2.1+ */ |
fed527aa ZJS |
2 | /*** |
3 | This file is part of systemd. | |
4 | ||
5 | Copyright 2016 Zbigniew Jędrzejewski-Szmek | |
6 | ||
7 | systemd is free software; you can redistribute it and/or modify it | |
8 | under the terms of the GNU Lesser General Public License as published by | |
9 | the Free Software Foundation; either version 2.1 of the License, or | |
10 | (at your option) any later version. | |
11 | ||
12 | systemd is distributed in the hope that it will be useful, but | |
13 | WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
15 | Lesser General Public License for more details. | |
16 | ||
17 | You should have received a copy of the GNU Lesser General Public License | |
18 | along with systemd; If not, see <http://www.gnu.org/licenses/>. | |
19 | ***/ | |
20 | ||
61d1a5a2 | 21 | #include <stdio.h> |
dccca82b | 22 | #include <string.h> |
61d1a5a2 | 23 | |
fed527aa ZJS |
24 | #include "time-util.h" |
25 | ||
26 | /* Print information about various types. Useful when diagnosing | |
27 | * gcc diagnostics on an unfamiliar architecture. */ | |
28 | ||
29 | #pragma GCC diagnostic ignored "-Wtype-limits" | |
30 | ||
31 | #define info(t) \ | |
61d1a5a2 ZJS |
32 | printf("%s → %zu bits%s\n", STRINGIFY(t), \ |
33 | sizeof(t)*CHAR_BIT, \ | |
34 | strstr(STRINGIFY(t), "signed") ? "" : \ | |
35 | ((t)-1 < (t)0 ? ", signed" : ", unsigned")); | |
fed527aa | 36 | |
26e1f724 ZJS |
37 | enum Enum { |
38 | enum_value, | |
39 | }; | |
40 | ||
41 | enum BigEnum { | |
42 | big_enum_value = UINT64_C(-1), | |
43 | }; | |
44 | ||
fed527aa ZJS |
45 | int main(void) { |
46 | info(char); | |
47 | info(signed char); | |
48 | info(unsigned char); | |
49 | info(short unsigned); | |
50 | info(unsigned); | |
51 | info(long unsigned); | |
52 | info(long long unsigned); | |
0c183e96 ZJS |
53 | info(__syscall_ulong_t); |
54 | info(__syscall_slong_t); | |
fed527aa ZJS |
55 | |
56 | info(float); | |
57 | info(double); | |
58 | info(long double); | |
59 | ||
60 | info(size_t); | |
61 | info(ssize_t); | |
62 | info(time_t); | |
63 | info(usec_t); | |
0c183e96 | 64 | info(__time_t); |
98d93199 | 65 | info(pid_t); |
85f8fa4d | 66 | info(uid_t); |
98d93199 | 67 | info(gid_t); |
fed527aa | 68 | |
26e1f724 ZJS |
69 | info(enum Enum); |
70 | info(enum BigEnum); | |
71 | ||
fed527aa ZJS |
72 | return 0; |
73 | } |