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 (expand / 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,14 +1,14 @@ @@ -1,14 +1,14 @@
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.
@@ -174,28 +174,27 @@ extern bool seen_warning; @@ -174,28 +174,27 @@ extern 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

cvs diff -r1.74 -r1.75 src/usr.bin/xlint/lint1/main1.c (expand / 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,14 +1,14 @@ @@ -1,14 +1,14 @@
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.
@@ -27,27 +27,27 @@ @@ -27,27 +27,27 @@
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;
@@ -251,31 +251,31 @@ main(int argc, char *argv[]) @@ -251,31 +251,31 @@ main(int argc, char *argv[])
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}