git: a9cce232a6b9 - main - Mark usage function as __dead2 in programs where it does not return
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 07 Jul 2023 16:51:16 UTC
The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=a9cce232a6b930d2d1932f1f20a86a84d9cc77cd commit a9cce232a6b930d2d1932f1f20a86a84d9cc77cd 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.sbin/fdcontrol/fdcontrol.c | 2 +- usr.sbin/gstat/gstat.c | 2 +- usr.sbin/iostat/iostat.c | 5 ++--- usr.sbin/ip6addrctl/ip6addrctl.c | 2 +- usr.sbin/jail/jail.c | 2 +- usr.sbin/ndp/ndp.c | 2 +- usr.sbin/newsyslog/newsyslog.c | 2 +- usr.sbin/nfsdumpstate/nfsdumpstate.c | 2 +- usr.sbin/nfsrevoke/nfsrevoke.c | 2 +- usr.sbin/nscd/nscd.c | 2 +- usr.sbin/nvram/nvram.c | 2 +- 11 files changed, 12 insertions(+), 13 deletions(-) diff --git a/usr.sbin/fdcontrol/fdcontrol.c b/usr.sbin/fdcontrol/fdcontrol.c index 953076b5af93..d0ea0c705ae5 100644 --- a/usr.sbin/fdcontrol/fdcontrol.c +++ b/usr.sbin/fdcontrol/fdcontrol.c @@ -47,7 +47,7 @@ static int format, verbose, show = 1, showfmt; static char *fmtstring; static void showdev(enum fd_drivetype, const char *); -static void usage(void); +static void usage(void) __dead2; static void usage(void) diff --git a/usr.sbin/gstat/gstat.c b/usr.sbin/gstat/gstat.c index cd44c740a3b4..b9f5d5eff449 100644 --- a/usr.sbin/gstat/gstat.c +++ b/usr.sbin/gstat/gstat.c @@ -66,7 +66,7 @@ static int flag_I = 1000000; printw(__VA_ARGS__); \ } while(0) -static void usage(void); +static void usage(void) __dead2; static const char* el_prompt(void) diff --git a/usr.sbin/iostat/iostat.c b/usr.sbin/iostat/iostat.c index 7c4dcf16e0a5..076f2acfe4e0 100644 --- a/usr.sbin/iostat/iostat.c +++ b/usr.sbin/iostat/iostat.c @@ -149,7 +149,7 @@ static int dflag = 0, Iflag = 0, Cflag = 0, Tflag = 0, oflag = 0, Kflag = 0; static int xflag = 0, zflag = 0; /* local function declarations */ -static void usage(void); +static void usage(void) __dead2; static void needhdr(int signo); static void needresize(int signo); static void needreturn(int signo); @@ -173,6 +173,7 @@ usage(void) fprintf(stderr, "usage: iostat [-CdhIKoTxz?] [-c count] [-M core]" " [-n devs] [-N system]\n" "\t [-t type,if,pass] [-w wait] [drives]\n"); + exit(1); } int @@ -261,8 +262,6 @@ main(int argc, char **argv) break; default: usage(); - exit(1); - break; } } diff --git a/usr.sbin/ip6addrctl/ip6addrctl.c b/usr.sbin/ip6addrctl/ip6addrctl.c index 06d527dac2ce..12903ab25f66 100644 --- a/usr.sbin/ip6addrctl/ip6addrctl.c +++ b/usr.sbin/ip6addrctl/ip6addrctl.c @@ -62,7 +62,7 @@ struct policyqueue { TAILQ_HEAD(policyhead, policyqueue); static struct policyhead policyhead; -static void usage(void); +static void usage(void) __dead2; static void get_policy(void); static void dump_policy(void); static int mask2plen(struct sockaddr_in6 *); diff --git a/usr.sbin/jail/jail.c b/usr.sbin/jail/jail.c index a2c725d51b70..b8cccbbd625e 100644 --- a/usr.sbin/jail/jail.c +++ b/usr.sbin/jail/jail.c @@ -73,7 +73,7 @@ static void print_jail(FILE *fp, struct cfjail *j, int oldcl, int running); static void print_param(FILE *fp, const struct cfparam *p, int sep, int doname); static void show_jails(void); static void quoted_print(FILE *fp, char *str); -static void usage(void); +static void usage(void) __dead2; static struct permspec perm_sysctl[] = { { "security.jail.set_hostname_allowed", KP_ALLOW_SET_HOSTNAME, 0 }, diff --git a/usr.sbin/ndp/ndp.c b/usr.sbin/ndp/ndp.c index 112fd099e3e0..becc04ec5f10 100644 --- a/usr.sbin/ndp/ndp.c +++ b/usr.sbin/ndp/ndp.c @@ -138,7 +138,7 @@ static int delete(char *); static int dump(struct sockaddr_in6 *, int); static struct in6_nbrinfo *getnbrinfo(struct in6_addr *, int, int); static int ndp_ether_aton(char *, u_char *); -static void usage(void); +static void usage(void) __dead2; static void ifinfo(char *, int, char **); static void rtrlist(void); static void plist(void); diff --git a/usr.sbin/newsyslog/newsyslog.c b/usr.sbin/newsyslog/newsyslog.c index 8f8bb54e9b46..5cd0f8b7a5d1 100644 --- a/usr.sbin/newsyslog/newsyslog.c +++ b/usr.sbin/newsyslog/newsyslog.c @@ -281,7 +281,7 @@ static struct conf_entry *init_entry(const char *fname, struct conf_entry *src_entry); static void parse_args(int argc, char **argv); static int parse_doption(const char *doption); -static void usage(void); +static void usage(void) __dead2; static int log_trim(const char *logname, const struct conf_entry *log_ent); static int age_old_log(const char *file); static void savelog(char *from, char *to); diff --git a/usr.sbin/nfsdumpstate/nfsdumpstate.c b/usr.sbin/nfsdumpstate/nfsdumpstate.c index c7e086655f79..16f6efab3033 100644 --- a/usr.sbin/nfsdumpstate/nfsdumpstate.c +++ b/usr.sbin/nfsdumpstate/nfsdumpstate.c @@ -56,7 +56,7 @@ __FBSDID("$FreeBSD$"); static void dump_lockstate(char *); static void dump_openstate(void); -static void usage(void); +static void usage(void) __dead2; static char *open_flags(uint32_t); static char *deleg_flags(uint32_t); static char *lock_flags(uint32_t); diff --git a/usr.sbin/nfsrevoke/nfsrevoke.c b/usr.sbin/nfsrevoke/nfsrevoke.c index 85eb48bfa8fb..e9750afac722 100644 --- a/usr.sbin/nfsrevoke/nfsrevoke.c +++ b/usr.sbin/nfsrevoke/nfsrevoke.c @@ -57,7 +57,7 @@ __FBSDID("$FreeBSD$"); #include <string.h> #include <unistd.h> -static void usage(void); +static void usage(void) __dead2; int main(int argc, char **argv) diff --git a/usr.sbin/nscd/nscd.c b/usr.sbin/nscd/nscd.c index 8a569a2dc9ab..14d0a6780bf4 100644 --- a/usr.sbin/nscd/nscd.c +++ b/usr.sbin/nscd/nscd.c @@ -85,7 +85,7 @@ static void process_socket_event(struct kevent *, struct runtime_env *, static void process_timer_event(struct kevent *, struct runtime_env *, struct configuration *); static void *processing_thread(void *); -static void usage(void); +static void usage(void) __dead2; void get_time_func(struct timeval *); diff --git a/usr.sbin/nvram/nvram.c b/usr.sbin/nvram/nvram.c index 52c1e809ae71..4a6a09ecd8f6 100644 --- a/usr.sbin/nvram/nvram.c +++ b/usr.sbin/nvram/nvram.c @@ -41,7 +41,7 @@ #define DEVICE_NAME (_PATH_DEV "powermac_nvram") -static void usage(void); +static void usage(void) __dead2; static int remove_var(uint8_t *, int, const char *); static int append_var(uint8_t *, int, const char *, const char *);