From 1a7ac2bd24c1763b0d32e23d9c70308fbc24b07a Mon Sep 17 00:00:00 2001 From: Alfonso Gregory Date: Fri, 7 Jul 2023 10:39:23 -0600 Subject: [PATCH] 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/mesg/mesg.c | 2 +- usr.bin/mkfifo/mkfifo.c | 2 +- usr.bin/mktemp/mktemp.c | 2 +- usr.bin/mkuzip/mkuzip.c | 2 +- usr.bin/mt/mt.c | 2 +- usr.bin/netstat/main.c | 2 +- usr.bin/newkey/newkey.c | 2 +- usr.bin/nfsstat/nfsstat.c | 2 +- usr.bin/nohup/nohup.c | 2 +- usr.bin/paste/paste.c | 2 +- usr.bin/perror/perror.c | 2 +- usr.bin/quota/quota.c | 2 +- usr.bin/random/random.c | 2 +- usr.bin/rev/rev.c | 2 +- usr.bin/rpcgen/rpc_main.c | 2 +- usr.bin/rwall/rwall.c | 2 +- usr.bin/rwho/rwho.c | 2 +- 17 files changed, 17 insertions(+), 17 deletions(-) diff --git a/usr.bin/mesg/mesg.c b/usr.bin/mesg/mesg.c index 056e6e8f7ccc..f998e4cde7ac 100644 --- a/usr.bin/mesg/mesg.c +++ b/usr.bin/mesg/mesg.c @@ -57,7 +57,7 @@ __FBSDID("$FreeBSD$"); #include #include -static void usage(void); +static void usage(void) __dead2; int main(int argc, char *argv[]) diff --git a/usr.bin/mkfifo/mkfifo.c b/usr.bin/mkfifo/mkfifo.c index bbcb90173003..91355c142fce 100644 --- a/usr.bin/mkfifo/mkfifo.c +++ b/usr.bin/mkfifo/mkfifo.c @@ -56,7 +56,7 @@ __FBSDID("$FreeBSD$"); #define BASEMODE S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | \ S_IROTH | S_IWOTH -static void usage(void); +static void usage(void) __dead2; static int f_mode; diff --git a/usr.bin/mktemp/mktemp.c b/usr.bin/mktemp/mktemp.c index afc0c66b295f..e16c2a001a01 100644 --- a/usr.bin/mktemp/mktemp.c +++ b/usr.bin/mktemp/mktemp.c @@ -50,7 +50,7 @@ static const char rcsid[] = "$FreeBSD$"; #endif /* not lint */ -static void usage(void); +static void usage(void) __dead2; static const struct option long_opts[] = { {"directory", no_argument, NULL, 'd'}, diff --git a/usr.bin/mkuzip/mkuzip.c b/usr.bin/mkuzip/mkuzip.c index 7150a86f52b9..c834432a8347 100644 --- a/usr.bin/mkuzip/mkuzip.c +++ b/usr.bin/mkuzip/mkuzip.c @@ -99,7 +99,7 @@ static const struct mkuz_format uzip_fmts[] = { }; static struct mkuz_blk *readblock(int, u_int32_t); -static void usage(void); +static void usage(void) __dead2; static void cleanup(void); static char *cleanfile = NULL; diff --git a/usr.bin/mt/mt.c b/usr.bin/mt/mt.c index 89b86a6c1d3b..cfada982eaf8 100644 --- a/usr.bin/mt/mt.c +++ b/usr.bin/mt/mt.c @@ -180,7 +180,7 @@ static const struct commands { static const char *getblksiz(int); static void printreg(const char *, u_int, const char *); static void status(struct mtget *); -static void usage(void); +static void usage(void) __dead2; const char *get_driver_state_str(int dsreg); static void st_status (struct mtget *); static int mt_locate(int argc, char **argv, int mtfd, const char *tape); diff --git a/usr.bin/netstat/main.c b/usr.bin/netstat/main.c index f0db6409f1eb..61b4536a5788 100644 --- a/usr.bin/netstat/main.c +++ b/usr.bin/netstat/main.c @@ -192,7 +192,7 @@ static struct protox *protoprotox[] = { NULL }; static void printproto(struct protox *, const char *, bool *); -static void usage(void); +static void usage(void) __dead2; static struct protox *name2protox(const char *); static struct protox *knownname(const char *); diff --git a/usr.bin/newkey/newkey.c b/usr.bin/newkey/newkey.c index be3b2bb3927a..cc4a73f18081 100644 --- a/usr.bin/newkey/newkey.c +++ b/usr.bin/newkey/newkey.c @@ -90,7 +90,7 @@ static char PKFILE[] = "/etc/publickey"; static const char *err_string(int); #endif /* YP */ -static void usage(void); +static void usage(void) __dead2; int main(int argc, char *argv[]) diff --git a/usr.bin/nfsstat/nfsstat.c b/usr.bin/nfsstat/nfsstat.c index 37bec0daa9ac..9ea242cef890 100644 --- a/usr.bin/nfsstat/nfsstat.c +++ b/usr.bin/nfsstat/nfsstat.c @@ -109,7 +109,7 @@ static int extra_output = 0; static void intpr(int, int); static void printhdr(int, int, int); -static void usage(void); +static void usage(void) __dead2; static char *sperc1(int, int); static char *sperc2(int, int); static void exp_intpr(int, int, int); diff --git a/usr.bin/nohup/nohup.c b/usr.bin/nohup/nohup.c index 4e72f12c1a1d..358cca73fbf2 100644 --- a/usr.bin/nohup/nohup.c +++ b/usr.bin/nohup/nohup.c @@ -56,7 +56,7 @@ __FBSDID("$FreeBSD$"); #include static void dofile(void); -static void usage(void); +static void usage(void) __dead2; #define FILENAME "nohup.out" /* diff --git a/usr.bin/paste/paste.c b/usr.bin/paste/paste.c index 9d34c203e3b0..9296b94118b8 100644 --- a/usr.bin/paste/paste.c +++ b/usr.bin/paste/paste.c @@ -65,7 +65,7 @@ static int delimcnt; static int parallel(char **); static int sequential(char **); static int tr(wchar_t *); -static void usage(void); +static void usage(void) __dead2; static wchar_t tab[] = L"\t"; diff --git a/usr.bin/perror/perror.c b/usr.bin/perror/perror.c index bbf53e5e77c4..f6ffc9a5587c 100644 --- a/usr.bin/perror/perror.c +++ b/usr.bin/perror/perror.c @@ -37,7 +37,7 @@ __FBSDID("$FreeBSD$"); #include #include -static void usage(void); +static void usage(void) __dead2; int main(int argc, char **argv) diff --git a/usr.bin/quota/quota.c b/usr.bin/quota/quota.c index 7dceb67b23e8..2b8411c0f3b8 100644 --- a/usr.bin/quota/quota.c +++ b/usr.bin/quota/quota.c @@ -86,7 +86,7 @@ struct quotause { static char *timeprt(int64_t seconds); static struct quotause *getprivs(long id, int quotatype); -static void usage(void); +static void usage(void) __dead2; static int showuid(u_long uid); static int showgid(u_long gid); static int showusrname(char *name); diff --git a/usr.bin/random/random.c b/usr.bin/random/random.c index b3b349cbb75a..4325469608a8 100644 --- a/usr.bin/random/random.c +++ b/usr.bin/random/random.c @@ -61,7 +61,7 @@ __FBSDID("$FreeBSD$"); #include "randomize_fd.h" -static void usage(void); +static void usage(void) __dead2; int main(int argc, char *argv[]) diff --git a/usr.bin/rev/rev.c b/usr.bin/rev/rev.c index f04259639258..ab357fc275e1 100644 --- a/usr.bin/rev/rev.c +++ b/usr.bin/rev/rev.c @@ -55,7 +55,7 @@ __FBSDID("$FreeBSD$"); #include #include -static void usage(void); +static void usage(void) __dead2; int main(int argc, char *argv[]) diff --git a/usr.bin/rpcgen/rpc_main.c b/usr.bin/rpcgen/rpc_main.c index 1a2cae928472..644c090f82ab 100644 --- a/usr.bin/rpcgen/rpc_main.c +++ b/usr.bin/rpcgen/rpc_main.c @@ -64,7 +64,7 @@ static void clnt_output(const char *, const char *, int, const char * ); static char *generate_guard(const char *); static void c_initialize(void); -static void usage(void); +static void usage(void) __dead2; static void options_usage(void); static int do_registers(int, const char **); static int parseargs(int, const char **, struct commandline *); diff --git a/usr.bin/rwall/rwall.c b/usr.bin/rwall/rwall.c index 2daa6a8b6ea7..2ed658a14400 100644 --- a/usr.bin/rwall/rwall.c +++ b/usr.bin/rwall/rwall.c @@ -71,7 +71,7 @@ static char *mbuf; static char notty[] = "no tty"; static void makemsg(const char *); -static void usage(void); +static void usage(void) __dead2; /* ARGSUSED */ int diff --git a/usr.bin/rwho/rwho.c b/usr.bin/rwho/rwho.c index 8e6384161f28..adc697989a18 100644 --- a/usr.bin/rwho/rwho.c +++ b/usr.bin/rwho/rwho.c @@ -83,7 +83,7 @@ static struct myutmp { static time_t now; static int aflg; -static void usage(void); +static void usage(void) __dead2; static int utmpcmp(const void *, const void *); int