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
This commit is contained in:
Alfonso Gregory 2023-07-07 10:39:23 -06:00 committed by Warner Losh
parent a9cce232a6
commit a2cc93ec7f
11 changed files with 13 additions and 14 deletions

View File

@ -53,7 +53,7 @@ __FBSDID("$FreeBSD$");
#include <fs/nfs/nfs.h>
#include <fs/nfs/nfsrvstate.h>
static void usage(void);
static void usage(void) __dead2;
static struct option longopts[] = {
{ "migrate", required_argument, NULL, 'm' },

View File

@ -46,7 +46,7 @@ __FBSDID("$FreeBSD$");
#include <fs/nfs/nfs.h>
#include <fs/nfs/nfsrvstate.h>
static void usage(void);
static void usage(void) __dead2;
static struct option longopts[] = {
{ "changeds", required_argument, NULL, 'c' },

View File

@ -43,7 +43,7 @@ __FBSDID("$FreeBSD$");
#include <fs/nfs/nfskpiport.h>
#include <fs/nfs/nfs.h>
static void usage(void);
static void usage(void) __dead2;
static struct option longopts[] = {
{ "force", no_argument, NULL, 'f' },

View File

@ -70,7 +70,7 @@ static int vflag; /* verbose */
static int oneof(char *, char *[], int);
static int quotaonoff(struct fstab *fs, int, int);
static void usage(void);
static void usage(void) __dead2;
int
main(int argc, char **argv)

View File

@ -104,7 +104,7 @@ int oneof(char *, char *[], int);
int repquota(struct fstab *, int);
char *timeprt(time_t);
static void prthumanval(int64_t bytes);
static void usage(void);
static void usage(void) __dead2;
int
main(int argc, char *argv[])

View File

@ -62,7 +62,7 @@ static struct rip6 *ripbuf;
#define RIPSIZE(n) (sizeof(struct rip6) + (n-1) * sizeof(struct netinfo6))
int main(int, char **);
static void usage(void);
static void usage(void) __dead2;
static const char *sa_n2a(struct sockaddr *);
static const char *inet6_n2a(struct in6_addr *);
@ -90,7 +90,6 @@ main(int argc, char *argv[])
break;
default:
usage();
exit(1);
/*NOTREACHED*/
}
}
@ -99,7 +98,6 @@ main(int argc, char *argv[])
if (argc != 1) {
usage();
exit(1);
}
if ((s = socket(AF_INET6, SOCK_DGRAM, 0)) < 0) {
@ -168,13 +166,14 @@ main(int argc, char *argv[])
}
} while (len == RIPSIZE(24));
exit(0);
return 0;
}
static void
usage(void)
{
fprintf(stderr, "usage: rip6query [-I iface] address\n");
exit(1);
}
/* getnameinfo() is preferred as we may be able to show ifindex as ifname */

View File

@ -49,7 +49,7 @@ __FBSDID("$FreeBSD$");
#include <unistd.h>
static int parseint(const char *, const char *);
static void usage(void);
static void usage(void) __dead2;
int
main(int argc, char *argv[])

View File

@ -137,7 +137,7 @@ void run_as(uid_t *uid, gid_t *gid);
void quit(const char *msg);
void sender_process(void);
int verify(char *name, int maxlen);
static void usage(void);
static void usage(void) __dead2;
#ifdef DEBUG
char *interval(int time, char *updown);

View File

@ -45,7 +45,7 @@ __FBSDID("$FreeBSD$");
#include <sys/socket.h>
#include <sys/sysctl.h>
static void usage(void);
static void usage(void) __dead2;
int
main(int argc, char *argv[])

View File

@ -47,7 +47,7 @@ static const char rcsid[] =
#define SPRAYOVERHEAD 86
#endif
static void usage(void);
static void usage(void) __dead2;
static void print_xferstats(unsigned int, int, double);
/* spray buffer */

View File

@ -58,7 +58,7 @@ static bool tcpdropall(const char *, const char *, int);
static bool tcpdropbyname(const char *, const char *, const char *,
const char *);
static bool tcpdropconn(const struct in_conninfo *);
static void usage(void);
static void usage(void) __dead2;
/*
* Drop a tcp connection.