Sat Jul 29 06:44:44 2023 UTC ()
lint: use standard function attribute for noreturn functions


(rillig)
diff -r1.199 -r1.200 src/usr.bin/xlint/lint1/externs1.h
diff -r1.74 -r1.75 src/usr.bin/xlint/lint1/main1.c

cvs diff -r1.199 -r1.200 src/usr.bin/xlint/lint1/externs1.h (switch to unified diff)

--- src/usr.bin/xlint/lint1/externs1.h 2023/07/28 21:50:03 1.199
+++ src/usr.bin/xlint/lint1/externs1.h 2023/07/29 06:44:44 1.200
@@ -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 */
39extern int aflag; 39extern int aflag;
40extern bool bflag; 40extern bool bflag;
41extern bool cflag; 41extern bool cflag;
42extern bool eflag; 42extern bool eflag;
43extern bool Fflag; 43extern bool Fflag;
44extern bool hflag; 44extern bool hflag;
45extern bool pflag; 45extern bool pflag;
46extern bool rflag; 46extern bool rflag;
47extern bool uflag; 47extern bool uflag;
48extern bool vflag; 48extern bool vflag;
49extern bool yflag; 49extern bool yflag;
50extern bool wflag; 50extern bool wflag;
51extern bool zflag; 51extern bool zflag;
52extern bool Tflag; 52extern bool Tflag;
53extern bool Pflag; 53extern bool Pflag;
54 54
55extern bool allow_trad; 55extern bool allow_trad;
56extern bool allow_c90; 56extern bool allow_c90;
57extern bool allow_c99; 57extern bool allow_c99;
58extern bool allow_c11; 58extern bool allow_c11;
59extern bool allow_c23; 59extern bool allow_c23;
60extern bool allow_gcc; 60extern bool allow_gcc;
61 61
62extern sig_atomic_t fpe; 62extern sig_atomic_t fpe;
63 63
64void norecover(void); 64void norecover(void);
65 65
66/* 66/*
67 * cgram.y 67 * cgram.y
68 */ 68 */
69extern int block_level; 69extern int block_level;
70extern size_t mem_block_level; 70extern size_t mem_block_level;
71extern int yydebug; 71extern int yydebug;
72 72
73int yyerror(const char *); 73int yyerror(const char *);
74int yyparse(void); 74int yyparse(void);
75 75
76/* 76/*
77 * scan.l 77 * scan.l
78 */ 78 */
79extern bool in_gcc_attribute; 79extern bool in_gcc_attribute;
80extern pos_t curr_pos; 80extern pos_t curr_pos;
81extern pos_t csrc_pos; 81extern pos_t csrc_pos;
82extern bool in_system_header; 82extern bool in_system_header;
83extern symt_t symtyp; 83extern symt_t symtyp;
84extern FILE *yyin; 84extern FILE *yyin;
85 85
86void initscan(void); 86void initscan(void);
87int64_t convert_integer(int64_t, tspec_t, unsigned int); 87int64_t convert_integer(int64_t, tspec_t, unsigned int);
88void clear_warn_flags(void); 88void clear_warn_flags(void);
89sym_t *getsym(sbuf_t *); 89sym_t *getsym(sbuf_t *);
90void clean_up_after_error(void); 90void clean_up_after_error(void);
91sym_t *pushdown(const sym_t *); 91sym_t *pushdown(const sym_t *);
92sym_t *mktempsym(type_t *); 92sym_t *mktempsym(type_t *);
93void rmsym(sym_t *); 93void rmsym(sym_t *);
94void symtab_remove_level(sym_t *); 94void symtab_remove_level(sym_t *);
95void inssym(int, sym_t *); 95void inssym(int, sym_t *);
96void freeyyv(void *, int); 96void freeyyv(void *, int);
97int yylex(void); 97int yylex(void);
98 98
99/* 99/*
100 * mem1.c 100 * mem1.c
101 */ 101 */
102const char *record_filename(const char *, size_t); 102const char *record_filename(const char *, size_t);
103int get_filename_id(const char *); 103int get_filename_id(const char *);
104void add_directory_replacement(char *); 104void add_directory_replacement(char *);
105const char *transform_filename(const char *, size_t); 105const char *transform_filename(const char *, size_t);
106 106
107#ifdef DEBUG_MEM 107#ifdef DEBUG_MEM
108void *block_zero_alloc(size_t, const char *); 108void *block_zero_alloc(size_t, const char *);
109void *level_zero_alloc(size_t, size_t, const char *); 109void *level_zero_alloc(size_t, size_t, const char *);
110#else 110#else
111void *block_zero_alloc(size_t); 111void *block_zero_alloc(size_t);
112void *level_zero_alloc(size_t, size_t); 112void *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
116void level_free_all(size_t); 116void level_free_all(size_t);
117 117
118#ifdef DEBUG_MEM 118#ifdef DEBUG_MEM
119void *expr_zero_alloc(size_t, const char *); 119void *expr_zero_alloc(size_t, const char *);
120#else 120#else
121void *expr_zero_alloc(size_t); 121void *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
124tnode_t *expr_alloc_tnode(void); 124tnode_t *expr_alloc_tnode(void);
125void expr_free_all(void); 125void expr_free_all(void);
126memory_pool expr_save_memory(void); 126memory_pool expr_save_memory(void);
127void expr_restore_memory(memory_pool); 127void 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
134const char *decl_level_kind_name(decl_level_kind); 134const char *decl_level_kind_name(decl_level_kind);
135const char *scl_name(scl_t); 135const char *scl_name(scl_t);
136const char *symt_name(symt_t); 136const char *symt_name(symt_t);
137const char *type_qualifiers_string(type_qualifiers); 137const char *type_qualifiers_string(type_qualifiers);
138const char *function_specifier_name(function_specifier); 138const char *function_specifier_name(function_specifier);
139void debug_dcs(bool); 139void debug_dcs(bool);
140void debug_node(const tnode_t *); 140void debug_node(const tnode_t *);
141void debug_type(const type_t *); 141void debug_type(const type_t *);
142void debug_sym(const char *, const sym_t *, const char *); 142void debug_sym(const char *, const sym_t *, const char *);
143void debug_symtab(void); 143void debug_symtab(void);
144void debug_printf(const char *fmt, ...) __printflike(1, 2); 144void debug_printf(const char *fmt, ...) __printflike(1, 2);
145void debug_print_indent(void); 145void debug_print_indent(void);
146void debug_indent_inc(void); 146void debug_indent_inc(void);
147void debug_indent_dec(void); 147void debug_indent_dec(void);
148void debug_enter_func(const char *); 148void debug_enter_func(const char *);
149void debug_step(const char *fmt, ...) __printflike(1, 2); 149void debug_step(const char *fmt, ...) __printflike(1, 2);
150void debug_leave_func(const char *); 150void 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 */
172extern bool seen_error; 172extern bool seen_error;
173extern bool seen_warning; 173extern bool seen_warning;
174extern int sytxerr; 174extern int sytxerr;
175extern bool any_query_enabled; 175extern bool any_query_enabled;
176 176
177void msglist(void); 177void msglist(void);
178void error_at(int, const pos_t *, ...); 178void error_at(int, const pos_t *, ...);
179void warning_at(int, const pos_t *, ...); 179void warning_at(int, const pos_t *, ...);
180void message_at(int, const pos_t *, ...); 180void message_at(int, const pos_t *, ...);
181void error(int, ...); 181void error(int, ...);
182void warning(int, ...); 182void warning(int, ...);
183bool gnuism(int, ...); 183bool gnuism(int, ...);
184void c99ism(int, ...); 184void c99ism(int, ...);
185void c11ism(int, ...); 185void c11ism(int, ...);
186void c23ism(int, ...); 186void c23ism(int, ...);
187void assert_failed(const char *, int, const char *, const char *) 187void assert_failed(const char *, int, const char *, const char *) __dead;
188 __attribute__((__noreturn__)); 
189void update_location(const char *, int, bool, bool); 188void update_location(const char *, int, bool, bool);
190void suppress_messages(const char *); 189void suppress_messages(const char *);
191 190
192void query_message(int, ...); 191void query_message(int, ...);
193void enable_queries(const char *); 192void enable_queries(const char *);
194 193
195/* 194/*
196 * decl.c 195 * decl.c
197 */ 196 */
198extern decl_level *dcs; 197extern decl_level *dcs;
199extern const char unnamed[]; 198extern const char unnamed[];
200extern int enumval; 199extern int enumval;
201 200
202void initdecl(void); 201void initdecl(void);
203type_t *gettyp(tspec_t); 202type_t *gettyp(tspec_t);
204type_t *block_dup_type(const type_t *); 203type_t *block_dup_type(const type_t *);
205type_t *expr_dup_type(const type_t *); 204type_t *expr_dup_type(const type_t *);
206type_t *expr_unqualified_type(const type_t *); 205type_t *expr_unqualified_type(const type_t *);
207bool is_incomplete(const type_t *); 206bool is_incomplete(const type_t *);
208void dcs_add_function_specifier(function_specifier); 207void dcs_add_function_specifier(function_specifier);
209void dcs_add_storage_class(scl_t); 208void dcs_add_storage_class(scl_t);
210void dcs_add_type(type_t *); 209void dcs_add_type(type_t *);
211void dcs_add_qualifiers(type_qualifiers); 210void dcs_add_qualifiers(type_qualifiers);
212void dcs_add_packed(void); 211void dcs_add_packed(void);
213void dcs_set_used(void); 212void dcs_set_used(void);
214void begin_declaration_level(decl_level_kind); 213void begin_declaration_level(decl_level_kind);
215void end_declaration_level(void); 214void end_declaration_level(void);
216void dcs_set_asm(void); 215void dcs_set_asm(void);
217void dcs_begin_type(void); 216void dcs_begin_type(void);
218void dcs_end_type(void); 217void dcs_end_type(void);
219int length_in_bits(const type_t *, const char *); 218int length_in_bits(const type_t *, const char *);
220unsigned int alignment_in_bits(const type_t *); 219unsigned int alignment_in_bits(const type_t *);
221sym_t *concat_symbols(sym_t *, sym_t *); 220sym_t *concat_symbols(sym_t *, sym_t *);
222void check_type(sym_t *); 221void check_type(sym_t *);
223sym_t *declare_unnamed_member(void); 222sym_t *declare_unnamed_member(void);
224sym_t *declare_member(sym_t *); 223sym_t *declare_member(sym_t *);
225sym_t *set_bit_field_width(sym_t *, int); 224sym_t *set_bit_field_width(sym_t *, int);
226void add_type_qualifiers(type_qualifiers *, type_qualifiers); 225void add_type_qualifiers(type_qualifiers *, type_qualifiers);
227qual_ptr *append_qualified_pointer(qual_ptr *, qual_ptr *); 226qual_ptr *append_qualified_pointer(qual_ptr *, qual_ptr *);
228sym_t *add_pointer(sym_t *, qual_ptr *); 227sym_t *add_pointer(sym_t *, qual_ptr *);
229sym_t *add_array(sym_t *, bool, int); 228sym_t *add_array(sym_t *, bool, int);
230sym_t *add_function(sym_t *, struct parameter_list); 229sym_t *add_function(sym_t *, struct parameter_list);
231void check_extern_declaration(const sym_t *); 230void check_extern_declaration(const sym_t *);
232void check_function_definition(sym_t *, bool); 231void check_function_definition(sym_t *, bool);
233sym_t *declarator_name(sym_t *); 232sym_t *declarator_name(sym_t *);
234sym_t *old_style_function_parameter_name(sym_t *); 233sym_t *old_style_function_parameter_name(sym_t *);
235type_t *make_tag_type(sym_t *, tspec_t, bool, bool); 234type_t *make_tag_type(sym_t *, tspec_t, bool, bool);
236const char *storage_class_name(scl_t); 235const char *storage_class_name(scl_t);
237type_t *complete_struct_or_union(sym_t *); 236type_t *complete_struct_or_union(sym_t *);
238type_t *complete_enum(sym_t *); 237type_t *complete_enum(sym_t *);
239sym_t *enumeration_constant(sym_t *, int, bool); 238sym_t *enumeration_constant(sym_t *, int, bool);
240void declare(sym_t *, bool, sbuf_t *); 239void declare(sym_t *, bool, sbuf_t *);
241void copy_usage_info(sym_t *, sym_t *); 240void copy_usage_info(sym_t *, sym_t *);
242bool check_redeclaration(sym_t *, bool *); 241bool check_redeclaration(sym_t *, bool *);
243bool pointer_types_are_compatible(const type_t *, const type_t *, bool); 242bool pointer_types_are_compatible(const type_t *, const type_t *, bool);
244bool types_compatible(const type_t *, const type_t *, bool, bool, bool *); 243bool types_compatible(const type_t *, const type_t *, bool, bool, bool *);
245void complete_type(sym_t *, sym_t *); 244void complete_type(sym_t *, sym_t *);
246sym_t *declare_argument(sym_t *, bool); 245sym_t *declare_argument(sym_t *, bool);
247void check_func_lint_directives(void); 246void check_func_lint_directives(void);
248void check_func_old_style_arguments(void); 247void check_func_old_style_arguments(void);
249 248
250void declare_local(sym_t *, bool); 249void declare_local(sym_t *, bool);
251sym_t *abstract_name(void); 250sym_t *abstract_name(void);
252void global_clean_up(void); 251void global_clean_up(void);
253sym_t *declare_abstract_type(sym_t *); 252sym_t *declare_abstract_type(sym_t *);
254void check_size(sym_t *); 253void check_size(sym_t *);
255void mark_as_set(sym_t *); 254void mark_as_set(sym_t *);
256void mark_as_used(sym_t *, bool, bool); 255void mark_as_used(sym_t *, bool, bool);
257void check_usage(decl_level *); 256void check_usage(decl_level *);
258void check_usage_sym(bool, sym_t *); 257void check_usage_sym(bool, sym_t *);
259void check_global_symbols(void); 258void check_global_symbols(void);
260void print_previous_declaration(const sym_t *); 259void print_previous_declaration(const sym_t *);
261int to_int_constant(tnode_t *, bool); 260int to_int_constant(tnode_t *, bool);
262 261
263/* 262/*
264 * tree.c 263 * tree.c
265 */ 264 */
266const tnode_t *before_conversion(const tnode_t *); 265const tnode_t *before_conversion(const tnode_t *);
267type_t *block_derive_type(type_t *, tspec_t); 266type_t *block_derive_type(type_t *, tspec_t);
268type_t *expr_derive_type(type_t *, tspec_t); 267type_t *expr_derive_type(type_t *, tspec_t);
269bool is_compiler_builtin(const char *); 268bool is_compiler_builtin(const char *);
270tnode_t *build_constant(type_t *, val_t *); 269tnode_t *build_constant(type_t *, val_t *);
271tnode_t *build_name(sym_t *, bool); 270tnode_t *build_name(sym_t *, bool);
272tnode_t *build_string(strg_t *); 271tnode_t *build_string(strg_t *);
273tnode_t *build_generic_selection(const tnode_t *, 272tnode_t *build_generic_selection(const tnode_t *,
274 struct generic_association *); 273 struct generic_association *);
275 274
276tnode_t *build_binary(tnode_t *, op_t, bool, tnode_t *); 275tnode_t *build_binary(tnode_t *, op_t, bool, tnode_t *);
277tnode_t *build_unary(op_t, bool, tnode_t *); 276tnode_t *build_unary(op_t, bool, tnode_t *);
278tnode_t *build_member_access(tnode_t *, op_t, bool, sbuf_t *); 277tnode_t *build_member_access(tnode_t *, op_t, bool, sbuf_t *);
279tnode_t *cconv(tnode_t *); 278tnode_t *cconv(tnode_t *);
280bool is_typeok_bool_compares_with_zero(const tnode_t *); 279bool is_typeok_bool_compares_with_zero(const tnode_t *);
281bool typeok(op_t, int, const tnode_t *, const tnode_t *); 280bool typeok(op_t, int, const tnode_t *, const tnode_t *);
282tnode_t *promote(op_t, bool, tnode_t *); 281tnode_t *promote(op_t, bool, tnode_t *);
283tnode_t *convert(op_t, int, type_t *, tnode_t *); 282tnode_t *convert(op_t, int, type_t *, tnode_t *);
284void convert_constant(op_t, int, const type_t *, val_t *, val_t *); 283void convert_constant(op_t, int, const type_t *, val_t *, val_t *);
285tnode_t *build_sizeof(const type_t *); 284tnode_t *build_sizeof(const type_t *);
286tnode_t *build_offsetof(const type_t *, const sym_t *); 285tnode_t *build_offsetof(const type_t *, const sym_t *);
287tnode_t *build_alignof(const type_t *); 286tnode_t *build_alignof(const type_t *);
288tnode_t *cast(tnode_t *, type_t *); 287tnode_t *cast(tnode_t *, type_t *);
289tnode_t *build_function_argument(tnode_t *, tnode_t *); 288tnode_t *build_function_argument(tnode_t *, tnode_t *);
290tnode_t *build_function_call(tnode_t *, bool, tnode_t *); 289tnode_t *build_function_call(tnode_t *, bool, tnode_t *);
291val_t *integer_constant(tnode_t *, bool); 290val_t *integer_constant(tnode_t *, bool);
292void expr(tnode_t *, bool, bool, bool, bool); 291void expr(tnode_t *, bool, bool, bool, bool);
293void check_expr_misc(const tnode_t *, bool, bool, bool, bool, bool, bool); 292void check_expr_misc(const tnode_t *, bool, bool, bool, bool, bool, bool);
294bool constant_addr(const tnode_t *, const sym_t **, ptrdiff_t *); 293bool constant_addr(const tnode_t *, const sym_t **, ptrdiff_t *);
295strg_t *cat_strings(strg_t *, strg_t *); 294strg_t *cat_strings(strg_t *, strg_t *);
296unsigned int type_size_in_bits(const type_t *); 295unsigned int type_size_in_bits(const type_t *);
297sym_t *find_member(const struct_or_union *, const char *); 296sym_t *find_member(const struct_or_union *, const char *);
298 297
299void begin_statement_expr(void); 298void begin_statement_expr(void);
300void do_statement_expr(tnode_t *); 299void do_statement_expr(tnode_t *);
301tnode_t *end_statement_expr(void); 300tnode_t *end_statement_expr(void);
302bool in_statement_expr(void); 301bool in_statement_expr(void);
303 302
304/* 303/*
305 * func.c 304 * func.c
306 */ 305 */
307extern sym_t *funcsym; 306extern sym_t *funcsym;
308extern bool reached; 307extern bool reached;
309extern bool warn_about_unreachable; 308extern bool warn_about_unreachable;
310extern bool suppress_fallthrough; 309extern bool suppress_fallthrough;
311extern int nargusg; 310extern int nargusg;
312extern pos_t argsused_pos; 311extern pos_t argsused_pos;
313extern int nvararg; 312extern int nvararg;
314extern pos_t vapos; 313extern pos_t vapos;
315extern int printflike_argnum; 314extern int printflike_argnum;
316extern pos_t printflike_pos; 315extern pos_t printflike_pos;
317extern int scanflike_argnum; 316extern int scanflike_argnum;
318extern pos_t scanflike_pos; 317extern pos_t scanflike_pos;
319extern bool suppress_constcond; 318extern bool suppress_constcond;
320extern bool llibflg; 319extern bool llibflg;
321extern int lwarn; 320extern int lwarn;
322extern bool suppress_bitfieldtype; 321extern bool suppress_bitfieldtype;
323extern bool plibflg; 322extern bool plibflg;
324extern bool suppress_longlong; 323extern bool suppress_longlong;
325 324
326void begin_control_statement(control_statement_kind); 325void begin_control_statement(control_statement_kind);
327void end_control_statement(control_statement_kind); 326void end_control_statement(control_statement_kind);
328void check_statement_reachable(void); 327void check_statement_reachable(void);
329void begin_function(sym_t *); 328void begin_function(sym_t *);
330void end_function(void); 329void end_function(void);
331void named_label(sym_t *); 330void named_label(sym_t *);
332void case_label(tnode_t *); 331void case_label(tnode_t *);
333void default_label(void); 332void default_label(void);
334void stmt_if_expr(tnode_t *); 333void stmt_if_expr(tnode_t *);
335void stmt_if_then_stmt(void); 334void stmt_if_then_stmt(void);
336void stmt_if_else_stmt(bool); 335void stmt_if_else_stmt(bool);
337void stmt_switch_expr(tnode_t *); 336void stmt_switch_expr(tnode_t *);
338void stmt_switch_expr_stmt(void); 337void stmt_switch_expr_stmt(void);
339void stmt_while_expr(tnode_t *); 338void stmt_while_expr(tnode_t *);
340void stmt_while_expr_stmt(void); 339void stmt_while_expr_stmt(void);
341void stmt_do(void); 340void stmt_do(void);
342void stmt_do_while_expr(tnode_t *); 341void stmt_do_while_expr(tnode_t *);
343void stmt_for_exprs(tnode_t *, tnode_t *, tnode_t *); 342void stmt_for_exprs(tnode_t *, tnode_t *, tnode_t *);
344void stmt_for_exprs_stmt(void); 343void stmt_for_exprs_stmt(void);
345void stmt_goto(sym_t *); 344void stmt_goto(sym_t *);
346void stmt_continue(void); 345void stmt_continue(void);
347void stmt_break(void); 346void stmt_break(void);
348void stmt_return(bool, tnode_t *); 347void stmt_return(bool, tnode_t *);
349void global_clean_up_decl(bool); 348void global_clean_up_decl(bool);
350void handle_lint_comment(lint_comment, int); 349void handle_lint_comment(lint_comment, int);
351 350
352/* 351/*
353 * init.c 352 * init.c
354 */ 353 */
355void begin_initialization(sym_t *); 354void begin_initialization(sym_t *);
356void end_initialization(void); 355void end_initialization(void);
357sym_t *current_initsym(void); 356sym_t *current_initsym(void);
358 357
359void init_rbrace(void); 358void init_rbrace(void);
360void init_lbrace(void); 359void init_lbrace(void);
361void init_expr(tnode_t *); 360void init_expr(tnode_t *);
362void begin_designation(void); 361void begin_designation(void);
363void add_designator_member(sbuf_t *); 362void add_designator_member(sbuf_t *);
364void add_designator_subscript(range_t); 363void add_designator_subscript(range_t);
365 364
366/* 365/*
367 * emit.c 366 * emit.c
368 */ 367 */
369void outtype(const type_t *); 368void outtype(const type_t *);
370void outsym(const sym_t *, scl_t, def_t); 369void outsym(const sym_t *, scl_t, def_t);
371void outfdef(const sym_t *, const pos_t *, bool, bool, const sym_t *); 370void outfdef(const sym_t *, const pos_t *, bool, bool, const sym_t *);
372void outcall(const tnode_t *, bool, bool); 371void outcall(const tnode_t *, bool, bool);
373void outusg(const sym_t *); 372void outusg(const sym_t *);
374 373
375/* 374/*
376 * lex.c 375 * lex.c
377 */ 376 */
378int lex_name(const char *, size_t); 377int lex_name(const char *, size_t);
379int lex_integer_constant(const char *, size_t, int); 378int lex_integer_constant(const char *, size_t, int);
380int lex_floating_constant(const char *, size_t); 379int lex_floating_constant(const char *, size_t);
381int lex_operator(int, op_t); 380int lex_operator(int, op_t);
382int lex_string(void); 381int lex_string(void);
383int lex_wide_string(void); 382int lex_wide_string(void);
384int lex_character_constant(void); 383int lex_character_constant(void);
385int lex_wide_character_constant(void); 384int lex_wide_character_constant(void);
386void lex_directive(const char *); 385void lex_directive(const char *);
387void lex_next_line(void); 386void lex_next_line(void);
388void lex_comment(void); 387void lex_comment(void);
389void lex_slash_slash_comment(void); 388void lex_slash_slash_comment(void);
390void lex_unknown_character(int); 389void lex_unknown_character(int);
391int lex_input(void); 390int lex_input(void);
392 391
393/* 392/*
394 * ckbool.c 393 * ckbool.c
395 */ 394 */
396bool typeok_scalar_strict_bool(op_t, const mod_t *, int, 395bool typeok_scalar_strict_bool(op_t, const mod_t *, int,
397 const tnode_t *, const tnode_t *); 396 const tnode_t *, const tnode_t *);
398bool fallback_symbol_strict_bool(sym_t *); 397bool fallback_symbol_strict_bool(sym_t *);
399 398
400/* 399/*
401 * ckctype.c 400 * ckctype.c
402 */ 401 */
403void check_ctype_function_call(const tnode_t *, const tnode_t *); 402void check_ctype_function_call(const tnode_t *, const tnode_t *);
404void check_ctype_macro_invocation(const tnode_t *, const tnode_t *); 403void check_ctype_macro_invocation(const tnode_t *, const tnode_t *);
405 404
406/* 405/*
407 * ckgetopt.c 406 * ckgetopt.c
408 */ 407 */
409void check_getopt_begin_while(const tnode_t *); 408void check_getopt_begin_while(const tnode_t *);
410void check_getopt_begin_switch(void); 409void check_getopt_begin_switch(void);
411void check_getopt_case_label(int64_t); 410void check_getopt_case_label(int64_t);
412void check_getopt_end_switch(void); 411void check_getopt_end_switch(void);
413void check_getopt_end_while(void); 412void check_getopt_end_while(void);

cvs diff -r1.74 -r1.75 src/usr.bin/xlint/lint1/main1.c (switch to unified diff)

--- src/usr.bin/xlint/lint1/main1.c 2023/07/13 08:40:38 1.74
+++ src/usr.bin/xlint/lint1/main1.c 2023/07/29 06:44:44 1.75
@@ -1,281 +1,281 @@ @@ -1,281 +1,281 @@
1/* $NetBSD: main1.c,v 1.74 2023/07/13 08:40:38 rillig Exp $ */ 1/* $NetBSD: main1.c,v 1.75 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#if HAVE_NBTOOL_CONFIG_H 34#if HAVE_NBTOOL_CONFIG_H
35#include "nbtool_config.h" 35#include "nbtool_config.h"
36#endif 36#endif
37 37
38#include <sys/cdefs.h> 38#include <sys/cdefs.h>
39#if defined(__RCSID) 39#if defined(__RCSID)
40__RCSID("$NetBSD: main1.c,v 1.74 2023/07/13 08:40:38 rillig Exp $"); 40__RCSID("$NetBSD: main1.c,v 1.75 2023/07/29 06:44:44 rillig Exp $");
41#endif 41#endif
42 42
43#include <sys/types.h> 43#include <sys/types.h>
44#include <signal.h> 44#include <signal.h>
45#include <stdio.h> 45#include <stdio.h>
46#include <stdlib.h> 46#include <stdlib.h>
47#include <string.h> 47#include <string.h>
48#include <unistd.h> 48#include <unistd.h>
49 49
50#include "lint1.h" 50#include "lint1.h"
51 51
52int aflag; 52int aflag;
53bool bflag; 53bool bflag;
54bool cflag; 54bool cflag;
55bool eflag; 55bool eflag;
56bool Fflag; 56bool Fflag;
57bool hflag; 57bool hflag;
58bool Pflag; 58bool Pflag;
59bool pflag; 59bool pflag;
60bool rflag; 60bool rflag;
61bool Tflag; 61bool Tflag;
62bool uflag; 62bool uflag;
63bool vflag; 63bool vflag;
64bool wflag; 64bool wflag;
65bool yflag; 65bool yflag;
66bool zflag; 66bool zflag;
67 67
68/* 68/*
69 * The default language level is the one that checks for compatibility 69 * The default language level is the one that checks for compatibility
70 * between traditional C and C90. As of 2022, this default is no longer 70 * between traditional C and C90. As of 2022, this default is no longer
71 * useful since most traditional C code has already been migrated. 71 * useful since most traditional C code has already been migrated.
72 */ 72 */
73bool allow_trad = true; 73bool allow_trad = true;
74bool allow_c90 = true; 74bool allow_c90 = true;
75bool allow_c99; 75bool allow_c99;
76bool allow_c11; 76bool allow_c11;
77bool allow_c23; 77bool allow_c23;
78bool allow_gcc; 78bool allow_gcc;
79 79
80sig_atomic_t fpe; 80sig_atomic_t fpe;
81 81
82static void usage(void); 82static void usage(void);
83 83
84static FILE * 84static FILE *
85gcc_builtins(void) 85gcc_builtins(void)
86{ 86{
87 /* https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html */ 87 /* https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html */
88 static const char builtins[] = 88 static const char builtins[] =
89 "typedef typeof(sizeof(0)) __lint_size_t;\n" 89 "typedef typeof(sizeof(0)) __lint_size_t;\n"
90 90
91 "void *alloca(__lint_size_t);\n" 91 "void *alloca(__lint_size_t);\n"
92 "void *__builtin_alloca(__lint_size_t);\n" 92 "void *__builtin_alloca(__lint_size_t);\n"
93 "void *__builtin_alloca_with_align" 93 "void *__builtin_alloca_with_align"
94 "(__lint_size_t, __lint_size_t);\n" 94 "(__lint_size_t, __lint_size_t);\n"
95 "void *__builtin_alloca_with_align_and_max" 95 "void *__builtin_alloca_with_align_and_max"
96 "(__lint_size_t, __lint_size_t, __lint_size_t);\n" 96 "(__lint_size_t, __lint_size_t, __lint_size_t);\n"
97 97
98 "int __builtin_isinf(long double);\n" 98 "int __builtin_isinf(long double);\n"
99 "int __builtin_isnan(long double);\n" 99 "int __builtin_isnan(long double);\n"
100 "int __builtin_copysign(long double, long double);\n"; 100 "int __builtin_copysign(long double, long double);\n";
101 size_t builtins_len = sizeof(builtins) - 1; 101 size_t builtins_len = sizeof(builtins) - 1;
102 102
103#if HAVE_NBTOOL_CONFIG_H 103#if HAVE_NBTOOL_CONFIG_H
104 char template[] = "/tmp/lint.XXXXXX"; 104 char template[] = "/tmp/lint.XXXXXX";
105 int fd; 105 int fd;
106 FILE *fp; 106 FILE *fp;
107 if ((fd = mkstemp(template)) == -1) 107 if ((fd = mkstemp(template)) == -1)
108 return NULL; 108 return NULL;
109 (void)unlink(template); 109 (void)unlink(template);
110 if ((fp = fdopen(fd, "r+")) == NULL) { 110 if ((fp = fdopen(fd, "r+")) == NULL) {
111 (void)close(fd); 111 (void)close(fd);
112 return NULL; 112 return NULL;
113 } 113 }
114 if (fwrite(builtins, 1, builtins_len, fp) != builtins_len) { 114 if (fwrite(builtins, 1, builtins_len, fp) != builtins_len) {
115 (void)fclose(fp); 115 (void)fclose(fp);
116 return NULL; 116 return NULL;
117 } 117 }
118 rewind(fp); 118 rewind(fp);
119 return fp; 119 return fp;
120#else 120#else
121 return fmemopen(__UNCONST(builtins), builtins_len, "r"); 121 return fmemopen(__UNCONST(builtins), builtins_len, "r");
122#endif 122#endif
123} 123}
124 124
125/*ARGSUSED*/ 125/*ARGSUSED*/
126static void 126static void
127sigfpe(int s) 127sigfpe(int s)
128{ 128{
129 fpe = 1; 129 fpe = 1;
130} 130}
131 131
132int 132int
133main(int argc, char *argv[]) 133main(int argc, char *argv[])
134{ 134{
135 int c; 135 int c;
136 136
137 setprogname(argv[0]); 137 setprogname(argv[0]);
138 138
139 while ((c = getopt(argc, argv, "abceghmpq:rstuvwyzA:FPR:STX:")) != -1) { 139 while ((c = getopt(argc, argv, "abceghmpq:rstuvwyzA:FPR:STX:")) != -1) {
140 switch (c) { 140 switch (c) {
141 case 'a': aflag++; break; 141 case 'a': aflag++; break;
142 case 'b': bflag = true; break; 142 case 'b': bflag = true; break;
143 case 'c': cflag = true; break; 143 case 'c': cflag = true; break;
144 case 'e': eflag = true; break; 144 case 'e': eflag = true; break;
145 case 'F': Fflag = true; break; 145 case 'F': Fflag = true; break;
146 case 'g': allow_gcc = true; break; 146 case 'g': allow_gcc = true; break;
147 case 'h': hflag = true; break; 147 case 'h': hflag = true; break;
148 case 'p': pflag = true; break; 148 case 'p': pflag = true; break;
149 case 'P': Pflag = true; break; 149 case 'P': Pflag = true; break;
150 case 'q': enable_queries(optarg); break; 150 case 'q': enable_queries(optarg); break;
151 case 'r': rflag = true; break; 151 case 'r': rflag = true; break;
152 case 's': 152 case 's':
153 allow_trad = false; 153 allow_trad = false;
154 allow_c90 = true; 154 allow_c90 = true;
155 allow_c99 = false; 155 allow_c99 = false;
156 allow_c11 = false; 156 allow_c11 = false;
157 allow_c23 = false; 157 allow_c23 = false;
158 break; 158 break;
159 case 'S': 159 case 'S':
160 allow_trad = false; 160 allow_trad = false;
161 allow_c90 = true; 161 allow_c90 = true;
162 allow_c99 = true; 162 allow_c99 = true;
163 allow_c11 = false; 163 allow_c11 = false;
164 allow_c23 = false; 164 allow_c23 = false;
165 break; 165 break;
166 case 'T': Tflag = true; break; 166 case 'T': Tflag = true; break;
167 case 't': 167 case 't':
168 allow_trad = true; 168 allow_trad = true;
169 allow_c90 = false; 169 allow_c90 = false;
170 allow_c99 = false; 170 allow_c99 = false;
171 allow_c11 = false; 171 allow_c11 = false;
172 allow_c23 = false; 172 allow_c23 = false;
173 break; 173 break;
174 case 'u': uflag = true; break; 174 case 'u': uflag = true; break;
175 case 'w': wflag = true; break; 175 case 'w': wflag = true; break;
176 case 'v': vflag = true; break; 176 case 'v': vflag = true; break;
177 case 'y': yflag = true; break; 177 case 'y': yflag = true; break;
178 case 'z': zflag = true; break; 178 case 'z': zflag = true; break;
179 179
180 case 'A': 180 case 'A':
181 if (strcmp(optarg, "c23") == 0) { 181 if (strcmp(optarg, "c23") == 0) {
182 allow_trad = false; 182 allow_trad = false;
183 allow_c90 = true; 183 allow_c90 = true;
184 allow_c99 = true; 184 allow_c99 = true;
185 allow_c11 = true; 185 allow_c11 = true;
186 allow_c23 = true; 186 allow_c23 = true;
187 } else if (strcmp(optarg, "c11") == 0) { 187 } else if (strcmp(optarg, "c11") == 0) {
188 allow_trad = false; 188 allow_trad = false;
189 allow_c90 = true; 189 allow_c90 = true;
190 allow_c99 = true; 190 allow_c99 = true;
191 allow_c11 = true; 191 allow_c11 = true;
192 allow_c23 = false; 192 allow_c23 = false;
193 } else 193 } else
194 usage(); 194 usage();
195 break; 195 break;
196 196
197 case 'm': 197 case 'm':
198 msglist(); 198 msglist();
199 return 0; 199 return 0;
200 200
201 case 'R': 201 case 'R':
202 add_directory_replacement(optarg); 202 add_directory_replacement(optarg);
203 break; 203 break;
204 204
205 case 'X': 205 case 'X':
206 suppress_messages(optarg); 206 suppress_messages(optarg);
207 break; 207 break;
208 default: 208 default:
209 usage(); 209 usage();
210 } 210 }
211 } 211 }
212 argc -= optind; 212 argc -= optind;
213 argv += optind; 213 argv += optind;
214 214
215 if (argc != 2) 215 if (argc != 2)
216 usage(); 216 usage();
217 217
218 218
219 /* initialize output */ 219 /* initialize output */
220 outopen(any_query_enabled ? "/dev/null" : argv[1]); 220 outopen(any_query_enabled ? "/dev/null" : argv[1]);
221 221
222#ifdef DEBUG 222#ifdef DEBUG
223 setvbuf(stdout, NULL, _IONBF, 0); 223 setvbuf(stdout, NULL, _IONBF, 0);
224#endif 224#endif
225#if YYDEBUG 225#if YYDEBUG
226 if (yflag) 226 if (yflag)
227 yydebug = 1; 227 yydebug = 1;
228#endif 228#endif
229 229
230 (void)signal(SIGFPE, sigfpe); 230 (void)signal(SIGFPE, sigfpe);
231 initdecl(); 231 initdecl();
232 initscan(); 232 initscan();
233 233
234 if (allow_gcc && allow_c90) { 234 if (allow_gcc && allow_c90) {
235 if ((yyin = gcc_builtins()) == NULL) 235 if ((yyin = gcc_builtins()) == NULL)
236 err(1, "cannot open builtins"); 236 err(1, "cannot open builtins");
237 curr_pos.p_file = "<gcc-builtins>"; 237 curr_pos.p_file = "<gcc-builtins>";
238 curr_pos.p_line = 0; 238 curr_pos.p_line = 0;
239 lex_next_line(); 239 lex_next_line();
240 yyparse(); 240 yyparse();
241 (void)fclose(yyin); 241 (void)fclose(yyin);
242 } 242 }
243 243
244 /* open the input file */ 244 /* open the input file */
245 if ((yyin = fopen(argv[0], "r")) == NULL) 245 if ((yyin = fopen(argv[0], "r")) == NULL)
246 err(1, "cannot open '%s'", argv[0]); 246 err(1, "cannot open '%s'", argv[0]);
247 curr_pos.p_file = argv[0]; 247 curr_pos.p_file = argv[0];
248 curr_pos.p_line = 0; 248 curr_pos.p_line = 0;
249 lex_next_line(); 249 lex_next_line();
250 yyparse(); 250 yyparse();
251 (void)fclose(yyin); 251 (void)fclose(yyin);
252 252
253 /* Following warnings cannot be suppressed by LINTED */ 253 /* Following warnings cannot be suppressed by LINTED */
254 lwarn = LWARN_ALL; 254 lwarn = LWARN_ALL;
255 debug_step("main lwarn = %d", lwarn); 255 debug_step("main lwarn = %d", lwarn);
256 256
257 check_global_symbols(); 257 check_global_symbols();
258 258
259 outclose(); 259 outclose();
260 260
261 return seen_error || (wflag && seen_warning) ? 1 : 0; 261 return seen_error || (wflag && seen_warning) ? 1 : 0;
262} 262}
263 263
264static void __attribute__((noreturn)) 264static void __dead
265usage(void) 265usage(void)
266{ 266{
267 (void)fprintf(stderr, 267 (void)fprintf(stderr,
268 "usage: %s [-abceghmprstuvwyzFPST] [-Alevel] [-ddirectory] " 268 "usage: %s [-abceghmprstuvwyzFPST] [-Alevel] [-ddirectory] "
269 "[-R old=new]\n" 269 "[-R old=new]\n"
270 " %*s [-X id,...] [-q id,...] src dest\n", 270 " %*s [-X id,...] [-q id,...] src dest\n",
271 getprogname(), (int)strlen(getprogname()), ""); 271 getprogname(), (int)strlen(getprogname()), "");
272 exit(1); 272 exit(1);
273} 273}
274 274
275void __attribute__((noreturn)) 275void __dead
276norecover(void) 276norecover(void)
277{ 277{
278 /* cannot recover from previous errors */ 278 /* cannot recover from previous errors */
279 error(224); 279 error(224);
280 exit(1); 280 exit(1);
281} 281}