git: cccdaf507eee - main - Mark usage function as __dead2 in programs where it does not return

From: Warner Losh <imp_at_FreeBSD.org>
Date: Fri, 07 Jul 2023 16:51:13 UTC
The branch main has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=cccdaf507eee8fb34494b4624eb85bb951e323c8

commit cccdaf507eee8fb34494b4624eb85bb951e323c8
Author:     Alfonso Gregory <gfunni234@gmail.com>
AuthorDate: 2023-07-07 16:39:23 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2023-07-07 16:45:18 +0000

    Mark usage function as __dead2 in programs where it does not return
    
    In most cases, usage does not return, so mark them as __dead2. For the
    cases where they do return, they have not been marked __dead2.
    
    Reviewed by: imp
    Pull Request: https://github.com/freebsd/freebsd-src/pull/735
---
 usr.bin/script/script.c       | 2 +-
 usr.bin/sed/main.c            | 2 +-
 usr.bin/showmount/showmount.c | 2 +-
 usr.bin/split/split.c         | 2 +-
 usr.bin/tail/tail.c           | 2 +-
 usr.bin/tee/tee.c             | 2 +-
 usr.bin/time/time.c           | 2 +-
 usr.bin/tr/tr.c               | 2 +-
 usr.bin/tty/tty.c             | 2 +-
 usr.bin/ul/ul.c               | 2 +-
 usr.bin/uname/uname.c         | 2 +-
 usr.bin/unexpand/unexpand.c   | 2 +-
 usr.bin/usbhidctl/usbhid.c    | 2 +-
 usr.bin/wall/wall.c           | 2 +-
 usr.bin/what/what.c           | 2 +-
 usr.bin/whois/whois.c         | 2 +-
 usr.bin/write/write.c         | 2 +-
 usr.bin/xstr/xstr.c           | 2 +-
 18 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/usr.bin/script/script.c b/usr.bin/script/script.c
index 1d3588c26d8b..72e639e413dd 100644
--- a/usr.bin/script/script.c
+++ b/usr.bin/script/script.c
@@ -102,7 +102,7 @@ static void finish(void);
 static void record(FILE *, char *, size_t, int);
 static void consume(FILE *, off_t, char *, int);
 static void playback(FILE *) __dead2;
-static void usage(void);
+static void usage(void) __dead2;
 
 int
 main(int argc, char *argv[])
diff --git a/usr.bin/sed/main.c b/usr.bin/sed/main.c
index 44a274eb90e6..4139b69da2f8 100644
--- a/usr.bin/sed/main.c
+++ b/usr.bin/sed/main.c
@@ -121,7 +121,7 @@ u_long linenum;
 
 static void add_compunit(enum e_cut, char *);
 static void add_file(char *);
-static void usage(void);
+static void usage(void) __dead2;
 
 int
 main(int argc, char *argv[])
diff --git a/usr.bin/showmount/showmount.c b/usr.bin/showmount/showmount.c
index fbd1c9bbbe3c..d2b9f46792ba 100644
--- a/usr.bin/showmount/showmount.c
+++ b/usr.bin/showmount/showmount.c
@@ -97,7 +97,7 @@ static struct exportslist *exportslist;
 static int type = 0;
 
 void print_dump(struct mountlist *);
-static void usage(void);
+static void usage(void) __dead2;
 int xdr_mntdump(XDR *, struct mountlist **);
 int xdr_exportslist(XDR *, struct exportslist **);
 int tcp_callrpc(const char *host, int prognum, int versnum, int procnum,
diff --git a/usr.bin/split/split.c b/usr.bin/split/split.c
index 91710899a9e9..cee3980ea291 100644
--- a/usr.bin/split/split.c
+++ b/usr.bin/split/split.c
@@ -82,7 +82,7 @@ static void newfile(void);
 static void split1(void);
 static void split2(void);
 static void split3(void);
-static void usage(void);
+static void usage(void) __dead2;
 
 int
 main(int argc, char **argv)
diff --git a/usr.bin/tail/tail.c b/usr.bin/tail/tail.c
index e0266515d749..a9841f2d4a8a 100644
--- a/usr.bin/tail/tail.c
+++ b/usr.bin/tail/tail.c
@@ -70,7 +70,7 @@ int Fflag, fflag, qflag, rflag, rval, no_files, vflag;
 fileargs_t *fa;
 
 static void obsolete(char **);
-static void usage(void);
+static void usage(void) __dead2;
 
 static const struct option long_opts[] =
 {
diff --git a/usr.bin/tee/tee.c b/usr.bin/tee/tee.c
index bc338e14bd66..5646930a1c98 100644
--- a/usr.bin/tee/tee.c
+++ b/usr.bin/tee/tee.c
@@ -66,7 +66,7 @@ struct entry {
 static STAILQ_HEAD(, entry) head = STAILQ_HEAD_INITIALIZER(head);
 
 static void add(int, const char *);
-static void usage(void);
+static void usage(void) __dead2;
 
 int
 main(int argc, char *argv[])
diff --git a/usr.bin/time/time.c b/usr.bin/time/time.c
index 9121b1f14408..64063212170d 100644
--- a/usr.bin/time/time.c
+++ b/usr.bin/time/time.c
@@ -66,7 +66,7 @@ static void humantime(FILE *, long, long);
 static void showtime(FILE *, struct timespec *, struct timespec *,
     struct rusage *);
 static void siginfo(int);
-static void usage(void);
+static void usage(void) __dead2;
 
 static sig_atomic_t siginfo_recvd;
 static char decimal_point;
diff --git a/usr.bin/tr/tr.c b/usr.bin/tr/tr.c
index 2d1baad2ac09..32f1858049ac 100644
--- a/usr.bin/tr/tr.c
+++ b/usr.bin/tr/tr.c
@@ -67,7 +67,7 @@ static STR s1 = { STRING1, NORMAL, 0, OOBCH, 0, { 0, OOBCH }, NULL, NULL };
 static STR s2 = { STRING2, NORMAL, 0, OOBCH, 0, { 0, OOBCH }, NULL, NULL };
 
 static struct cset *setup(char *, STR *, int, int);
-static void usage(void);
+static void usage(void) __dead2;
 
 int
 main(int argc, char **argv)
diff --git a/usr.bin/tty/tty.c b/usr.bin/tty/tty.c
index 02fc2fec1e28..4f9549eb67c5 100644
--- a/usr.bin/tty/tty.c
+++ b/usr.bin/tty/tty.c
@@ -48,7 +48,7 @@ __FBSDID("$FreeBSD$");
 #include <stdlib.h>
 #include <unistd.h>
 
-static void usage(void);
+static void usage(void) __dead2;
 
 int
 main(int argc, char *argv[])
diff --git a/usr.bin/ul/ul.c b/usr.bin/ul/ul.c
index 14b1d87905d2..07a796ffd55b 100644
--- a/usr.bin/ul/ul.c
+++ b/usr.bin/ul/ul.c
@@ -89,7 +89,7 @@ static int	halfpos;
 static int	upln;
 static int	iflag;
 
-static void usage(void);
+static void usage(void) __dead2;
 static void setnewmode(int);
 static void initcap(void);
 static void reverse(void);
diff --git a/usr.bin/uname/uname.c b/usr.bin/uname/uname.c
index 109505e4b9da..980705e984f4 100644
--- a/usr.bin/uname/uname.c
+++ b/usr.bin/uname/uname.c
@@ -85,7 +85,7 @@ static void native_uservers(void);
 static void native_buildid(void);
 static void print_uname(u_int);
 static void setup_get(void);
-static void usage(void);
+static void usage(void) __dead2;
 
 static char *buildid, *ident, *platform, *hostname, *arch, *release, *sysname,
     *version, *kernvers, *uservers;
diff --git a/usr.bin/unexpand/unexpand.c b/usr.bin/unexpand/unexpand.c
index 08ba8ffe1dc4..47a3b1f611ca 100644
--- a/usr.bin/unexpand/unexpand.c
+++ b/usr.bin/unexpand/unexpand.c
@@ -62,7 +62,7 @@ static int	nstops;
 static int	tabstops[100];
 
 static void getstops(const char *);
-static void usage(void);
+static void usage(void) __dead2;
 static int tabify(const char *);
 
 int
diff --git a/usr.bin/usbhidctl/usbhid.c b/usr.bin/usbhidctl/usbhid.c
index 984cdebc3289..b814aa3924d1 100644
--- a/usr.bin/usbhidctl/usbhid.c
+++ b/usr.bin/usbhidctl/usbhid.c
@@ -58,7 +58,7 @@ static int hexdump = 0;
 static int wflag = 0;
 static int zflag = 0;
 
-static void usage(void);
+static void usage(void) __dead2;
 static void dumpitem(const char *label, struct hid_item *h);
 static void dumpitems(report_desc_t r);
 static void prdata(u_char *buf, struct hid_item *h);
diff --git a/usr.bin/wall/wall.c b/usr.bin/wall/wall.c
index a02f103cb80f..b1db354e6ec3 100644
--- a/usr.bin/wall/wall.c
+++ b/usr.bin/wall/wall.c
@@ -70,7 +70,7 @@ static const char sccsid[] = "@(#)wall.c	8.2 (Berkeley) 11/16/93";
 #include "ttymsg.h"
 
 static void makemsg(char *);
-static void usage(void);
+static void usage(void) __dead2;
 
 static struct wallgroup {
 	struct wallgroup *next;
diff --git a/usr.bin/what/what.c b/usr.bin/what/what.c
index 6d59f70cb589..5430a1fa0f35 100644
--- a/usr.bin/what/what.c
+++ b/usr.bin/what/what.c
@@ -49,7 +49,7 @@ static const char sccsid[] = "@(#)what.c	8.1 (Berkeley) 6/6/93";
 #include <stdlib.h>
 #include <unistd.h>
 
-static void usage(void);
+static void usage(void) __dead2;
 static bool search(bool, bool, FILE *);
 
 int
diff --git a/usr.bin/whois/whois.c b/usr.bin/whois/whois.c
index d98120052b76..5dccb3c4a485 100644
--- a/usr.bin/whois/whois.c
+++ b/usr.bin/whois/whois.c
@@ -159,7 +159,7 @@ static const char *port = DEFAULT_PORT;
 static const char *choose_server(char *);
 static struct addrinfo *gethostinfo(const char *, const char *, int);
 static void s_asprintf(char **ret, const char *format, ...) __printflike(2, 3);
-static void usage(void);
+static void usage(void) __dead2;
 static void whois(const char *, const char *, const char *, int);
 
 int
diff --git a/usr.bin/write/write.c b/usr.bin/write/write.c
index 06cae97d9fc9..399373c5bc57 100644
--- a/usr.bin/write/write.c
+++ b/usr.bin/write/write.c
@@ -71,7 +71,7 @@ __FBSDID("$FreeBSD$");
 
 void done(int);
 void do_write(int, char *, char *, const char *);
-static void usage(void);
+static void usage(void) __dead2;
 int term_chk(int, char *, int *, time_t *, int);
 void wr_fputs(wchar_t *s);
 void search_utmp(int, char *, char *, char *, uid_t);
diff --git a/usr.bin/xstr/xstr.c b/usr.bin/xstr/xstr.c
index da96581c3f2b..af9f0d2893bb 100644
--- a/usr.bin/xstr/xstr.c
+++ b/usr.bin/xstr/xstr.c
@@ -84,7 +84,7 @@ static int xgetc(FILE *);
 static off_t hashit(char *, int);
 static off_t yankstr(char **);
 
-static void usage(void);
+static void usage(void) __dead2;
 
 static void flushsh(void);
 static void found(int, off_t, char *);