Files
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
..
2017-09-04 17:10:12 +01:00
2017-07-03 13:59:00 +02:00
2017-10-10 16:45:50 +01:00
2017-08-03 07:58:52 -06:00
2017-08-03 07:58:52 -06:00
2017-04-18 23:48:41 +01:00
2017-10-04 01:57:29 -04:00
2017-10-04 01:57:29 -04:00
2017-04-05 19:21:37 +01:00
2017-04-06 23:29:53 -04:00
2017-04-06 23:29:53 -04:00
2017-09-16 14:06:03 +02:00
2017-09-16 14:06:03 +02:00
2017-01-01 10:52:34 +04:00