| @@ -1,413 +1,412 @@ | | | @@ -1,413 +1,412 @@ |
1 | /* $NetBSD: externs1.h,v 1.199 2023/07/28 21:50:03 rillig Exp $ */ | | 1 | /* $NetBSD: externs1.h,v 1.200 2023/07/29 06:44:44 rillig Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 1994, 1995 Jochen Pohl | | 4 | * Copyright (c) 1994, 1995 Jochen Pohl |
5 | * All Rights Reserved. | | 5 | * All Rights Reserved. |
6 | * | | 6 | * |
7 | * Redistribution and use in source and binary forms, with or without | | 7 | * Redistribution and use in source and binary forms, with or without |
8 | * modification, are permitted provided that the following conditions | | 8 | * modification, are permitted provided that the following conditions |
9 | * are met: | | 9 | * are met: |
10 | * 1. Redistributions of source code must retain the above copyright | | 10 | * 1. Redistributions of source code must retain the above copyright |
11 | * notice, this list of conditions and the following disclaimer. | | 11 | * notice, this list of conditions and the following disclaimer. |
12 | * 2. Redistributions in binary form must reproduce the above copyright | | 12 | * 2. Redistributions in binary form must reproduce the above copyright |
13 | * notice, this list of conditions and the following disclaimer in the | | 13 | * notice, this list of conditions and the following disclaimer in the |
14 | * documentation and/or other materials provided with the distribution. | | 14 | * documentation and/or other materials provided with the distribution. |
15 | * 3. All advertising materials mentioning features or use of this software | | 15 | * 3. All advertising materials mentioning features or use of this software |
16 | * must display the following acknowledgement: | | 16 | * must display the following acknowledgement: |
17 | * This product includes software developed by Jochen Pohl for | | 17 | * This product includes software developed by Jochen Pohl for |
18 | * The NetBSD Project. | | 18 | * The NetBSD Project. |
19 | * 4. The name of the author may not be used to endorse or promote products | | 19 | * 4. The name of the author may not be used to endorse or promote products |
20 | * derived from this software without specific prior written permission. | | 20 | * derived from this software without specific prior written permission. |
21 | * | | 21 | * |
22 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | | 22 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
23 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | | 23 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
24 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | | 24 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
25 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | | 25 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
26 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | | 26 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
27 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | | 27 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
28 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | | 28 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
29 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | | 29 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
30 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | | 30 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
31 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | | 31 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
32 | */ | | 32 | */ |
33 | | | 33 | |
34 | #include <signal.h> | | 34 | #include <signal.h> |
35 | | | 35 | |
36 | /* | | 36 | /* |
37 | * main1.c | | 37 | * main1.c |
38 | */ | | 38 | */ |
39 | extern int aflag; | | 39 | extern int aflag; |
40 | extern bool bflag; | | 40 | extern bool bflag; |
41 | extern bool cflag; | | 41 | extern bool cflag; |
42 | extern bool eflag; | | 42 | extern bool eflag; |
43 | extern bool Fflag; | | 43 | extern bool Fflag; |
44 | extern bool hflag; | | 44 | extern bool hflag; |
45 | extern bool pflag; | | 45 | extern bool pflag; |
46 | extern bool rflag; | | 46 | extern bool rflag; |
47 | extern bool uflag; | | 47 | extern bool uflag; |
48 | extern bool vflag; | | 48 | extern bool vflag; |
49 | extern bool yflag; | | 49 | extern bool yflag; |
50 | extern bool wflag; | | 50 | extern bool wflag; |
51 | extern bool zflag; | | 51 | extern bool zflag; |
52 | extern bool Tflag; | | 52 | extern bool Tflag; |
53 | extern bool Pflag; | | 53 | extern bool Pflag; |
54 | | | 54 | |
55 | extern bool allow_trad; | | 55 | extern bool allow_trad; |
56 | extern bool allow_c90; | | 56 | extern bool allow_c90; |
57 | extern bool allow_c99; | | 57 | extern bool allow_c99; |
58 | extern bool allow_c11; | | 58 | extern bool allow_c11; |
59 | extern bool allow_c23; | | 59 | extern bool allow_c23; |
60 | extern bool allow_gcc; | | 60 | extern bool allow_gcc; |
61 | | | 61 | |
62 | extern sig_atomic_t fpe; | | 62 | extern sig_atomic_t fpe; |
63 | | | 63 | |
64 | void norecover(void); | | 64 | void norecover(void); |
65 | | | 65 | |
66 | /* | | 66 | /* |
67 | * cgram.y | | 67 | * cgram.y |
68 | */ | | 68 | */ |
69 | extern int block_level; | | 69 | extern int block_level; |
70 | extern size_t mem_block_level; | | 70 | extern size_t mem_block_level; |
71 | extern int yydebug; | | 71 | extern int yydebug; |
72 | | | 72 | |
73 | int yyerror(const char *); | | 73 | int yyerror(const char *); |
74 | int yyparse(void); | | 74 | int yyparse(void); |
75 | | | 75 | |
76 | /* | | 76 | /* |
77 | * scan.l | | 77 | * scan.l |
78 | */ | | 78 | */ |
79 | extern bool in_gcc_attribute; | | 79 | extern bool in_gcc_attribute; |
80 | extern pos_t curr_pos; | | 80 | extern pos_t curr_pos; |
81 | extern pos_t csrc_pos; | | 81 | extern pos_t csrc_pos; |
82 | extern bool in_system_header; | | 82 | extern bool in_system_header; |
83 | extern symt_t symtyp; | | 83 | extern symt_t symtyp; |
84 | extern FILE *yyin; | | 84 | extern FILE *yyin; |
85 | | | 85 | |
86 | void initscan(void); | | 86 | void initscan(void); |
87 | int64_t convert_integer(int64_t, tspec_t, unsigned int); | | 87 | int64_t convert_integer(int64_t, tspec_t, unsigned int); |
88 | void clear_warn_flags(void); | | 88 | void clear_warn_flags(void); |
89 | sym_t *getsym(sbuf_t *); | | 89 | sym_t *getsym(sbuf_t *); |
90 | void clean_up_after_error(void); | | 90 | void clean_up_after_error(void); |
91 | sym_t *pushdown(const sym_t *); | | 91 | sym_t *pushdown(const sym_t *); |
92 | sym_t *mktempsym(type_t *); | | 92 | sym_t *mktempsym(type_t *); |
93 | void rmsym(sym_t *); | | 93 | void rmsym(sym_t *); |
94 | void symtab_remove_level(sym_t *); | | 94 | void symtab_remove_level(sym_t *); |
95 | void inssym(int, sym_t *); | | 95 | void inssym(int, sym_t *); |
96 | void freeyyv(void *, int); | | 96 | void freeyyv(void *, int); |
97 | int yylex(void); | | 97 | int yylex(void); |
98 | | | 98 | |
99 | /* | | 99 | /* |
100 | * mem1.c | | 100 | * mem1.c |
101 | */ | | 101 | */ |
102 | const char *record_filename(const char *, size_t); | | 102 | const char *record_filename(const char *, size_t); |
103 | int get_filename_id(const char *); | | 103 | int get_filename_id(const char *); |
104 | void add_directory_replacement(char *); | | 104 | void add_directory_replacement(char *); |
105 | const char *transform_filename(const char *, size_t); | | 105 | const char *transform_filename(const char *, size_t); |
106 | | | 106 | |
107 | #ifdef DEBUG_MEM | | 107 | #ifdef DEBUG_MEM |
108 | void *block_zero_alloc(size_t, const char *); | | 108 | void *block_zero_alloc(size_t, const char *); |
109 | void *level_zero_alloc(size_t, size_t, const char *); | | 109 | void *level_zero_alloc(size_t, size_t, const char *); |
110 | #else | | 110 | #else |
111 | void *block_zero_alloc(size_t); | | 111 | void *block_zero_alloc(size_t); |
112 | void *level_zero_alloc(size_t, size_t); | | 112 | void *level_zero_alloc(size_t, size_t); |
113 | #define block_zero_alloc(size, descr) (block_zero_alloc)(size) | | 113 | #define block_zero_alloc(size, descr) (block_zero_alloc)(size) |
114 | #define level_zero_alloc(level, size, descr) (level_zero_alloc)(level, size) | | 114 | #define level_zero_alloc(level, size, descr) (level_zero_alloc)(level, size) |
115 | #endif | | 115 | #endif |
116 | void level_free_all(size_t); | | 116 | void level_free_all(size_t); |
117 | | | 117 | |
118 | #ifdef DEBUG_MEM | | 118 | #ifdef DEBUG_MEM |
119 | void *expr_zero_alloc(size_t, const char *); | | 119 | void *expr_zero_alloc(size_t, const char *); |
120 | #else | | 120 | #else |
121 | void *expr_zero_alloc(size_t); | | 121 | void *expr_zero_alloc(size_t); |
122 | #define expr_zero_alloc(size, descr) (expr_zero_alloc)(size) | | 122 | #define expr_zero_alloc(size, descr) (expr_zero_alloc)(size) |
123 | #endif | | 123 | #endif |
124 | tnode_t *expr_alloc_tnode(void); | | 124 | tnode_t *expr_alloc_tnode(void); |
125 | void expr_free_all(void); | | 125 | void expr_free_all(void); |
126 | memory_pool expr_save_memory(void); | | 126 | memory_pool expr_save_memory(void); |
127 | void expr_restore_memory(memory_pool); | | 127 | void expr_restore_memory(memory_pool); |
128 | | | 128 | |
129 | /* | | 129 | /* |
130 | * debug.c | | 130 | * debug.c |
131 | */ | | 131 | */ |
132 | | | 132 | |
133 | #ifdef DEBUG | | 133 | #ifdef DEBUG |
134 | const char *decl_level_kind_name(decl_level_kind); | | 134 | const char *decl_level_kind_name(decl_level_kind); |
135 | const char *scl_name(scl_t); | | 135 | const char *scl_name(scl_t); |
136 | const char *symt_name(symt_t); | | 136 | const char *symt_name(symt_t); |
137 | const char *type_qualifiers_string(type_qualifiers); | | 137 | const char *type_qualifiers_string(type_qualifiers); |
138 | const char *function_specifier_name(function_specifier); | | 138 | const char *function_specifier_name(function_specifier); |
139 | void debug_dcs(bool); | | 139 | void debug_dcs(bool); |
140 | void debug_node(const tnode_t *); | | 140 | void debug_node(const tnode_t *); |
141 | void debug_type(const type_t *); | | 141 | void debug_type(const type_t *); |
142 | void debug_sym(const char *, const sym_t *, const char *); | | 142 | void debug_sym(const char *, const sym_t *, const char *); |
143 | void debug_symtab(void); | | 143 | void debug_symtab(void); |
144 | void debug_printf(const char *fmt, ...) __printflike(1, 2); | | 144 | void debug_printf(const char *fmt, ...) __printflike(1, 2); |
145 | void debug_print_indent(void); | | 145 | void debug_print_indent(void); |
146 | void debug_indent_inc(void); | | 146 | void debug_indent_inc(void); |
147 | void debug_indent_dec(void); | | 147 | void debug_indent_dec(void); |
148 | void debug_enter_func(const char *); | | 148 | void debug_enter_func(const char *); |
149 | void debug_step(const char *fmt, ...) __printflike(1, 2); | | 149 | void debug_step(const char *fmt, ...) __printflike(1, 2); |
150 | void debug_leave_func(const char *); | | 150 | void debug_leave_func(const char *); |
151 | #define debug_enter() debug_enter_func(__func__) | | 151 | #define debug_enter() debug_enter_func(__func__) |
152 | #define debug_leave() debug_leave_func(__func__) | | 152 | #define debug_leave() debug_leave_func(__func__) |
153 | #else | | 153 | #else |
154 | #define debug_noop() do { } while (false) | | 154 | #define debug_noop() do { } while (false) |
155 | #define debug_dcs(all) debug_noop() | | 155 | #define debug_dcs(all) debug_noop() |
156 | #define debug_sym(p, sym, s) debug_noop() | | 156 | #define debug_sym(p, sym, s) debug_noop() |
157 | #define debug_symtab() debug_noop() | | 157 | #define debug_symtab() debug_noop() |
158 | #define debug_node(tn) debug_noop() | | 158 | #define debug_node(tn) debug_noop() |
159 | #define debug_type(tp) debug_noop() | | 159 | #define debug_type(tp) debug_noop() |
160 | #define debug_printf(...) debug_noop() | | 160 | #define debug_printf(...) debug_noop() |
161 | #define debug_print_indent() debug_noop() | | 161 | #define debug_print_indent() debug_noop() |
162 | #define debug_indent_inc() debug_noop() | | 162 | #define debug_indent_inc() debug_noop() |
163 | #define debug_indent_dec() debug_noop() | | 163 | #define debug_indent_dec() debug_noop() |
164 | #define debug_enter() debug_noop() | | 164 | #define debug_enter() debug_noop() |
165 | #define debug_step(...) debug_noop() | | 165 | #define debug_step(...) debug_noop() |
166 | #define debug_leave() debug_noop() | | 166 | #define debug_leave() debug_noop() |
167 | #endif | | 167 | #endif |
168 | | | 168 | |
169 | /* | | 169 | /* |
170 | * err.c | | 170 | * err.c |
171 | */ | | 171 | */ |
172 | extern bool seen_error; | | 172 | extern bool seen_error; |
173 | extern bool seen_warning; | | 173 | extern bool seen_warning; |
174 | extern int sytxerr; | | 174 | extern int sytxerr; |
175 | extern bool any_query_enabled; | | 175 | extern bool any_query_enabled; |
176 | | | 176 | |
177 | void msglist(void); | | 177 | void msglist(void); |
178 | void error_at(int, const pos_t *, ...); | | 178 | void error_at(int, const pos_t *, ...); |
179 | void warning_at(int, const pos_t *, ...); | | 179 | void warning_at(int, const pos_t *, ...); |
180 | void message_at(int, const pos_t *, ...); | | 180 | void message_at(int, const pos_t *, ...); |
181 | void error(int, ...); | | 181 | void error(int, ...); |
182 | void warning(int, ...); | | 182 | void warning(int, ...); |
183 | bool gnuism(int, ...); | | 183 | bool gnuism(int, ...); |
184 | void c99ism(int, ...); | | 184 | void c99ism(int, ...); |
185 | void c11ism(int, ...); | | 185 | void c11ism(int, ...); |
186 | void c23ism(int, ...); | | 186 | void c23ism(int, ...); |
187 | void assert_failed(const char *, int, const char *, const char *) | | 187 | void assert_failed(const char *, int, const char *, const char *) __dead; |
188 | __attribute__((__noreturn__)); | | | |
189 | void update_location(const char *, int, bool, bool); | | 188 | void update_location(const char *, int, bool, bool); |
190 | void suppress_messages(const char *); | | 189 | void suppress_messages(const char *); |
191 | | | 190 | |
192 | void query_message(int, ...); | | 191 | void query_message(int, ...); |
193 | void enable_queries(const char *); | | 192 | void enable_queries(const char *); |
194 | | | 193 | |
195 | /* | | 194 | /* |
196 | * decl.c | | 195 | * decl.c |
197 | */ | | 196 | */ |
198 | extern decl_level *dcs; | | 197 | extern decl_level *dcs; |
199 | extern const char unnamed[]; | | 198 | extern const char unnamed[]; |
200 | extern int enumval; | | 199 | extern int enumval; |
201 | | | 200 | |
202 | void initdecl(void); | | 201 | void initdecl(void); |
203 | type_t *gettyp(tspec_t); | | 202 | type_t *gettyp(tspec_t); |
204 | type_t *block_dup_type(const type_t *); | | 203 | type_t *block_dup_type(const type_t *); |
205 | type_t *expr_dup_type(const type_t *); | | 204 | type_t *expr_dup_type(const type_t *); |
206 | type_t *expr_unqualified_type(const type_t *); | | 205 | type_t *expr_unqualified_type(const type_t *); |
207 | bool is_incomplete(const type_t *); | | 206 | bool is_incomplete(const type_t *); |
208 | void dcs_add_function_specifier(function_specifier); | | 207 | void dcs_add_function_specifier(function_specifier); |
209 | void dcs_add_storage_class(scl_t); | | 208 | void dcs_add_storage_class(scl_t); |
210 | void dcs_add_type(type_t *); | | 209 | void dcs_add_type(type_t *); |
211 | void dcs_add_qualifiers(type_qualifiers); | | 210 | void dcs_add_qualifiers(type_qualifiers); |
212 | void dcs_add_packed(void); | | 211 | void dcs_add_packed(void); |
213 | void dcs_set_used(void); | | 212 | void dcs_set_used(void); |
214 | void begin_declaration_level(decl_level_kind); | | 213 | void begin_declaration_level(decl_level_kind); |
215 | void end_declaration_level(void); | | 214 | void end_declaration_level(void); |
216 | void dcs_set_asm(void); | | 215 | void dcs_set_asm(void); |
217 | void dcs_begin_type(void); | | 216 | void dcs_begin_type(void); |
218 | void dcs_end_type(void); | | 217 | void dcs_end_type(void); |
219 | int length_in_bits(const type_t *, const char *); | | 218 | int length_in_bits(const type_t *, const char *); |
220 | unsigned int alignment_in_bits(const type_t *); | | 219 | unsigned int alignment_in_bits(const type_t *); |
221 | sym_t *concat_symbols(sym_t *, sym_t *); | | 220 | sym_t *concat_symbols(sym_t *, sym_t *); |
222 | void check_type(sym_t *); | | 221 | void check_type(sym_t *); |
223 | sym_t *declare_unnamed_member(void); | | 222 | sym_t *declare_unnamed_member(void); |
224 | sym_t *declare_member(sym_t *); | | 223 | sym_t *declare_member(sym_t *); |
225 | sym_t *set_bit_field_width(sym_t *, int); | | 224 | sym_t *set_bit_field_width(sym_t *, int); |
226 | void add_type_qualifiers(type_qualifiers *, type_qualifiers); | | 225 | void add_type_qualifiers(type_qualifiers *, type_qualifiers); |
227 | qual_ptr *append_qualified_pointer(qual_ptr *, qual_ptr *); | | 226 | qual_ptr *append_qualified_pointer(qual_ptr *, qual_ptr *); |
228 | sym_t *add_pointer(sym_t *, qual_ptr *); | | 227 | sym_t *add_pointer(sym_t *, qual_ptr *); |
229 | sym_t *add_array(sym_t *, bool, int); | | 228 | sym_t *add_array(sym_t *, bool, int); |
230 | sym_t *add_function(sym_t *, struct parameter_list); | | 229 | sym_t *add_function(sym_t *, struct parameter_list); |
231 | void check_extern_declaration(const sym_t *); | | 230 | void check_extern_declaration(const sym_t *); |
232 | void check_function_definition(sym_t *, bool); | | 231 | void check_function_definition(sym_t *, bool); |
233 | sym_t *declarator_name(sym_t *); | | 232 | sym_t *declarator_name(sym_t *); |
234 | sym_t *old_style_function_parameter_name(sym_t *); | | 233 | sym_t *old_style_function_parameter_name(sym_t *); |
235 | type_t *make_tag_type(sym_t *, tspec_t, bool, bool); | | 234 | type_t *make_tag_type(sym_t *, tspec_t, bool, bool); |
236 | const char *storage_class_name(scl_t); | | 235 | const char *storage_class_name(scl_t); |
237 | type_t *complete_struct_or_union(sym_t *); | | 236 | type_t *complete_struct_or_union(sym_t *); |
238 | type_t *complete_enum(sym_t *); | | 237 | type_t *complete_enum(sym_t *); |
239 | sym_t *enumeration_constant(sym_t *, int, bool); | | 238 | sym_t *enumeration_constant(sym_t *, int, bool); |
240 | void declare(sym_t *, bool, sbuf_t *); | | 239 | void declare(sym_t *, bool, sbuf_t *); |
241 | void copy_usage_info(sym_t *, sym_t *); | | 240 | void copy_usage_info(sym_t *, sym_t *); |
242 | bool check_redeclaration(sym_t *, bool *); | | 241 | bool check_redeclaration(sym_t *, bool *); |
243 | bool pointer_types_are_compatible(const type_t *, const type_t *, bool); | | 242 | bool pointer_types_are_compatible(const type_t *, const type_t *, bool); |
244 | bool types_compatible(const type_t *, const type_t *, bool, bool, bool *); | | 243 | bool types_compatible(const type_t *, const type_t *, bool, bool, bool *); |
245 | void complete_type(sym_t *, sym_t *); | | 244 | void complete_type(sym_t *, sym_t *); |
246 | sym_t *declare_argument(sym_t *, bool); | | 245 | sym_t *declare_argument(sym_t *, bool); |
247 | void check_func_lint_directives(void); | | 246 | void check_func_lint_directives(void); |
248 | void check_func_old_style_arguments(void); | | 247 | void check_func_old_style_arguments(void); |
249 | | | 248 | |
250 | void declare_local(sym_t *, bool); | | 249 | void declare_local(sym_t *, bool); |
251 | sym_t *abstract_name(void); | | 250 | sym_t *abstract_name(void); |
252 | void global_clean_up(void); | | 251 | void global_clean_up(void); |
253 | sym_t *declare_abstract_type(sym_t *); | | 252 | sym_t *declare_abstract_type(sym_t *); |
254 | void check_size(sym_t *); | | 253 | void check_size(sym_t *); |
255 | void mark_as_set(sym_t *); | | 254 | void mark_as_set(sym_t *); |
256 | void mark_as_used(sym_t *, bool, bool); | | 255 | void mark_as_used(sym_t *, bool, bool); |
257 | void check_usage(decl_level *); | | 256 | void check_usage(decl_level *); |
258 | void check_usage_sym(bool, sym_t *); | | 257 | void check_usage_sym(bool, sym_t *); |
259 | void check_global_symbols(void); | | 258 | void check_global_symbols(void); |
260 | void print_previous_declaration(const sym_t *); | | 259 | void print_previous_declaration(const sym_t *); |
261 | int to_int_constant(tnode_t *, bool); | | 260 | int to_int_constant(tnode_t *, bool); |
262 | | | 261 | |
263 | /* | | 262 | /* |
264 | * tree.c | | 263 | * tree.c |
265 | */ | | 264 | */ |
266 | const tnode_t *before_conversion(const tnode_t *); | | 265 | const tnode_t *before_conversion(const tnode_t *); |
267 | type_t *block_derive_type(type_t *, tspec_t); | | 266 | type_t *block_derive_type(type_t *, tspec_t); |
268 | type_t *expr_derive_type(type_t *, tspec_t); | | 267 | type_t *expr_derive_type(type_t *, tspec_t); |
269 | bool is_compiler_builtin(const char *); | | 268 | bool is_compiler_builtin(const char *); |
270 | tnode_t *build_constant(type_t *, val_t *); | | 269 | tnode_t *build_constant(type_t *, val_t *); |
271 | tnode_t *build_name(sym_t *, bool); | | 270 | tnode_t *build_name(sym_t *, bool); |
272 | tnode_t *build_string(strg_t *); | | 271 | tnode_t *build_string(strg_t *); |
273 | tnode_t *build_generic_selection(const tnode_t *, | | 272 | tnode_t *build_generic_selection(const tnode_t *, |
274 | struct generic_association *); | | 273 | struct generic_association *); |
275 | | | 274 | |
276 | tnode_t *build_binary(tnode_t *, op_t, bool, tnode_t *); | | 275 | tnode_t *build_binary(tnode_t *, op_t, bool, tnode_t *); |
277 | tnode_t *build_unary(op_t, bool, tnode_t *); | | 276 | tnode_t *build_unary(op_t, bool, tnode_t *); |
278 | tnode_t *build_member_access(tnode_t *, op_t, bool, sbuf_t *); | | 277 | tnode_t *build_member_access(tnode_t *, op_t, bool, sbuf_t *); |
279 | tnode_t *cconv(tnode_t *); | | 278 | tnode_t *cconv(tnode_t *); |
280 | bool is_typeok_bool_compares_with_zero(const tnode_t *); | | 279 | bool is_typeok_bool_compares_with_zero(const tnode_t *); |
281 | bool typeok(op_t, int, const tnode_t *, const tnode_t *); | | 280 | bool typeok(op_t, int, const tnode_t *, const tnode_t *); |
282 | tnode_t *promote(op_t, bool, tnode_t *); | | 281 | tnode_t *promote(op_t, bool, tnode_t *); |
283 | tnode_t *convert(op_t, int, type_t *, tnode_t *); | | 282 | tnode_t *convert(op_t, int, type_t *, tnode_t *); |
284 | void convert_constant(op_t, int, const type_t *, val_t *, val_t *); | | 283 | void convert_constant(op_t, int, const type_t *, val_t *, val_t *); |
285 | tnode_t *build_sizeof(const type_t *); | | 284 | tnode_t *build_sizeof(const type_t *); |
286 | tnode_t *build_offsetof(const type_t *, const sym_t *); | | 285 | tnode_t *build_offsetof(const type_t *, const sym_t *); |
287 | tnode_t *build_alignof(const type_t *); | | 286 | tnode_t *build_alignof(const type_t *); |
288 | tnode_t *cast(tnode_t *, type_t *); | | 287 | tnode_t *cast(tnode_t *, type_t *); |
289 | tnode_t *build_function_argument(tnode_t *, tnode_t *); | | 288 | tnode_t *build_function_argument(tnode_t *, tnode_t *); |
290 | tnode_t *build_function_call(tnode_t *, bool, tnode_t *); | | 289 | tnode_t *build_function_call(tnode_t *, bool, tnode_t *); |
291 | val_t *integer_constant(tnode_t *, bool); | | 290 | val_t *integer_constant(tnode_t *, bool); |
292 | void expr(tnode_t *, bool, bool, bool, bool); | | 291 | void expr(tnode_t *, bool, bool, bool, bool); |
293 | void check_expr_misc(const tnode_t *, bool, bool, bool, bool, bool, bool); | | 292 | void check_expr_misc(const tnode_t *, bool, bool, bool, bool, bool, bool); |
294 | bool constant_addr(const tnode_t *, const sym_t **, ptrdiff_t *); | | 293 | bool constant_addr(const tnode_t *, const sym_t **, ptrdiff_t *); |
295 | strg_t *cat_strings(strg_t *, strg_t *); | | 294 | strg_t *cat_strings(strg_t *, strg_t *); |
296 | unsigned int type_size_in_bits(const type_t *); | | 295 | unsigned int type_size_in_bits(const type_t *); |
297 | sym_t *find_member(const struct_or_union *, const char *); | | 296 | sym_t *find_member(const struct_or_union *, const char *); |
298 | | | 297 | |
299 | void begin_statement_expr(void); | | 298 | void begin_statement_expr(void); |
300 | void do_statement_expr(tnode_t *); | | 299 | void do_statement_expr(tnode_t *); |
301 | tnode_t *end_statement_expr(void); | | 300 | tnode_t *end_statement_expr(void); |
302 | bool in_statement_expr(void); | | 301 | bool in_statement_expr(void); |
303 | | | 302 | |
304 | /* | | 303 | /* |
305 | * func.c | | 304 | * func.c |
306 | */ | | 305 | */ |
307 | extern sym_t *funcsym; | | 306 | extern sym_t *funcsym; |
308 | extern bool reached; | | 307 | extern bool reached; |
309 | extern bool warn_about_unreachable; | | 308 | extern bool warn_about_unreachable; |
310 | extern bool suppress_fallthrough; | | 309 | extern bool suppress_fallthrough; |
311 | extern int nargusg; | | 310 | extern int nargusg; |
312 | extern pos_t argsused_pos; | | 311 | extern pos_t argsused_pos; |
313 | extern int nvararg; | | 312 | extern int nvararg; |
314 | extern pos_t vapos; | | 313 | extern pos_t vapos; |
315 | extern int printflike_argnum; | | 314 | extern int printflike_argnum; |
316 | extern pos_t printflike_pos; | | 315 | extern pos_t printflike_pos; |
317 | extern int scanflike_argnum; | | 316 | extern int scanflike_argnum; |
318 | extern pos_t scanflike_pos; | | 317 | extern pos_t scanflike_pos; |
319 | extern bool suppress_constcond; | | 318 | extern bool suppress_constcond; |
320 | extern bool llibflg; | | 319 | extern bool llibflg; |
321 | extern int lwarn; | | 320 | extern int lwarn; |
322 | extern bool suppress_bitfieldtype; | | 321 | extern bool suppress_bitfieldtype; |
323 | extern bool plibflg; | | 322 | extern bool plibflg; |
324 | extern bool suppress_longlong; | | 323 | extern bool suppress_longlong; |
325 | | | 324 | |
326 | void begin_control_statement(control_statement_kind); | | 325 | void begin_control_statement(control_statement_kind); |
327 | void end_control_statement(control_statement_kind); | | 326 | void end_control_statement(control_statement_kind); |
328 | void check_statement_reachable(void); | | 327 | void check_statement_reachable(void); |
329 | void begin_function(sym_t *); | | 328 | void begin_function(sym_t *); |
330 | void end_function(void); | | 329 | void end_function(void); |
331 | void named_label(sym_t *); | | 330 | void named_label(sym_t *); |
332 | void case_label(tnode_t *); | | 331 | void case_label(tnode_t *); |
333 | void default_label(void); | | 332 | void default_label(void); |
334 | void stmt_if_expr(tnode_t *); | | 333 | void stmt_if_expr(tnode_t *); |
335 | void stmt_if_then_stmt(void); | | 334 | void stmt_if_then_stmt(void); |
336 | void stmt_if_else_stmt(bool); | | 335 | void stmt_if_else_stmt(bool); |
337 | void stmt_switch_expr(tnode_t *); | | 336 | void stmt_switch_expr(tnode_t *); |
338 | void stmt_switch_expr_stmt(void); | | 337 | void stmt_switch_expr_stmt(void); |
339 | void stmt_while_expr(tnode_t *); | | 338 | void stmt_while_expr(tnode_t *); |
340 | void stmt_while_expr_stmt(void); | | 339 | void stmt_while_expr_stmt(void); |
341 | void stmt_do(void); | | 340 | void stmt_do(void); |
342 | void stmt_do_while_expr(tnode_t *); | | 341 | void stmt_do_while_expr(tnode_t *); |
343 | void stmt_for_exprs(tnode_t *, tnode_t *, tnode_t *); | | 342 | void stmt_for_exprs(tnode_t *, tnode_t *, tnode_t *); |
344 | void stmt_for_exprs_stmt(void); | | 343 | void stmt_for_exprs_stmt(void); |
345 | void stmt_goto(sym_t *); | | 344 | void stmt_goto(sym_t *); |
346 | void stmt_continue(void); | | 345 | void stmt_continue(void); |
347 | void stmt_break(void); | | 346 | void stmt_break(void); |
348 | void stmt_return(bool, tnode_t *); | | 347 | void stmt_return(bool, tnode_t *); |
349 | void global_clean_up_decl(bool); | | 348 | void global_clean_up_decl(bool); |
350 | void handle_lint_comment(lint_comment, int); | | 349 | void handle_lint_comment(lint_comment, int); |
351 | | | 350 | |
352 | /* | | 351 | /* |
353 | * init.c | | 352 | * init.c |
354 | */ | | 353 | */ |
355 | void begin_initialization(sym_t *); | | 354 | void begin_initialization(sym_t *); |
356 | void end_initialization(void); | | 355 | void end_initialization(void); |
357 | sym_t *current_initsym(void); | | 356 | sym_t *current_initsym(void); |
358 | | | 357 | |
359 | void init_rbrace(void); | | 358 | void init_rbrace(void); |
360 | void init_lbrace(void); | | 359 | void init_lbrace(void); |
361 | void init_expr(tnode_t *); | | 360 | void init_expr(tnode_t *); |
362 | void begin_designation(void); | | 361 | void begin_designation(void); |
363 | void add_designator_member(sbuf_t *); | | 362 | void add_designator_member(sbuf_t *); |
364 | void add_designator_subscript(range_t); | | 363 | void add_designator_subscript(range_t); |
365 | | | 364 | |
366 | /* | | 365 | /* |
367 | * emit.c | | 366 | * emit.c |
368 | */ | | 367 | */ |
369 | void outtype(const type_t *); | | 368 | void outtype(const type_t *); |
370 | void outsym(const sym_t *, scl_t, def_t); | | 369 | void outsym(const sym_t *, scl_t, def_t); |
371 | void outfdef(const sym_t *, const pos_t *, bool, bool, const sym_t *); | | 370 | void outfdef(const sym_t *, const pos_t *, bool, bool, const sym_t *); |
372 | void outcall(const tnode_t *, bool, bool); | | 371 | void outcall(const tnode_t *, bool, bool); |
373 | void outusg(const sym_t *); | | 372 | void outusg(const sym_t *); |
374 | | | 373 | |
375 | /* | | 374 | /* |
376 | * lex.c | | 375 | * lex.c |
377 | */ | | 376 | */ |
378 | int lex_name(const char *, size_t); | | 377 | int lex_name(const char *, size_t); |
379 | int lex_integer_constant(const char *, size_t, int); | | 378 | int lex_integer_constant(const char *, size_t, int); |
380 | int lex_floating_constant(const char *, size_t); | | 379 | int lex_floating_constant(const char *, size_t); |
381 | int lex_operator(int, op_t); | | 380 | int lex_operator(int, op_t); |
382 | int lex_string(void); | | 381 | int lex_string(void); |
383 | int lex_wide_string(void); | | 382 | int lex_wide_string(void); |
384 | int lex_character_constant(void); | | 383 | int lex_character_constant(void); |
385 | int lex_wide_character_constant(void); | | 384 | int lex_wide_character_constant(void); |
386 | void lex_directive(const char *); | | 385 | void lex_directive(const char *); |
387 | void lex_next_line(void); | | 386 | void lex_next_line(void); |
388 | void lex_comment(void); | | 387 | void lex_comment(void); |
389 | void lex_slash_slash_comment(void); | | 388 | void lex_slash_slash_comment(void); |
390 | void lex_unknown_character(int); | | 389 | void lex_unknown_character(int); |
391 | int lex_input(void); | | 390 | int lex_input(void); |
392 | | | 391 | |
393 | /* | | 392 | /* |
394 | * ckbool.c | | 393 | * ckbool.c |
395 | */ | | 394 | */ |
396 | bool typeok_scalar_strict_bool(op_t, const mod_t *, int, | | 395 | bool typeok_scalar_strict_bool(op_t, const mod_t *, int, |
397 | const tnode_t *, const tnode_t *); | | 396 | const tnode_t *, const tnode_t *); |
398 | bool fallback_symbol_strict_bool(sym_t *); | | 397 | bool fallback_symbol_strict_bool(sym_t *); |
399 | | | 398 | |
400 | /* | | 399 | /* |
401 | * ckctype.c | | 400 | * ckctype.c |
402 | */ | | 401 | */ |
403 | void check_ctype_function_call(const tnode_t *, const tnode_t *); | | 402 | void check_ctype_function_call(const tnode_t *, const tnode_t *); |
404 | void check_ctype_macro_invocation(const tnode_t *, const tnode_t *); | | 403 | void check_ctype_macro_invocation(const tnode_t *, const tnode_t *); |
405 | | | 404 | |
406 | /* | | 405 | /* |
407 | * ckgetopt.c | | 406 | * ckgetopt.c |
408 | */ | | 407 | */ |
409 | void check_getopt_begin_while(const tnode_t *); | | 408 | void check_getopt_begin_while(const tnode_t *); |
410 | void check_getopt_begin_switch(void); | | 409 | void check_getopt_begin_switch(void); |
411 | void check_getopt_case_label(int64_t); | | 410 | void check_getopt_case_label(int64_t); |
412 | void check_getopt_end_switch(void); | | 411 | void check_getopt_end_switch(void); |
413 | void check_getopt_end_while(void); | | 412 | void check_getopt_end_while(void); |