From 72e1ea2f13619f3bd299348f281815a6669f3775 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.sbin/accton/accton.c | 2 +- usr.sbin/arp/arp.c | 2 +- usr.sbin/bluetooth/bthidcontrol/bthidcontrol.c | 2 +- usr.sbin/bluetooth/btpand/btpand.c | 4 ++-- usr.sbin/boot0cfg/boot0cfg.c | 2 +- usr.sbin/bootparamd/bootparamd/main.c | 2 +- usr.sbin/bootparamd/callbootd/callbootd.c | 2 +- usr.sbin/btxld/btxld.c | 2 +- usr.sbin/chroot/chroot.c | 2 +- usr.sbin/ckdist/ckdist.c | 2 +- usr.sbin/crunch/crunchide/crunchide.c | 2 +- usr.sbin/edquota/edquota.c | 2 +- usr.sbin/efitable/efitable.c | 2 +- 13 files changed, 14 insertions(+), 14 deletions(-) diff --git a/usr.sbin/accton/accton.c b/usr.sbin/accton/accton.c index 80823ecabbc5..91b775928389 100644 --- a/usr.sbin/accton/accton.c +++ b/usr.sbin/accton/accton.c @@ -50,7 +50,7 @@ __FBSDID("$FreeBSD$"); #include #include -static void usage(void); +static void usage(void) __dead2; int main(int argc, char *argv[]) diff --git a/usr.sbin/arp/arp.c b/usr.sbin/arp/arp.c index 5a6c58e99e78..8b82d73aab08 100644 --- a/usr.sbin/arp/arp.c +++ b/usr.sbin/arp/arp.c @@ -90,7 +90,7 @@ static void nuke_entries(uint32_t ifindex, struct in_addr addr); static int print_entries(uint32_t ifindex, struct in_addr addr); static int delete(char *host); -static void usage(void); +static void usage(void) __dead2; static int set(int argc, char **argv); static int get(char *host); static int file(char *name); diff --git a/usr.sbin/bluetooth/bthidcontrol/bthidcontrol.c b/usr.sbin/bluetooth/bthidcontrol/bthidcontrol.c index deb890c573b0..c7d4369e5f6d 100644 --- a/usr.sbin/bluetooth/bthidcontrol/bthidcontrol.c +++ b/usr.sbin/bluetooth/bthidcontrol/bthidcontrol.c @@ -48,7 +48,7 @@ static int do_bthid_command(bdaddr_p bdaddr, int argc, char **argv); static struct bthid_command * find_bthid_command(char const *command, struct bthid_command *category); static void print_bthid_command(struct bthid_command *category); -static void usage(void); +static void usage(void) __dead2; int32_t hid_sdp_query(bdaddr_t const *local, bdaddr_t const *remote, int32_t *error); diff --git a/usr.sbin/bluetooth/btpand/btpand.c b/usr.sbin/bluetooth/btpand/btpand.c index 6e215fe32269..f226338edd15 100644 --- a/usr.sbin/bluetooth/btpand/btpand.c +++ b/usr.sbin/bluetooth/btpand/btpand.c @@ -72,9 +72,9 @@ static const struct { { "GN", SDP_SERVICE_CLASS_GN, "Group Network" }, }; -static void main_exit(int); +static void main_exit(int) __dead2; static void main_detach(void); -static void usage(void); +static void usage(void) __dead2; int main(int argc, char *argv[]) diff --git a/usr.sbin/boot0cfg/boot0cfg.c b/usr.sbin/boot0cfg/boot0cfg.c index bccab173e2fb..1b742dd6ef9c 100644 --- a/usr.sbin/boot0cfg/boot0cfg.c +++ b/usr.sbin/boot0cfg/boot0cfg.c @@ -107,7 +107,7 @@ static int boot0bs(const u_int8_t *); static void stropt(const char *, int *, int *); static int argtoi(const char *, int, int, int); static int set_bell(u_int8_t *, int, int); -static void usage(void); +static void usage(void) __dead2; static unsigned vol_id[5]; /* 4 plus 1 for flag */ diff --git a/usr.sbin/bootparamd/bootparamd/main.c b/usr.sbin/bootparamd/bootparamd/main.c index 95b49f8f39a0..578bb2605be6 100644 --- a/usr.sbin/bootparamd/bootparamd/main.c +++ b/usr.sbin/bootparamd/bootparamd/main.c @@ -39,7 +39,7 @@ const char *bootpfile = "/etc/bootparams"; static struct sockaddr_in my_addr; -static void usage(void); +static void usage(void) __dead2; int main(int argc, char **argv) diff --git a/usr.sbin/bootparamd/callbootd/callbootd.c b/usr.sbin/bootparamd/callbootd/callbootd.c index ea1432c3140a..0a0980bd4aa0 100644 --- a/usr.sbin/bootparamd/callbootd/callbootd.c +++ b/usr.sbin/bootparamd/callbootd/callbootd.c @@ -30,7 +30,7 @@ static char cln[MAX_MACHINE_NAME+1]; static char dmn[MAX_MACHINE_NAME+1]; static char path[MAX_PATH_LEN+1]; -static void usage(void); +static void usage(void) __dead2; int printgetfile(bp_getfile_res *); int printwhoami(bp_whoami_res *); diff --git a/usr.sbin/btxld/btxld.c b/usr.sbin/btxld/btxld.c index 5ce24a42b216..e7211ad48fa4 100644 --- a/usr.sbin/btxld/btxld.c +++ b/usr.sbin/btxld/btxld.c @@ -127,7 +127,7 @@ static unsigned int optfmt(const char *); static uint32_t optaddr(const char *); static int optpage(const char *, int); static void Warn(const char *, const char *, ...); -static void usage(void); +static void usage(void) __dead2; /* * A link editor for BTX clients. diff --git a/usr.sbin/chroot/chroot.c b/usr.sbin/chroot/chroot.c index b14e1cbf4597..59bf8f0791a2 100644 --- a/usr.sbin/chroot/chroot.c +++ b/usr.sbin/chroot/chroot.c @@ -58,7 +58,7 @@ __FBSDID("$FreeBSD$"); #include #include -static void usage(void); +static void usage(void) __dead2; int main(int argc, char *argv[]) diff --git a/usr.sbin/ckdist/ckdist.c b/usr.sbin/ckdist/ckdist.c index b64392dfb771..caee507f246b 100644 --- a/usr.sbin/ckdist/ckdist.c +++ b/usr.sbin/ckdist/ckdist.c @@ -86,7 +86,7 @@ static const char *stripath(const char *path); static int distfile(const char *path); static int disttype(const char *name); static int fail(const char *path, const char *msg); -static void usage(void); +static void usage(void) __dead2; int main(int argc, char *argv[]) diff --git a/usr.sbin/crunch/crunchide/crunchide.c b/usr.sbin/crunch/crunchide/crunchide.c index bd663e1d57bd..94778e8c9d3e 100644 --- a/usr.sbin/crunch/crunchide/crunchide.c +++ b/usr.sbin/crunch/crunchide/crunchide.c @@ -76,7 +76,7 @@ __FBSDID("$FreeBSD$"); static const char *pname = "crunchide"; -static void usage(void); +static void usage(void) __dead2; static void add_to_keep_list(char *symbol); static void add_file_to_keep_list(char *filename); diff --git a/usr.sbin/edquota/edquota.c b/usr.sbin/edquota/edquota.c index de2083506864..036b3f699eae 100644 --- a/usr.sbin/edquota/edquota.c +++ b/usr.sbin/edquota/edquota.c @@ -110,7 +110,7 @@ struct quotause *getprivs(long, int, char *); void putprivs(long, struct quotause *); int readprivs(struct quotause *, char *); int readtimes(struct quotause *, char *); -static void usage(void); +static void usage(void) __dead2; int writetimes(struct quotause *, int, int); int writeprivs(struct quotause *, int, char *, int); diff --git a/usr.sbin/efitable/efitable.c b/usr.sbin/efitable/efitable.c index 6bd4d96ffd2a..329c784611ae 100644 --- a/usr.sbin/efitable/efitable.c +++ b/usr.sbin/efitable/efitable.c @@ -48,7 +48,7 @@ __FBSDID("$FreeBSD$"); static void efi_table_print_esrt(const void *data); static void efi_table_print_prop(const void *data); -static void usage(void); +static void usage(void) __dead2; struct efi_table_op { char name[TABLE_MAX_LEN];