Mark functions as __dead2 in order to help the LLVM static checker
understand which code paths aren't possible. This commit eliminates 117 false positive bug reports of the form "allocate memory; error out if pointer is NULL; use pointer".
This commit is contained in:
parent
a5c1d60642
commit
45f0d08992
@ -55,7 +55,7 @@ __FBSDID("$FreeBSD$");
|
||||
* Report an error and exit.
|
||||
* Use it instead of err(3) to avoid linking-in stdio.
|
||||
*/
|
||||
static void
|
||||
static __dead2 void
|
||||
errexit(const char *prog, const char *reason)
|
||||
{
|
||||
char *errstr = strerror(errno);
|
||||
|
@ -103,7 +103,7 @@ static void indent(int, FILE *);
|
||||
static int nextfield(char *);
|
||||
static void skipbl(void);
|
||||
static int readline(void);
|
||||
static void error(const char *, ...) __printf0like(1, 2);
|
||||
static void error(const char *, ...) __printf0like(1, 2) __dead2;
|
||||
static char *savestr(const char *);
|
||||
|
||||
|
||||
|
@ -44,7 +44,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include "stty.h"
|
||||
#include "extern.h"
|
||||
|
||||
static void gerr(const char *s);
|
||||
static void gerr(const char *s) __dead2;
|
||||
|
||||
static void
|
||||
gerr(const char *s)
|
||||
|
@ -92,7 +92,7 @@ struct archive {
|
||||
void __archive_check_magic(struct archive *, unsigned int magic,
|
||||
unsigned int state, const char *func);
|
||||
|
||||
void __archive_errx(int retvalue, const char *msg);
|
||||
void __archive_errx(int retvalue, const char *msg) __dead2;
|
||||
|
||||
#define err_combine(a,b) ((a) < (b) ? (a) : (b))
|
||||
|
||||
|
@ -62,7 +62,7 @@ static const char rcsid[] =
|
||||
#include <string.h>
|
||||
#include "pathnames.h"
|
||||
|
||||
void logerr(const char *, ...) __printflike(1, 2);
|
||||
void logerr(const char *, ...) __printflike(1, 2) __dead2;
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
|
@ -85,7 +85,7 @@ struct cpio {
|
||||
/* Name of this program; used in error reporting, initialized in main(). */
|
||||
const char *cpio_progname;
|
||||
|
||||
void cpio_errc(int _eval, int _code, const char *fmt, ...);
|
||||
void cpio_errc(int _eval, int _code, const char *fmt, ...) __dead2;
|
||||
void cpio_warnc(int _code, const char *fmt, ...);
|
||||
|
||||
int owner_parse(const char *, int *, int *);
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include <sys/cdefs.h>
|
||||
#else
|
||||
#define __unused
|
||||
#define __dead2
|
||||
#endif
|
||||
|
||||
#define FLEX_SCANNER
|
||||
@ -290,7 +291,7 @@ static void yy_flex_free YY_PROTO(( void * ));
|
||||
static yy_state_type yy_get_previous_state YY_PROTO(( void ));
|
||||
static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));
|
||||
static int yy_get_next_buffer YY_PROTO(( void ));
|
||||
static void yy_fatal_error YY_PROTO(( yyconst char msg[] ));
|
||||
static void yy_fatal_error YY_PROTO(( yyconst char msg[] )) __dead2;
|
||||
%*
|
||||
|
||||
/* Done after the current pattern has been matched and before the
|
||||
|
@ -103,7 +103,7 @@ struct bsdtar {
|
||||
};
|
||||
|
||||
void bsdtar_errc(struct bsdtar *, int _eval, int _code,
|
||||
const char *fmt, ...);
|
||||
const char *fmt, ...) __dead2;
|
||||
void bsdtar_warnc(struct bsdtar *, int _code, const char *fmt, ...);
|
||||
void cleanup_exclusions(struct bsdtar *);
|
||||
void do_chdir(struct bsdtar *);
|
||||
|
@ -309,26 +309,26 @@ char *allocate(unsigned);
|
||||
void closure(short *, int);
|
||||
void create_symbol_table(void);
|
||||
void default_action_warning(void);
|
||||
void dollar_error(int, char *, char *);
|
||||
void dollar_error(int, char *, char *) __dead2;
|
||||
void dollar_warning(int, int);
|
||||
void done(int);
|
||||
void fatal(const char *msg);
|
||||
void done(int) __dead2;
|
||||
void fatal(const char *msg) __dead2;
|
||||
void finalize_closure(void);
|
||||
void free_parser(void);
|
||||
void free_symbols(void);
|
||||
void free_symbol_table(void);
|
||||
void illegal_character(char *);
|
||||
void illegal_tag(int, char *, char *);
|
||||
void illegal_character(char *) __dead2;
|
||||
void illegal_tag(int, char *, char *) __dead2;
|
||||
void lalr(void);
|
||||
bucket *lookup(char *);
|
||||
void lr0(void);
|
||||
bucket *make_bucket(const char *);
|
||||
void make_parser(void);
|
||||
void no_grammar(void);
|
||||
void no_space(void);
|
||||
void open_error(const char *);
|
||||
void no_grammar(void) __dead2;
|
||||
void no_space(void) __dead2;
|
||||
void open_error(const char *) __dead2;
|
||||
void output(void);
|
||||
void over_unionized(char *);
|
||||
void over_unionized(char *) __dead2;
|
||||
void prec_redeclared(void);
|
||||
void reader(void);
|
||||
void reflexive_transitive_closure(unsigned *, int);
|
||||
@ -337,21 +337,21 @@ void restarted_warning(void);
|
||||
void retyped_warning(char *);
|
||||
void revalued_warning(char *);
|
||||
void set_first_derives(void);
|
||||
void syntax_error(int, char *, char *);
|
||||
void terminal_lhs(int);
|
||||
void terminal_start(char *);
|
||||
void tokenized_start(char *);
|
||||
void undefined_goal(char *);
|
||||
void syntax_error(int, char *, char *) __dead2;
|
||||
void terminal_lhs(int) __dead2;
|
||||
void terminal_start(char *) __dead2;
|
||||
void tokenized_start(char *) __dead2;
|
||||
void undefined_goal(char *) __dead2;
|
||||
void undefined_symbol_warning(char *);
|
||||
void unexpected_EOF(void);
|
||||
void unknown_rhs(int);
|
||||
void unterminated_action(int, char *, char *);
|
||||
void unterminated_comment(int, char *, char *);
|
||||
void unterminated_string(int, char *, char *);
|
||||
void unterminated_text(int, char *, char *);
|
||||
void unterminated_union(int, char *, char *);
|
||||
void untyped_lhs(void);
|
||||
void untyped_rhs(int, char *);
|
||||
void used_reserved(char *);
|
||||
void unexpected_EOF(void) __dead2;
|
||||
void unknown_rhs(int) __dead2;
|
||||
void unterminated_action(int, char *, char *) __dead2;
|
||||
void unterminated_comment(int, char *, char *) __dead2;
|
||||
void unterminated_string(int, char *, char *) __dead2;
|
||||
void unterminated_text(int, char *, char *) __dead2;
|
||||
void unterminated_union(int, char *, char *) __dead2;
|
||||
void untyped_lhs(void) __dead2;
|
||||
void untyped_rhs(int, char *) __dead2;
|
||||
void used_reserved(char *) __dead2;
|
||||
void verbose(void);
|
||||
void write_section(const char **);
|
||||
|
Loading…
Reference in New Issue
Block a user