1
+ #include <stdint.h>
2
+
3
+ typedef signed char INT8 ; // COMPLIANT: exception, typedefs are permitted
4
+ typedef unsigned char UINT8 ; // COMPLIANT: exception, typedefs are permitted
5
+
6
+ typedef short _INT16 ; // COMPLIANT: exception, typedefs are permitted
7
+ typedef signed short INT16 ; // COMPLIANT: exception, typedefs are permitted
8
+ typedef unsigned short UINT16 ; // COMPLIANT: exception, typedefs are permitted
9
+
10
+ typedef int _INT32 ; // COMPLIANT: exception, typedefs are permitted
11
+ typedef signed int INT32 ; // COMPLIANT: exception, typedefs are permitted
12
+ typedef unsigned int UINT32 ; // COMPLIANT: exception, typedefs are permitted
13
+
14
+ typedef long _INT64 ; // COMPLIANT: exception, typedefs are permitted
15
+ typedef signed long INT64 ; // COMPLIANT: exception, typedefs are permitted
16
+ typedef unsigned long UINT64 ; // COMPLIANT: exception, typedefs are permitted
17
+
18
+ typedef long long _INT128 ; // COMPLIANT: exception, typedefs are permitted
19
+ typedef signed long long INT128 ; // COMPLIANT: exception, typedefs are permitted
20
+ typedef unsigned long long
21
+ UINT128 ; // COMPLIANT: exception, typedefs are permitted
22
+
23
+ typedef float FLOAT32 ; // COMPLIANT: exception, typedefs are permitted
24
+ typedef double FLOAT64 ; // COMPLIANT: exception, typedefs are permitted
25
+ typedef long double FLOAT128 ; // COMPLIANT: exception, typedefs are permitted
26
+
27
+ typedef int8_t
28
+ astronomical_number_t ; // COMPLIANT: aliasing a fixed-width numeric typedef
29
+ typedef uint8_t u_astronomical_number_t ; // COMPLIANT: aliasing a fixed-width
30
+ // numeric typedef
31
+ typedef int
32
+ astronomical_number_t ; // NON_COMPLIANT: aliasing a basic numeric type
33
+
34
+ int // COMPLIANT: exception, main's return type can be plain int
35
+ main (int argc , // COMPLIANT: exception, argc's type can be plain int
36
+ char * argv []) { // COMPLIANT: char is not a basic numeric type
37
+
38
+ char c1 = 1 ; // COMPLIANT: char is not a basic numeric type
39
+ signed char c2 = 1 ; // NON_COMPLIANT: use typedef int8_t in stdint
40
+ unsigned char c3 = 1 ; // NON_COMPLIANT: use typedef uint8_t in stdint
41
+ INT8 c4 = 1 ; // COMPLIANT: typedef used instead
42
+
43
+ short s1 = 1 ; // NON_COMPLIANT: short is a basic numeric type
44
+ signed short s2 = 1 ; // NON_COMPLIANT: use typedef int16_t in stdint
45
+ unsigned short s3 = 1 ; // NON_COMPLIANT: use typedef uint16_t in stdint
46
+ INT16 s4 = 1 ; // COMPLIANT: typedef used instead
47
+
48
+ int i1 = 1 ; // NON_COMPLIANT: int is a basic numeric type
49
+ signed int i2 = 1 ; // NON_COMPLIANT: use typedef int32_t in stdint
50
+ unsigned int i3 = 1 ; // NON_COMPLIANT: use typedef uint32_t in stdint
51
+ INT32 s4 = 1 ; // COMPLIANT: typedef used instead
52
+
53
+ long l1 = 1 ; // NON_COMPLIANT: int is a basic numeric type
54
+ signed long l2 = 1 ; // NON_COMPLIANT: use typedef int64_t in stdint
55
+ unsigned long l3 = 1 ; // NON_COMPLIANT: use typedef uint64_t in stdint
56
+ INT64 s4 = 1 ; // COMPLIANT: typedef used instead
57
+
58
+ long long l1 = 1 ; // NON_COMPLIANT: int is a basic numeric type
59
+ signed long long l2 = 1 ; // NON_COMPLIANT: use typedef int128_t in stdint
60
+ unsigned long long l3 = 1 ; // NON_COMPLIANT: use typedef uint128_t in stdint
61
+ INT128 s4 = 1 ; // COMPLIANT: typedef used instead
62
+
63
+ float f1 = 1 ; // NON_COMPLIANT: float is a basic numeric type, use a typedef
64
+ FLOAT32 f2 = 1 ; // COMPLIANT: typedef used instead
65
+
66
+ double d1 = 1 ; // NON_COMPLIANT: int is a basic numeric type
67
+ FLOAT64 d2 = 1 ; // COMPLIANT: typedef used instead
68
+
69
+ long double ld1 = 1 ; // NON_COMPLIANT: int is a basic numeric type
70
+ FLOAT128 ld2 = 1 ; // COMPLIANT: typedef used instead
71
+ }
0 commit comments