[binutils-gdb] gdb: int to bool in struct entry_info

Andrew Burgess aburgess@sourceware.org
Fri Apr 17 20:40:54 GMT 2026


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=eb0801fe571a581ce2dbd8492ad7b1166d7ffcaa

commit eb0801fe571a581ce2dbd8492ad7b1166d7ffcaa
Author: Andrew Burgess <aburgess@redhat.com>
Date:   Wed Apr 15 10:42:03 2026 +0100

    gdb: int to bool in struct entry_info
    
    Convert 'struct entry_info' to use bool for flag fields.  The places
    where these flags are set are updated too.  I have also removed the
    bit width specifier ": 1" from the flag field definitions.  There is
    one entry_info struct per BFD in GDB, which is not a huge number, so
    forcing the bool fields to 1-bit doesn't seen necessary.
    
    There should be no user visible changes after this commit.
    
    Approved-By: Tom Tromey <tom@tromey.com>

Diff:
---
 gdb/objfiles.h | 8 ++++----
 gdb/symfile.c  | 8 ++++----
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/gdb/objfiles.h b/gdb/objfiles.h
index 76d6130f504..58c4ff81008 100644
--- a/gdb/objfiles.h
+++ b/gdb/objfiles.h
@@ -115,11 +115,11 @@ struct entry_info
   /* The index of the section in which the entry point appears.  */
   int the_bfd_section_index;
 
-  /* Set to 1 iff ENTRY_POINT contains a valid value.  */
-  unsigned entry_point_p : 1;
+  /* Set to true iff ENTRY_POINT contains a valid value.  */
+  bool entry_point_p;
 
-  /* Set to 1 iff this object was initialized.  */
-  unsigned initialized : 1;
+  /* Set to true iff this object was initialized.  */
+  bool initialized;
 };
 
 #define SECT_OFF_DATA(objfile) \
diff --git a/gdb/symfile.c b/gdb/symfile.c
index d0ea9506c63..d583960d430 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -776,7 +776,7 @@ init_entry_point_info (struct objfile *objfile)
 
   if (ei->initialized)
     return;
-  ei->initialized = 1;
+  ei->initialized = true;
 
   /* Save startup file's range of PC addresses to help blockframe.c
      decide where the bottom of the stack is.  */
@@ -786,7 +786,7 @@ init_entry_point_info (struct objfile *objfile)
       /* Executable file -- record its entry point so we'll recognize
 	 the startup file because it contains the entry point.  */
       ei->entry_point = bfd_get_start_address (objfile->obfd.get ());
-      ei->entry_point_p = 1;
+      ei->entry_point_p = true;
     }
   else if (bfd_get_file_flags (objfile->obfd.get ()) & DYNAMIC
 	   && bfd_get_start_address (objfile->obfd.get ()) != 0)
@@ -795,12 +795,12 @@ init_entry_point_info (struct objfile *objfile)
 	 runnable.  There's no clear way to indicate this, so just check
 	 for values other than zero.  */
       ei->entry_point = bfd_get_start_address (objfile->obfd.get ());
-      ei->entry_point_p = 1;
+      ei->entry_point_p = true;
     }
   else
     {
       /* Examination of non-executable.o files.  Short-circuit this stuff.  */
-      ei->entry_point_p = 0;
+      ei->entry_point_p = false;
     }
 
   if (ei->entry_point_p)


More information about the Gdb-cvs mailing list