xref: /netbsd-src/tests/usr.bin/xlint/lint1/msg_005.c (revision 1772ff8ac7d52f07d82835d057d280d38fa7819c)
1 /*	$NetBSD: msg_005.c,v 1.6 2024/05/04 06:52:17 rillig Exp $	*/
2 # 3 "msg_005.c"
3 
4 // Test for message: modifying typedef with '%s'; only qualifiers allowed [5]
5 
6 typedef char char_alias;
7 typedef signed char schar_alias;
8 typedef unsigned char uchar_alias;
9 typedef short short_alias;
10 typedef unsigned short ushort_alias;
11 typedef int int_alias;
12 typedef unsigned int uint_alias;
13 typedef long long_alias;
14 typedef unsigned long ulong_alias;
15 typedef long long llong_alias;
16 typedef unsigned long long ullong_alias;
17 typedef float float_alias;
18 typedef double double_alias;
19 typedef long double ldouble_alias;
20 typedef float _Complex fcomplex_alias;
21 typedef double _Complex dcomplex_alias;
22 typedef long double _Complex lcomplex_alias;
23 
24 /* expect+1: warning: modifying typedef with 'signed'; only qualifiers allowed [5] */
25 typedef char_alias signed err_s_char;
26 /* expect+1: warning: modifying typedef with 'unsigned'; only qualifiers allowed [5] */
27 typedef char_alias unsigned err_u_char;
28 /* expect+1: error: illegal type combination [4] */
29 typedef schar_alias signed err_s_schar;
30 /* expect+1: error: illegal type combination [4] */
31 typedef schar_alias unsigned err_u_schar;
32 /* expect+1: error: illegal type combination [4] */
33 typedef uchar_alias signed err_s_uchar;
34 /* expect+1: error: illegal type combination [4] */
35 typedef uchar_alias unsigned err_u_uchar;
36 /* expect+1: warning: modifying typedef with 'signed'; only qualifiers allowed [5] */
37 typedef short_alias signed err_s_short;
38 /* expect+1: warning: modifying typedef with 'unsigned'; only qualifiers allowed [5] */
39 typedef short_alias unsigned err_u_short;
40 /* expect+1: error: illegal type combination [4] */
41 typedef ushort_alias signed err_s_ushort;
42 /* expect+1: error: illegal type combination [4] */
43 typedef ushort_alias unsigned err_u_ushort;
44 /* expect+1: warning: modifying typedef with 'signed'; only qualifiers allowed [5] */
45 typedef int_alias signed err_s_int;
46 /* expect+1: warning: modifying typedef with 'unsigned'; only qualifiers allowed [5] */
47 typedef int_alias unsigned err_u_int;
48 /* expect+1: error: illegal type combination [4] */
49 typedef uint_alias signed err_s_uint;
50 /* expect+1: error: illegal type combination [4] */
51 typedef uint_alias unsigned err_u_uint;
52 /* expect+1: warning: modifying typedef with 'signed'; only qualifiers allowed [5] */
53 typedef long_alias signed err_s_long;
54 /* expect+1: warning: modifying typedef with 'unsigned'; only qualifiers allowed [5] */
55 typedef long_alias unsigned err_u_long;
56 /* expect+1: error: illegal type combination [4] */
57 typedef ulong_alias signed err_s_ulong;
58 /* expect+1: error: illegal type combination [4] */
59 typedef ulong_alias unsigned err_u_ulong;
60 /* expect+1: warning: modifying typedef with 'signed'; only qualifiers allowed [5] */
61 typedef llong_alias signed err_s_llong;
62 /* expect+1: warning: modifying typedef with 'unsigned'; only qualifiers allowed [5] */
63 typedef llong_alias unsigned err_u_llong;
64 /* expect+1: error: illegal type combination [4] */
65 typedef ullong_alias signed err_s_ullong;
66 /* expect+1: error: illegal type combination [4] */
67 typedef ullong_alias unsigned err_u_ullong;
68 /* expect+1: error: illegal type combination [4] */
69 typedef float_alias signed err_s_float;
70 /* expect+1: error: illegal type combination [4] */
71 typedef float_alias unsigned err_u_float;
72 /* expect+1: error: illegal type combination [4] */
73 typedef double_alias signed err_s_double;
74 /* expect+1: error: illegal type combination [4] */
75 typedef double_alias unsigned err_u_double;
76 /* expect+1: error: illegal type combination [4] */
77 typedef ldouble_alias signed err_s_ldouble;
78 /* expect+1: error: illegal type combination [4] */
79 typedef ldouble_alias unsigned err_u_ldouble;
80 /* expect+1: error: illegal type combination [4] */
81 typedef fcomplex_alias signed err_s_fcomplex;
82 /* expect+1: error: illegal type combination [4] */
83 typedef fcomplex_alias unsigned err_u_fcomplex;
84 /* expect+1: error: illegal type combination [4] */
85 typedef dcomplex_alias signed err_s_dcomplex;
86 /* expect+1: error: illegal type combination [4] */
87 typedef dcomplex_alias unsigned err_u_dcomplex;
88 /* expect+1: error: illegal type combination [4] */
89 typedef lcomplex_alias signed err_s_lcomplex;
90 /* expect+1: error: illegal type combination [4] */
91 typedef lcomplex_alias unsigned err_u_lcomplex;
92 
93 /* expect+1: warning: modifying typedef with 'short'; only qualifiers allowed [5] */
94 typedef int_alias short err_short_int;
95 /* expect+1: error: illegal type combination [4] */
96 typedef long_alias short err_short_long;
97 /* expect+1: error: illegal type combination [4] */
98 typedef float_alias short err_short_float;
99 
100 /* expect+1: error: illegal type combination [4] */
101 typedef char_alias long err_l_char;
102 /* expect+1: error: illegal type combination [4] */
103 typedef schar_alias long err_l_schar;
104 /* expect+1: error: illegal type combination [4] */
105 typedef uchar_alias long err_l_uchar;
106 /* expect+1: error: illegal type combination [4] */
107 typedef short_alias long err_l_short;
108 /* expect+1: error: illegal type combination [4] */
109 typedef ushort_alias long err_l_ushort;
110 /* expect+1: warning: modifying typedef with 'long'; only qualifiers allowed [5] */
111 typedef int_alias long err_l_int;
112 /* expect+1: warning: modifying typedef with 'long'; only qualifiers allowed [5] */
113 typedef uint_alias long err_l_uint;
114 /* expect+1: warning: modifying typedef with 'long'; only qualifiers allowed [5] */
115 typedef long_alias long err_l_long;
116 /* expect+1: warning: modifying typedef with 'long'; only qualifiers allowed [5] */
117 typedef ulong_alias long err_l_ulong;
118 /* expect+1: error: illegal type combination [4] */
119 typedef llong_alias long err_l_llong;
120 /* expect+1: error: illegal type combination [4] */
121 typedef ullong_alias long err_l_ullong;
122 /* expect+1: warning: modifying typedef with 'long'; only qualifiers allowed [5] */
123 typedef float_alias long err_l_float;
124 /* expect+1: warning: modifying typedef with 'long'; only qualifiers allowed [5] */
125 typedef double_alias long err_l_double;
126 /* expect+1: error: illegal type combination [4] */
127 typedef ldouble_alias long err_l_ldouble;
128 /* expect+1: error: illegal type combination [4] */
129 typedef fcomplex_alias long err_l_fcomplex;
130 /* expect+1: warning: modifying typedef with 'long'; only qualifiers allowed [5] */
131 typedef dcomplex_alias long err_l_dcomplex;
132 /* expect+1: error: illegal type combination [4] */
133 typedef lcomplex_alias long err_l_lcomplex;
134 
135 
136 /*
137  * If the type qualifier comes before the type name, which would be the
138  * natural order, the type name is interpreted as a new name, not as the one
139  * referring to the typedef.  This makes the above type modifications even
140  * more unlikely to be accidentally seen in practice.
141  */
142 /* expect+1: error: syntax error 'prefix_long_number' [249] */
143 typedef long int_alias prefix_long_number;
144 
145 /* Type qualifiers are OK. */
146 typedef int_alias const const_int;
147