Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 7 Jul 2023 16:51:11 GMT
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: a1b6427a9787 - main - Mark usage function as __dead2 in programs where it does not return
Message-ID:  <202307071651.367GpB0K010691@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by imp:

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

commit a1b6427a97879ee0034797b2c75ecd107312456a
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/elfctl/elfctl.c           | 2 +-
 usr.bin/elfdump/elfdump.c         | 2 +-
 usr.bin/env/env.c                 | 2 +-
 usr.bin/find/main.c               | 2 +-
 usr.bin/finger/finger.c           | 2 +-
 usr.bin/fold/fold.c               | 2 +-
 usr.bin/fortune/strfile/strfile.c | 2 +-
 usr.bin/from/from.c               | 2 +-
 usr.bin/grdc/grdc.c               | 2 +-
 usr.bin/head/head.c               | 2 +-
 usr.bin/join/join.c               | 2 +-
 usr.bin/ktrace/ktrace.c           | 2 +-
 usr.bin/ktrdump/ktrdump.c         | 2 +-
 usr.bin/leave/leave.c             | 2 +-
 usr.bin/limits/limits.c           | 2 +-
 usr.bin/lock/lock.c               | 2 +-
 usr.bin/lockf/lockf.c             | 2 +-
 usr.bin/look/look.c               | 2 +-
 18 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/usr.bin/elfctl/elfctl.c b/usr.bin/elfctl/elfctl.c
index 41b45aee80b8..5c15ddd43528 100644
--- a/usr.bin/elfctl/elfctl.c
+++ b/usr.bin/elfctl/elfctl.c
@@ -56,7 +56,7 @@ static bool edit_file_features(Elf *, int, int, char *, bool);
 static bool get_file_features(Elf *, int, int, uint32_t *, uint64_t *, bool);
 static void print_features(void);
 static bool print_file_features(Elf *, int, int, char *, bool);
-static void usage(void);
+static void usage(void) __dead2;
 
 struct ControlFeatures {
 	const char *alias;
diff --git a/usr.bin/elfdump/elfdump.c b/usr.bin/elfdump/elfdump.c
index b7f60d0eb27b..0ab64534ac50 100644
--- a/usr.bin/elfdump/elfdump.c
+++ b/usr.bin/elfdump/elfdump.c
@@ -473,7 +473,7 @@ static void elf_print_got(Elf32_Ehdr *e, void *sh);
 static void elf_print_hash(Elf32_Ehdr *e, void *sh);
 static void elf_print_note(Elf32_Ehdr *e, void *sh);
 
-static void usage(void);
+static void usage(void) __dead2;
 
 /*
  * Helpers for ELF files with shnum or shstrndx values that don't fit in the
diff --git a/usr.bin/env/env.c b/usr.bin/env/env.c
index a0f55d665a9a..4c4e36d12075 100644
--- a/usr.bin/env/env.c
+++ b/usr.bin/env/env.c
@@ -62,7 +62,7 @@ extern char **environ;
 
 int	 env_verbosity;
 
-static void usage(void);
+static void usage(void) __dead2;
 
 /*
  * Exit codes.
diff --git a/usr.bin/find/main.c b/usr.bin/find/main.c
index 45a95a454d94..6090f71d6e7c 100644
--- a/usr.bin/find/main.c
+++ b/usr.bin/find/main.c
@@ -71,7 +71,7 @@ int mindepth = -1, maxdepth = -1; /* minimum and maximum depth */
 int regexp_flags = REG_BASIC;	/* use the "basic" regexp by default*/
 int exitstatus;
 
-static void usage(void);
+static void usage(void) __dead2;
 
 int
 main(int argc, char *argv[])
diff --git a/usr.bin/finger/finger.c b/usr.bin/finger/finger.c
index 1211c54eb950..6f357f9d994b 100644
--- a/usr.bin/finger/finger.c
+++ b/usr.bin/finger/finger.c
@@ -98,7 +98,7 @@ int invoker_root = 0;
 
 static void loginlist(void);
 static int option(int, char **);
-static void usage(void);
+static void usage(void) __dead2;
 static void userlist(int, char **);
 
 static int
diff --git a/usr.bin/fold/fold.c b/usr.bin/fold/fold.c
index 06473b40e787..e2995ee049cd 100644
--- a/usr.bin/fold/fold.c
+++ b/usr.bin/fold/fold.c
@@ -61,7 +61,7 @@ __FBSDID("$FreeBSD$");
 
 void fold(int);
 static int newpos(int, wint_t);
-static void usage(void);
+static void usage(void) __dead2;
 
 static int bflag;		/* Count bytes, not columns */
 static int sflag;		/* Split on word boundaries */
diff --git a/usr.bin/fortune/strfile/strfile.c b/usr.bin/fortune/strfile/strfile.c
index f6cda6cd3900..abc35946e77e 100644
--- a/usr.bin/fortune/strfile/strfile.c
+++ b/usr.bin/fortune/strfile/strfile.c
@@ -126,7 +126,7 @@ static int stable_collate_range_cmp(int, int);
 static void do_order(void);
 static void getargs(int, char **);
 static void randomize(void);
-static void usage(void);
+static void usage(void) __dead2;
 
 /*
  * main:
diff --git a/usr.bin/from/from.c b/usr.bin/from/from.c
index 0b2ad7091e04..5569ec1c2757 100644
--- a/usr.bin/from/from.c
+++ b/usr.bin/from/from.c
@@ -54,7 +54,7 @@ __FBSDID("$FreeBSD$");
 #include <unistd.h>
 
 static int match(const char *, const char *);
-static void usage(void);
+static void usage(void) __dead2;
 
 int
 main(int argc, char **argv)
diff --git a/usr.bin/grdc/grdc.c b/usr.bin/grdc/grdc.c
index 04cc00b37d6f..72329c07f70e 100644
--- a/usr.bin/grdc/grdc.c
+++ b/usr.bin/grdc/grdc.c
@@ -43,7 +43,7 @@ static void set(int, int);
 static void standt(int);
 static void movto(int, int);
 static void sighndl(int);
-static void usage(void);
+static void usage(void) __dead2;
 
 static void
 sighndl(int signo)
diff --git a/usr.bin/head/head.c b/usr.bin/head/head.c
index 1c6368823e7c..e323099754ab 100644
--- a/usr.bin/head/head.c
+++ b/usr.bin/head/head.c
@@ -71,7 +71,7 @@ __FBSDID("$FreeBSD$");
 static void head(FILE *, intmax_t);
 static void head_bytes(FILE *, off_t);
 static void obsolete(char *[]);
-static void usage(void);
+static void usage(void) __dead2;
 
 static const struct option long_opts[] =
 {
diff --git a/usr.bin/join/join.c b/usr.bin/join/join.c
index 40107802a1f8..0ad4b467793e 100644
--- a/usr.bin/join/join.c
+++ b/usr.bin/join/join.c
@@ -114,7 +114,7 @@ static void outoneline(INPUT *, LINE *);
 static void outtwoline(INPUT *, LINE *, INPUT *, LINE *);
 static void slurp(INPUT *);
 static wchar_t *towcs(const char *);
-static void usage(void);
+static void usage(void) __dead2;
 
 int
 main(int argc, char *argv[])
diff --git a/usr.bin/ktrace/ktrace.c b/usr.bin/ktrace/ktrace.c
index cd53ca03ad44..1b477fca2fc1 100644
--- a/usr.bin/ktrace/ktrace.c
+++ b/usr.bin/ktrace/ktrace.c
@@ -67,7 +67,7 @@ static int pid;
 
 static void no_ktrace(int);
 static void set_pid_clear(const char *, enum clear);
-static void usage(void);
+static void usage(void) __dead2;
 
 int
 main(int argc, char *argv[])
diff --git a/usr.bin/ktrdump/ktrdump.c b/usr.bin/ktrdump/ktrdump.c
index 0ffd4cdd9352..4718a577f52d 100644
--- a/usr.bin/ktrdump/ktrdump.c
+++ b/usr.bin/ktrdump/ktrdump.c
@@ -53,7 +53,7 @@ __FBSDID("$FreeBSD$");
 #define	USAGE \
 	"usage: ktrdump [-cflqrtH] [-i ktrfile] [-M core] [-N system] [-o outfile]\n"
 
-static void usage(void);
+static void usage(void) __dead2;
 
 static struct nlist nl[] = {
 	{ .n_name = "_ktr_version" },
diff --git a/usr.bin/leave/leave.c b/usr.bin/leave/leave.c
index 1e3d4ed78ae1..bc2d524b7f94 100644
--- a/usr.bin/leave/leave.c
+++ b/usr.bin/leave/leave.c
@@ -52,7 +52,7 @@ __FBSDID("$FreeBSD$");
 #include <unistd.h>
 
 static void doalarm(u_int);
-static void usage(void);
+static void usage(void) __dead2;
 
 /*
  * leave [[+]hhmm]
diff --git a/usr.bin/limits/limits.c b/usr.bin/limits/limits.c
index c0c652d065ac..558d8adf1f0a 100644
--- a/usr.bin/limits/limits.c
+++ b/usr.bin/limits/limits.c
@@ -257,7 +257,7 @@ static struct {
 #define RCS_STRING  "tfdscmlunbvpwko"
 
 static rlim_t resource_num(int which, int ch, const char *str);
-static void usage(void);
+static void usage(void) __dead2;
 static int getshelltype(void);
 static void print_limit(rlim_t limit, unsigned divisor, const char *inf,
 			const char *pfx, const char *sfx, const char *which);
diff --git a/usr.bin/lock/lock.c b/usr.bin/lock/lock.c
index d8644f7010a9..30b7e7ac9df6 100644
--- a/usr.bin/lock/lock.c
+++ b/usr.bin/lock/lock.c
@@ -81,7 +81,7 @@ __FBSDID("$FreeBSD$");
 static void quit(int);
 static void bye(int);
 static void hi(int);
-static void usage(void);
+static void usage(void) __dead2;
 
 static struct timeval	timeout;
 static struct timeval	zerotime;
diff --git a/usr.bin/lockf/lockf.c b/usr.bin/lockf/lockf.c
index b330f3e6700d..3f582d014314 100644
--- a/usr.bin/lockf/lockf.c
+++ b/usr.bin/lockf/lockf.c
@@ -44,7 +44,7 @@ static int acquire_lock(const char *name, int flags);
 static void cleanup(void);
 static void killed(int sig);
 static void timeout(int sig);
-static void usage(void);
+static void usage(void) __dead2;
 static void wait_for_lock(const char *name);
 
 static const char *lockname;
diff --git a/usr.bin/look/look.c b/usr.bin/look/look.c
index 6335548c07fd..cded8d398401 100644
--- a/usr.bin/look/look.c
+++ b/usr.bin/look/look.c
@@ -89,7 +89,7 @@ static int	 look(wchar_t *, unsigned char *, unsigned char *);
 static wchar_t	*prepkey(const char *, wchar_t);
 static void	 print_from(wchar_t *, unsigned char *, unsigned char *);
 
-static void usage(void);
+static void usage(void) __dead2;
 
 static struct option longopts[] = {
 	{ "alternative",no_argument,	NULL, 'a' },



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202307071651.367GpB0K010691>