Change value_contents_eq return bool
authorYao Qi <yao.qi@linaro.org>
Fri, 24 Nov 2017 10:47:27 +0000 (10:47 +0000)
committerYao Qi <yao.qi@linaro.org>
Fri, 24 Nov 2017 10:47:27 +0000 (10:47 +0000)
This patch changes value_contents_eq return type from int to bool.

gdb:

2017-11-24  Yao Qi  <yao.qi@linaro.org>

* mi/mi-main.c (register_changed_p): Update.
* value.c (value_contents_bits_eq): Change return type.
(value_contents_eq): Likewise.
* value.h: Update comments.

gdb/ChangeLog
gdb/mi/mi-main.c
gdb/value.c
gdb/value.h

index cbcd2de819ef3742fdb8ae376ee562147a6fd1bb..c464f295ebfda4b29110e754767fdf6a6297f65e 100644 (file)
@@ -1,3 +1,10 @@
+2017-11-24  Yao Qi  <yao.qi@linaro.org>
+
+       * mi/mi-main.c (register_changed_p): Update.
+       * value.c (value_contents_bits_eq): Change return type.
+       (value_contents_eq): Likewise.
+       * value.h: Update comments.
+
 2017-11-24  Yao Qi  <yao.qi@linaro.org>
 
        * mi/mi-main.c (mi_cmd_data_list_changed_registers): Remove
index 6933d1723f9583e8910cebeecdc2902b77eee813..3261488d75208bab550115aedf5cd0ca42e232aa 100644 (file)
@@ -1012,8 +1012,8 @@ register_changed_p (int regnum, struct regcache *prev_regs,
   gdb_assert (prev_value != NULL);
   gdb_assert (this_value != NULL);
 
-  auto ret = value_contents_eq (prev_value, 0, this_value, 0,
-                               register_size (gdbarch, regnum)) == 0;
+  auto ret = !value_contents_eq (prev_value, 0, this_value, 0,
+                                register_size (gdbarch, regnum));
 
   release_value (prev_value);
   release_value (this_value);
index 1d1e619accbf19d0d0fc46103d2938f8544064e8..3e0ca25fa798116da8eb9a768a0a263c506cee38 100644 (file)
@@ -808,7 +808,7 @@ find_first_range_overlap_and_match (struct ranges_and_idx *rp1,
    with LENGTH bits of VAL2's contents starting at OFFSET2 bits.
    Return true if the available bits match.  */
 
-static int
+static bool
 value_contents_bits_eq (const struct value *val1, int offset1,
                        const struct value *val2, int offset2,
                        int length)
@@ -847,7 +847,7 @@ value_contents_bits_eq (const struct value *val1, int offset1,
          if (!find_first_range_overlap_and_match (&rp1[i], &rp2[i],
                                                   offset1, offset2, length,
                                                   &l_tmp, &h_tmp))
-           return 0;
+           return false;
 
          /* We're interested in the lowest/first range found.  */
          if (i == 0 || l_tmp < l)
@@ -860,17 +860,17 @@ value_contents_bits_eq (const struct value *val1, int offset1,
       /* Compare the available/valid contents.  */
       if (memcmp_with_bit_offsets (val1->contents, offset1,
                                   val2->contents, offset2, l) != 0)
-       return 0;
+       return false;
 
       length -= h;
       offset1 += h;
       offset2 += h;
     }
 
-  return 1;
+  return true;
 }
 
-int
+bool
 value_contents_eq (const struct value *val1, LONGEST offset1,
                   const struct value *val2, LONGEST offset2,
                   LONGEST length)
index 2b6ae35b8a9857531dcdda69ed53f6b73a5a7b9b..e0de84427ea51451652e54b0fecd0c413a82899b 100644 (file)
@@ -549,12 +549,12 @@ extern void mark_value_bits_unavailable (struct value *value,
 
    then:
 
-     value_contents_eq(val, 0, val, 8, 6) => 1
-     value_contents_eq(val, 0, val, 4, 4) => 0
-     value_contents_eq(val, 0, val, 8, 8) => 0
-     value_contents_eq(val, 4, val, 12, 2) => 1
-     value_contents_eq(val, 4, val, 12, 4) => 0
-     value_contents_eq(val, 3, val, 4, 4) => 0
+     value_contents_eq(val, 0, val, 8, 6) => true
+     value_contents_eq(val, 0, val, 4, 4) => false
+     value_contents_eq(val, 0, val, 8, 8) => false
+     value_contents_eq(val, 4, val, 12, 2) => true
+     value_contents_eq(val, 4, val, 12, 4) => true
+     value_contents_eq(val, 3, val, 4, 4) => true
 
    If 'x's represent an unavailable byte, 'o' represents an optimized
    out byte, in a value with length 8:
@@ -564,9 +564,9 @@ extern void mark_value_bits_unavailable (struct value *value,
 
    then:
 
-     value_contents_eq(val, 0, val, 2, 2) => 1
-     value_contents_eq(val, 4, val, 6, 2) => 1
-     value_contents_eq(val, 0, val, 4, 4) => 0
+     value_contents_eq(val, 0, val, 2, 2) => true
+     value_contents_eq(val, 4, val, 6, 2) => true
+     value_contents_eq(val, 0, val, 4, 4) => true
 
    We only know whether a value chunk is unavailable or optimized out
    if we've tried to read it.  As this routine is used by printing
@@ -574,9 +574,9 @@ extern void mark_value_bits_unavailable (struct value *value,
    after the inferior is gone, it works with const values.  Therefore,
    this routine must not be called with lazy values.  */
 
-extern int value_contents_eq (const struct value *val1, LONGEST offset1,
-                             const struct value *val2, LONGEST offset2,
-                             LONGEST length);
+extern bool value_contents_eq (const struct value *val1, LONGEST offset1,
+                              const struct value *val2, LONGEST offset2,
+                              LONGEST length);
 
 /* Read LENGTH addressable memory units starting at MEMADDR into BUFFER,
    which is (or will be copied to) VAL's contents buffer offset by
This page took 0.035421 seconds and 4 git commands to generate.