Patchwork [FYI] Make two range_bounds bitfields unsigned

login
register
mail settings
Submitter Tom Tromey
Date Nov. 28, 2019, 3:05 p.m.
Message ID <20191128150550.18943-1-tom@tromey.com>
Download mbox | patch
Permalink /patch/36355/
State New
Headers show

Comments

Tom Tromey - Nov. 28, 2019, 3:05 p.m.
While debugging gdb, I noticed that the bitfields in a range_bounds
were signed, causing the values of these fields to be -1.

I think this is odd; and while we haven't yet committed to boolean
bitfields, I think it is a small improvement to change these types to
unsigned.

gdb/ChangeLog
2019-11-28  Tom Tromey  <tom@tromey.com>

	* gdbtypes.h (struct range_bounds) <flag_upper_bound_is_count,
	flag_bound_evaluated>: Now unsigned.

Change-Id: Ia377fd931594bbf8653180d4dcb4e60354d90139
---
 gdb/ChangeLog  | 5 +++++
 gdb/gdbtypes.h | 4 ++--
 2 files changed, 7 insertions(+), 2 deletions(-)

Patch

diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index 8fc770c5d39..2e128aae063 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -631,12 +631,12 @@  struct range_bounds
   /* True if HIGH range bound contains the number of elements in the
      subrange.  This affects how the final high bound is computed.  */
 
-  int flag_upper_bound_is_count : 1;
+  unsigned int flag_upper_bound_is_count : 1;
 
   /* True if LOW or/and HIGH are resolved into a static bound from
      a dynamic one.  */
 
-  int flag_bound_evaluated : 1;
+  unsigned int flag_bound_evaluated : 1;
 };
 
 /* Compare two range_bounds objects for equality.  Simply does