[gdb/build] Fix -Werror=bool-compare warning in update_static_array_size
authorTom de Vries <tdevries@suse.de>
Wed, 18 Nov 2020 18:59:45 +0000 (19:59 +0100)
committerTom de Vries <tdevries@suse.de>
Wed, 18 Nov 2020 18:59:45 +0000 (19:59 +0100)
With current trunk I run into:
...
src/gdb/gdbtypes.c: In function 'bool update_static_array_size(type*)':
src/gdb/gdbtypes.c:1250:64: error: comparison of constant '0' with boolean \
  expression is always true [-Werror=bool-compare]
    && get_array_bounds (element_type, &low_bound, &high_bound) >= 0
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
...

Fix this by dropping the compare.

gdb/ChangeLog:

2020-11-18  Tom de Vries  <tdevries@suse.de>

* gdbtypes.c (update_static_array_size): Fix -Werror=bool-compare
warning.

gdb/ChangeLog
gdb/gdbtypes.c

index 8c21f973137ba1e225117606f18a9d31a5654e5e..49b2511cae23b79cc9e8c9b978d0d3b354cfd56f 100644 (file)
@@ -1,3 +1,8 @@
+2020-11-18  Tom de Vries  <tdevries@suse.de>
+
+       * gdbtypes.c (update_static_array_size): Fix -Werror=bool-compare
+       warning.
+
 2020-11-17  Simon Marchi  <simon.marchi@polymtl.ca>
 
        * gdbtypes.h (get_array_bounds): Return bool, adjust some
index cde077027343a2d28160e3a755fc2b98836db800..b822a369a1634fcb921dcfb64a19858241c56c1c 100644 (file)
@@ -1247,7 +1247,7 @@ update_static_array_size (struct type *type)
       if (element_type->code () == TYPE_CODE_ARRAY
          && TYPE_LENGTH (element_type) != 0
          && TYPE_FIELD_BITSIZE (element_type, 0) != 0
-         && get_array_bounds (element_type, &low_bound, &high_bound) >= 0
+         && get_array_bounds (element_type, &low_bound, &high_bound)
          && high_bound >= low_bound)
        TYPE_FIELD_BITSIZE (type, 0)
          = ((high_bound - low_bound + 1)
This page took 0.033002 seconds and 4 git commands to generate.