Various fixes for compiler warninga sbout unreachable code or unused function arguments

This commit is contained in:
James Youngman
2004-10-30 09:16:45 +00:00
parent 882b1150b1
commit 3d0224ec1e
3 changed files with 101 additions and 2 deletions

View File

@@ -59,7 +59,9 @@
static void process_top_path PARAMS((char *pathname));
static int process_path PARAMS((char *pathname, char *name, boolean leaf, char *parent));
static void process_dir PARAMS((char *pathname, char *name, int pathlen, struct stat *statp, char *parent));
#if 0
static boolean no_side_effects PARAMS((struct predicate *pred));
#endif
static boolean default_prints PARAMS((struct predicate *pred));
/* Name this program was run with. */
@@ -419,8 +421,6 @@ process_path (char *pathname, char *name, boolean leaf, char *parent)
struct stat stat_buf;
static dev_t root_dev; /* Device ID of current argument pathname. */
int i;
struct stat dir_buf;
int parent_desc;
/* Assume it is a non-directory initially. */
stat_buf.st_mode = 0;
@@ -637,6 +637,7 @@ process_dir (char *pathname, char *name, int pathlen, struct stat *statp, char *
}
}
#if 0
/* Return true if there are no side effects in any of the predicates in
predicate list PRED, false if there are any. */
@@ -651,6 +652,7 @@ no_side_effects (struct predicate *pred)
}
return (true);
}
#endif
/* Return true if there are no predicates with no_default_print in
predicate list PRED, false if there are any.

View File

@@ -283,6 +283,9 @@ parse_amin (char **argv, int *arg_ptr)
static boolean
parse_and (char **argv, int *arg_ptr)
{
(void) argv;
(void) arg_ptr;
struct predicate *our_pred;
our_pred = get_new_pred ();
@@ -321,6 +324,9 @@ parse_atime (char **argv, int *arg_ptr)
boolean
parse_close (char **argv, int *arg_ptr)
{
(void) argv;
(void) arg_ptr;
struct predicate *our_pred;
our_pred = get_new_pred ();
@@ -376,6 +382,9 @@ parse_comma (char **argv, int *arg_ptr)
{
struct predicate *our_pred;
(void) argv;
(void) arg_ptr;
our_pred = get_new_pred ();
our_pred->pred_func = pred_comma;
#ifdef DEBUG
@@ -398,6 +407,9 @@ parse_daystart (char **argv, int *arg_ptr)
{
struct tm *local;
(void) argv;
(void) arg_ptr;
if (full_days == false)
{
cur_day_start += DAYSECS;
@@ -414,6 +426,9 @@ parse_daystart (char **argv, int *arg_ptr)
static boolean
parse_depth (char **argv, int *arg_ptr)
{
(void) argv;
(void) arg_ptr;
do_dir_first = false;
return (true);
}
@@ -421,6 +436,9 @@ parse_depth (char **argv, int *arg_ptr)
static boolean
parse_empty (char **argv, int *arg_ptr)
{
(void) argv;
(void) arg_ptr;
insert_primary (pred_empty);
return (true);
}
@@ -435,6 +453,9 @@ static boolean
parse_false (char **argv, int *arg_ptr)
{
struct predicate *our_pred;
(void) argv;
(void) arg_ptr;
our_pred = insert_primary (pred_false);
our_pred->need_stat = false;
@@ -477,6 +498,9 @@ parse_fprintf (char **argv, int *arg_ptr)
static boolean
parse_follow (char **argv, int *arg_ptr)
{
(void) argv;
(void) arg_ptr;
dereference = true;
xstat = stat;
no_leaf_check = true;
@@ -564,6 +588,9 @@ parse_group (char **argv, int *arg_ptr)
static boolean
parse_help (char **argv, int *arg_ptr)
{
(void) argv;
(void) arg_ptr;
printf (_("\
Usage: %s [path...] [expression]\n"), program_name);
puts (_("\
@@ -700,6 +727,9 @@ parse_lname (char **argv, int *arg_ptr)
{
struct predicate *our_pred;
(void) argv;
(void) arg_ptr;
if ((argv == NULL) || (argv[*arg_ptr] == NULL))
return (false);
@@ -716,6 +746,9 @@ parse_ls (char **argv, int *arg_ptr)
{
struct predicate *our_pred;
(void) &argv;
(void) &arg_ptr;
our_pred = insert_primary (pred_ls);
our_pred->side_effects = true;
our_pred->no_default_print = true;
@@ -786,6 +819,9 @@ parse_mtime (char **argv, int *arg_ptr)
static boolean
parse_name (char **argv, int *arg_ptr)
{
(void) argv;
(void) arg_ptr;
struct predicate *our_pred;
if ((argv == NULL) || (argv[*arg_ptr] == NULL))
@@ -802,6 +838,9 @@ parse_negate (char **argv, int *arg_ptr)
{
struct predicate *our_pred;
(void) &argv;
(void) &arg_ptr;
our_pred = get_new_pred_chk_op ();
our_pred->pred_func = pred_negate;
#ifdef DEBUG
@@ -819,6 +858,9 @@ parse_newer (char **argv, int *arg_ptr)
struct predicate *our_pred;
struct stat stat_newer;
(void) argv;
(void) arg_ptr;
if ((argv == NULL) || (argv[*arg_ptr] == NULL))
return (false);
if ((*xstat) (argv[*arg_ptr], &stat_newer))
@@ -832,6 +874,8 @@ parse_newer (char **argv, int *arg_ptr)
static boolean
parse_noleaf (char **argv, int *arg_ptr)
{
(void) &argv, &arg_ptr;
no_leaf_check = true;
return true;
}
@@ -857,6 +901,8 @@ parse_nogroup (char **argv, int *arg_ptr)
{
struct predicate *our_pred;
(void) &argv, &arg_ptr;
our_pred = insert_primary (pred_nogroup);
#ifdef CACHE_IDS
if (gid_unused == NULL)
@@ -889,6 +935,8 @@ static boolean
parse_nouser (char **argv, int *arg_ptr)
{
struct predicate *our_pred;
(void) argv, arg_ptr;
our_pred = insert_primary (pred_nouser);
#ifdef CACHE_IDS
@@ -929,6 +977,8 @@ parse_open (char **argv, int *arg_ptr)
{
struct predicate *our_pred;
(void) argv, arg_ptr;
our_pred = get_new_pred_chk_op ();
our_pred->pred_func = pred_open;
#ifdef DEBUG
@@ -945,6 +995,8 @@ parse_or (char **argv, int *arg_ptr)
{
struct predicate *our_pred;
(void) argv, arg_ptr;
our_pred = get_new_pred ();
our_pred->pred_func = pred_or;
#ifdef DEBUG

View File

@@ -247,6 +247,8 @@ struct prec_assoc prec_table[] =
boolean
pred_amin (char *pathname, struct stat *stat_buf, struct predicate *pred_ptr)
{
(void) &pathname;
switch (pred_ptr->args.info.kind)
{
case COMP_GT:
@@ -294,6 +296,8 @@ pred_and (char *pathname, struct stat *stat_buf, struct predicate *pred_ptr)
boolean
pred_anewer (char *pathname, struct stat *stat_buf, struct predicate *pred_ptr)
{
(void) &pathname;
if (stat_buf->st_atime > pred_ptr->args.time)
return (true);
return (false);
@@ -302,6 +306,8 @@ pred_anewer (char *pathname, struct stat *stat_buf, struct predicate *pred_ptr)
boolean
pred_atime (char *pathname, struct stat *stat_buf, struct predicate *pred_ptr)
{
(void) &pathname;
switch (pred_ptr->args.info.kind)
{
case COMP_GT:
@@ -325,12 +331,20 @@ pred_atime (char *pathname, struct stat *stat_buf, struct predicate *pred_ptr)
boolean
pred_close (char *pathname, struct stat *stat_buf, struct predicate *pred_ptr)
{
(void) &pathname;
(void) &stat_buf;
(void) &pred_ptr;
return (true);
}
boolean
pred_cmin (char *pathname, struct stat *stat_buf, struct predicate *pred_ptr)
{
(void) pathname;
(void) stat_buf;
switch (pred_ptr->args.info.kind)
{
case COMP_GT:
@@ -353,6 +367,8 @@ pred_cmin (char *pathname, struct stat *stat_buf, struct predicate *pred_ptr)
boolean
pred_cnewer (char *pathname, struct stat *stat_buf, struct predicate *pred_ptr)
{
(void) &pathname;
if (stat_buf->st_ctime > pred_ptr->args.time)
return (true);
return (false);
@@ -382,6 +398,8 @@ pred_comma (char *pathname, struct stat *stat_buf, struct predicate *pred_ptr)
boolean
pred_ctime (char *pathname, struct stat *stat_buf, struct predicate *pred_ptr)
{
(void) &pathname;
switch (pred_ptr->args.info.kind)
{
case COMP_GT:
@@ -405,6 +423,9 @@ pred_ctime (char *pathname, struct stat *stat_buf, struct predicate *pred_ptr)
boolean
pred_empty (char *pathname, struct stat *stat_buf, struct predicate *pred_ptr)
{
(void) &pathname;
(void) &pred_ptr;
if (S_ISDIR (stat_buf->st_mode))
{
DIR *d;
@@ -446,6 +467,9 @@ pred_empty (char *pathname, struct stat *stat_buf, struct predicate *pred_ptr)
boolean
pred_exec (char *pathname, struct stat *stat_buf, struct predicate *pred_ptr)
{
(void) &pathname;
(void) &stat_buf;
int i;
int path_pos;
struct exec_val *execp; /* Pointer for efficiency. */
@@ -484,6 +508,11 @@ pred_exec (char *pathname, struct stat *stat_buf, struct predicate *pred_ptr)
boolean
pred_false (char *pathname, struct stat *stat_buf, struct predicate *pred_ptr)
{
(void) &pathname;
(void) &stat_buf;
(void) &pred_ptr;
return (false);
}
@@ -498,6 +527,9 @@ pred_fls (char *pathname, struct stat *stat_buf, struct predicate *pred_ptr)
boolean
pred_fprint (char *pathname, struct stat *stat_buf, struct predicate *pred_ptr)
{
(void) &pathname;
(void) &stat_buf;
fputs (pathname, pred_ptr->args.stream);
putc ('\n', pred_ptr->args.stream);
return (true);
@@ -506,6 +538,9 @@ pred_fprint (char *pathname, struct stat *stat_buf, struct predicate *pred_ptr)
boolean
pred_fprint0 (char *pathname, struct stat *stat_buf, struct predicate *pred_ptr)
{
(void) &pathname;
(void) &stat_buf;
fputs (pathname, pred_ptr->args.stream);
putc (0, pred_ptr->args.stream);
return (true);
@@ -751,6 +786,8 @@ pred_fstype (char *pathname, struct stat *stat_buf, struct predicate *pred_ptr)
boolean
pred_gid (char *pathname, struct stat *stat_buf, struct predicate *pred_ptr)
{
(void) pathname;
switch (pred_ptr->args.info.kind)
{
case COMP_GT:
@@ -772,6 +809,8 @@ pred_gid (char *pathname, struct stat *stat_buf, struct predicate *pred_ptr)
boolean
pred_group (char *pathname, struct stat *stat_buf, struct predicate *pred_ptr)
{
(void) pathname;
if (pred_ptr->args.gid == stat_buf->st_gid)
return (true);
else
@@ -787,6 +826,8 @@ pred_ilname (char *pathname, struct stat *stat_buf, struct predicate *pred_ptr)
boolean
pred_iname (char *pathname, struct stat *stat_buf, struct predicate *pred_ptr)
{
(void) stat_buf;
const char *base;
/* FNM_PERIOD is not used here because POSIX requires that it not be.
@@ -801,6 +842,8 @@ pred_iname (char *pathname, struct stat *stat_buf, struct predicate *pred_ptr)
boolean
pred_inum (char *pathname, struct stat *stat_buf, struct predicate *pred_ptr)
{
(void) pathname;
switch (pred_ptr->args.info.kind)
{
case COMP_GT:
@@ -822,6 +865,8 @@ pred_inum (char *pathname, struct stat *stat_buf, struct predicate *pred_ptr)
boolean
pred_ipath (char *pathname, struct stat *stat_buf, struct predicate *pred_ptr)
{
(void) stat_buf;
if (fnmatch (pred_ptr->args.str, pathname, FNM_CASEFOLD) == 0)
return (true);
return (false);