diff options
| author | bjh21 <bjh21@NetBSD.org> | 2002-03-09 13:22:52 +0000 |
|---|---|---|
| committer | bjh21 <bjh21@NetBSD.org> | 2002-03-09 13:22:52 +0000 |
| commit | dca4ae94d6ed60958ecd2fcf690e6caf3e2dcd36 (patch) | |
| tree | f5ed6b6f6e1f987b22abbcfe2a6f9167d1e5b301 | |
| parent | d77463efdec8b970f01fc8ff01b5953d8c55195d (diff) | |
When checking that a potentially-unsigned enum is >= 0, assign it to an int
first. This is necessary to avoid warnings with -fshort-enums. Casting
to an int really should be enough, but turns out not to be.
This change will be documented in doc/HACKS.
| -rw-r--r-- | dist/bind/lib/nameser/ns_parse.c | 5 | ||||
| -rw-r--r-- | gnu/dist/gawk/eval.c | 3 | ||||
| -rw-r--r-- | gnu/dist/toolchain/bfd/bfd.c | 6 | ||||
| -rw-r--r-- | gnu/dist/toolchain/bfd/format.c | 15 | ||||
| -rw-r--r-- | gnu/dist/toolchain/gdb/target.c | 4 | ||||
| -rw-r--r-- | sys/kern/vfs_subr.c | 9 |
6 files changed, 27 insertions, 15 deletions
diff --git a/dist/bind/lib/nameser/ns_parse.c b/dist/bind/lib/nameser/ns_parse.c index 25bb988dda1..cbe510604de 100644 --- a/dist/bind/lib/nameser/ns_parse.c +++ b/dist/bind/lib/nameser/ns_parse.c @@ -1,4 +1,4 @@ -/* $NetBSD: ns_parse.c,v 1.2 2001/01/27 07:22:05 itojun Exp $ */ +/* $NetBSD: ns_parse.c,v 1.3 2002/03/09 13:22:52 bjh21 Exp $ */ /* * Copyright (c) 1996,1999 by Internet Software Consortium. @@ -134,9 +134,10 @@ ns_initparse(const u_char *msg, int msglen, ns_msg *handle) { int ns_parserr(ns_msg *handle, ns_sect section, int rrnum, ns_rr *rr) { int b; + int tmp; /* Make section right. */ - if (section < 0 || section >= ns_s_max) + if ((tmp = section) < 0 || section >= ns_s_max) RETERR(ENODEV); if (section != handle->_sect) setsection(handle, section); diff --git a/gnu/dist/gawk/eval.c b/gnu/dist/gawk/eval.c index aa2e88162f1..999dbac857b 100644 --- a/gnu/dist/gawk/eval.c +++ b/gnu/dist/gawk/eval.c @@ -247,8 +247,9 @@ nodetype2str(type) NODETYPE type; { static char buf[40]; + int tmp; - if (type >= Node_illegal && type <= Node_final) + if ((tmp = type) >= Node_illegal && type <= Node_final) return nodetypes[(int) type]; sprintf(buf, "unknown nodetype %d", (int) type); diff --git a/gnu/dist/toolchain/bfd/bfd.c b/gnu/dist/toolchain/bfd/bfd.c index 3afcd3df8b5..a0096d61e55 100644 --- a/gnu/dist/toolchain/bfd/bfd.c +++ b/gnu/dist/toolchain/bfd/bfd.c @@ -345,11 +345,13 @@ bfd_errmsg (error_tag) #ifndef errno extern int errno; #endif + int tmp; + if (error_tag == bfd_error_system_call) return xstrerror (errno); - if ((((int)error_tag <(int) bfd_error_no_error) || - ((int)error_tag > (int)bfd_error_invalid_error_code))) + if ((((tmp = error_tag) <(int) bfd_error_no_error) || + ((tmp = error_tag) > (int)bfd_error_invalid_error_code))) error_tag = bfd_error_invalid_error_code;/* sanity check */ return _(bfd_errmsgs [(int)error_tag]); diff --git a/gnu/dist/toolchain/bfd/format.c b/gnu/dist/toolchain/bfd/format.c index 6afcb60d6ed..279bbf35e07 100644 --- a/gnu/dist/toolchain/bfd/format.c +++ b/gnu/dist/toolchain/bfd/format.c @@ -122,10 +122,11 @@ bfd_check_format_matches (abfd, format, matching) const bfd_target * const *target, *save_targ, *right_targ; char **matching_vector = NULL; int match_count; + int tmp; if (!bfd_read_p (abfd) || - ((int)(abfd->format) < (int)bfd_unknown) || - ((int)(abfd->format) >= (int)bfd_type_end)) + ((tmp = (abfd->format)) < (int)bfd_unknown) || + ((tmp = (abfd->format)) >= (int)bfd_type_end)) { bfd_set_error (bfd_error_invalid_operation); return false; @@ -312,9 +313,11 @@ bfd_set_format (abfd, format) bfd *abfd; bfd_format format; { + int tmp; + if (bfd_read_p (abfd) || - ((int)abfd->format < (int)bfd_unknown) || - ((int)abfd->format >= (int)bfd_type_end)) + ((tmp = abfd->format) < (int)bfd_unknown) || + ((tmp = abfd->format) >= (int)bfd_type_end)) { bfd_set_error (bfd_error_invalid_operation); return false; @@ -352,7 +355,9 @@ CONST char * bfd_format_string (format) bfd_format format; { - if (((int)format <(int) bfd_unknown) + int tmp; + + if (((tmp = format) <(int) bfd_unknown) || ((int)format >=(int) bfd_type_end)) return "invalid"; diff --git a/gnu/dist/toolchain/gdb/target.c b/gnu/dist/toolchain/gdb/target.c index 02ccc25da31..27294ace248 100644 --- a/gnu/dist/toolchain/gdb/target.c +++ b/gnu/dist/toolchain/gdb/target.c @@ -1569,7 +1569,9 @@ char * target_signal_to_string (sig) enum target_signal sig; { - if ((sig >= TARGET_SIGNAL_FIRST) && (sig <= TARGET_SIGNAL_LAST)) + int tmp; + + if (((tmp = sig) >= TARGET_SIGNAL_FIRST) && (sig <= TARGET_SIGNAL_LAST)) return signals[sig].string; else return signals[TARGET_SIGNAL_UNKNOWN].string; diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 9accbac6fdd..287ed4307dc 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_subr.c,v 1.171 2002/03/08 20:48:42 thorpej Exp $ */ +/* $NetBSD: vfs_subr.c,v 1.172 2002/03/09 13:22:54 bjh21 Exp $ */ /*- * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc. @@ -82,7 +82,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: vfs_subr.c,v 1.171 2002/03/08 20:48:42 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_subr.c,v 1.172 2002/03/09 13:22:54 bjh21 Exp $"); #include "opt_ddb.h" #include "opt_compat_netbsd.h" @@ -2794,6 +2794,7 @@ vfs_vnode_print(vp, full, pr) { char buf[256]; const char *vtype, *vtag; + int tmp; uvm_object_printit(&vp->v_uobj, full, pr); bitmask_snprintf(vp->v_flag, vnode_flagbits, buf, sizeof(buf)); @@ -2805,10 +2806,10 @@ vfs_vnode_print(vp, full, pr) vp->v_data, vp->v_usecount, vp->v_writecount, vp->v_holdcnt, vp->v_numoutput); - vtype = (vp->v_type >= 0 && + vtype = ((tmp = vp->v_type) >= 0 && vp->v_type < sizeof(vnode_types) / sizeof(vnode_types[0])) ? vnode_types[vp->v_type] : "UNKNOWN"; - vtag = (vp->v_tag >= 0 && + vtag = ((tmp = vp->v_tag) >= 0 && vp->v_tag < sizeof(vnode_tags) / sizeof(vnode_tags[0])) ? vnode_tags[vp->v_tag] : "UNKNOWN"; |
