binutils-gdb/gdb/common
Simon Marchi b020ff8074 Introduce in_inclusive_range, fix -Wtautological-compare warnings
When compiling with clang or gcc 8, we see warnings like this:

/home/emaisin/src/binutils-gdb/gdb/arm-tdep.c:10013:13: error: comparison of 0 <= unsigned expression is always true [-Werror,-Wtautological-compare]
      if (0 <= insn_op1 && 3 >= insn_op1)
          ~ ^  ~~~~~~~~
/home/emaisin/src/binutils-gdb/gdb/arm-tdep.c:11722:20: error: comparison of unsigned expression >= 0 is always true [-Werror,-Wtautological-compare]
      else if (opB >= 0 && opB <= 2)
               ~~~ ^  ~

This is because an unsigned integer (opB in this case) will always be >=
0.  It is still useful to keep both bounds of the range in the
expression, even if one is at the edge of the data type range.  This
patch introduces a utility function in_inclusive_range that gets rid of
the warning while conveying that we are checking for a range.

Tested by rebuilding.

gdb/ChangeLog:

	* common/common-utils.h (in_inclusive_range): New function.
	* arm-tdep.c (arm_record_extension_space): Use
	in_inclusive_range.
	(thumb_record_ld_st_reg_offset): Use in_inclusive_range.
	* cris-tdep.c (cris_spec_reg_applicable): Use
	in_inclusive_range.
2017-10-30 14:27:38 -04:00
..
agent.c
agent.h
array-view.h Introduce gdb::array_view 2017-09-04 17:10:12 +01:00
ax.def
break-common.h
btrace-common.c
btrace-common.h
buffer.c Make xml_escape_text return an std::string 2017-09-16 14:19:31 +02:00
buffer.h
byte-vector.h
cleanups.c
cleanups.h
common-debug.c
common-debug.h
common-defs.h
common-exceptions.c Eliminate catch_errors 2017-10-10 16:45:50 +01:00
common-exceptions.h Eliminate catch_exceptions/catch_exceptions_with_msg 2017-10-10 17:01:25 +01:00
common-gdbthread.h
common-inferior.h Extend "set cwd" to work on gdbserver 2017-10-04 02:01:45 -04:00
common-regcache.c
common-regcache.h
common-types.h
common-utils.c Introduce string_appendf/string_vappendf 2017-10-30 11:41:34 +00:00
common-utils.h Introduce in_inclusive_range, fix -Wtautological-compare warnings 2017-10-30 14:27:38 -04:00
common.host
common.m4
create-version.sh
def-vector.h
default-init-alloc.h
diagnostics.h
enum-flags.h
environ.c Implement the ability to set/unset environment variables to GDBserver when starting the inferior 2017-08-31 17:22:10 -04:00
environ.h Implement the ability to set/unset environment variables to GDBserver when starting the inferior 2017-08-31 17:22:10 -04:00
errors.c
errors.h
fileio.c
fileio.h
filestuff.c Introduce and use gdb_file_up 2017-08-03 07:58:52 -06:00
filestuff.h Introduce and use gdb_file_up 2017-08-03 07:58:52 -06:00
format.c Target FP printing: Simplify and fix ui_printf 2017-10-24 18:00:50 +02:00
format.h Target FP printing: Simplify and fix ui_printf 2017-10-24 18:00:50 +02:00
function-view.h
gdb_assert.h
gdb_locale.h
gdb_optional.h
gdb_ref_ptr.h
gdb_setjmp.h
gdb_signals.h
gdb_splay_tree.h Remove free_splay_tree cleanup 2017-10-09 17:39:29 -06:00
gdb_sys_time.h
gdb_termios.h
gdb_tilde_expand.c Introduce gdb_tilde_expand 2017-10-04 01:57:29 -04:00
gdb_tilde_expand.h Introduce gdb_tilde_expand 2017-10-04 01:57:29 -04:00
gdb_unique_ptr.h Allow gdb::unique_xmalloc_ptr<T[]> 2017-08-10 14:18:02 +01:00
gdb_unlinker.h
gdb_vecs.c
gdb_vecs.h
gdb_wait.h
host-defs.h
job-control.c
job-control.h
mingw-strerror.c
new-op.c
offset-type.h
poison.h
posix-strerror.c
preprocessor.h
print-utils.c
print-utils.h
ptid.c
ptid.h
queue.h
refcounted-object.h Use DISABLE_COPY_AND_ASSIGN 2017-09-19 10:10:03 +01:00
rsp-low.c Constify unpack_varlen_hex & fix fallout 2017-09-29 17:15:36 +01:00
rsp-low.h Constify unpack_varlen_hex & fix fallout 2017-09-29 17:15:36 +01:00
run-time-clock.c
run-time-clock.h
scoped_restore.h
selftest.c Add selftests run filtering 2017-09-16 14:06:03 +02:00
selftest.h Add selftests run filtering 2017-09-16 14:06:03 +02:00
signals-state-save-restore.c
signals-state-save-restore.h
signals.c
symbol.h
traits.h
underlying.h
valid-expr.h
vec.c
vec.h
version.h
x86-xstate.h
xml-utils.c Make xml_escape_text return an std::string 2017-09-16 14:19:31 +02:00
xml-utils.h Make xml_escape_text return an std::string 2017-09-16 14:19:31 +02:00