]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb: change gdbarch_convert_register_p to return bool
authorSimon Marchi <simon.marchi@efficios.com>
Fri, 27 Feb 2026 20:05:18 +0000 (15:05 -0500)
committerSimon Marchi <simon.marchi@efficios.com>
Mon, 9 Mar 2026 17:15:47 +0000 (13:15 -0400)
Change-Id: I69e8af0b0e2eb847104fe54c28e6b5109d630ff5
Approved-By: Tom Tromey <tom@tromey.com>
13 files changed:
gdb/alpha-tdep.c
gdb/arch-utils.c
gdb/arch-utils.h
gdb/gdbarch-gen.c
gdb/gdbarch-gen.h
gdb/gdbarch_components.py
gdb/i386-tdep.c
gdb/i387-tdep.c
gdb/i387-tdep.h
gdb/ia64-tdep.c
gdb/m68k-tdep.c
gdb/mips-tdep.c
gdb/rs6000-tdep.c

index e2a1929b9dc2e56eb700216da81b036479ca9b76..071385eae7262d8bfa90cf27eeef652b38548748 100644 (file)
@@ -205,7 +205,7 @@ alpha_sts (struct gdbarch *gdbarch, void *out, const void *in)
    bytes, as the representation of integers in floating point
    registers is different.  */
 
-static int
+static bool
 alpha_convert_register_p (struct gdbarch *gdbarch, int regno,
                          struct type *type)
 {
index 9af4c35686e6466a18d9288c887c37333fefc85e..6065315870cabd8806077a1b718fc1ae880000e1 100644 (file)
@@ -317,11 +317,11 @@ default_floatformat_for_type (struct gdbarch *gdbarch,
   return format;
 }
 \f
-int
+bool
 generic_convert_register_p (struct gdbarch *gdbarch, int regnum,
                            struct type *type)
 {
-  return 0;
+  return false;
 }
 
 int
index b8271fbeea135ca8deed00bb7586288db20fddf2..cc7d6fd84593a2530bc51d27e1fd350a0b44a872 100644 (file)
@@ -259,8 +259,8 @@ extern bool default_code_of_frame_writable (struct gdbarch *gdbarch,
                                            const frame_info_ptr &frame);
 
 /* By default, registers are not convertible.  */
-extern int generic_convert_register_p (struct gdbarch *gdbarch, int regnum,
-                                      struct type *type);
+extern bool generic_convert_register_p (struct gdbarch *gdbarch, int regnum,
+                                       struct type *type);
 
 extern int generic_instruction_nullified (struct gdbarch *gdbarch,
                                          struct regcache *regcache);
index 2906249d8b47600e724d2cfffeefe286df622c84..88922d2670aecd56434577decee798621fbd0d35 100644 (file)
@@ -2357,7 +2357,7 @@ set_gdbarch_get_longjmp_target (struct gdbarch *gdbarch,
   gdbarch->get_longjmp_target = get_longjmp_target;
 }
 
-int
+bool
 gdbarch_convert_register_p (struct gdbarch *gdbarch, int regnum, struct type *type)
 {
   gdb_assert (gdbarch != NULL);
index c8048888baef52c1f2925d47c39d56de3edc93d0..5710e1bce7b91cba69af186dd2b9aa166a1e8512 100644 (file)
@@ -385,8 +385,8 @@ typedef bool (gdbarch_get_longjmp_target_ftype) (const frame_info_ptr &frame, CO
 extern bool gdbarch_get_longjmp_target (struct gdbarch *gdbarch, const frame_info_ptr &frame, CORE_ADDR *pc);
 extern void set_gdbarch_get_longjmp_target (struct gdbarch *gdbarch, gdbarch_get_longjmp_target_ftype *get_longjmp_target);
 
-typedef int (gdbarch_convert_register_p_ftype) (struct gdbarch *gdbarch, int regnum, struct type *type);
-extern int gdbarch_convert_register_p (struct gdbarch *gdbarch, int regnum, struct type *type);
+typedef bool (gdbarch_convert_register_p_ftype) (struct gdbarch *gdbarch, int regnum, struct type *type);
+extern bool gdbarch_convert_register_p (struct gdbarch *gdbarch, int regnum, struct type *type);
 extern void set_gdbarch_convert_register_p (struct gdbarch *gdbarch, gdbarch_convert_register_p_ftype *convert_register_p);
 
 typedef int (gdbarch_register_to_value_ftype) (const frame_info_ptr &frame, int regnum, struct type *type, gdb_byte *buf, int *optimizedp, int *unavailablep);
index d2d902b11f648eeb359157d30102281db8919dce..a75a4ed260140ac65b8ad3c772e7bbd61025d6ce 100644 (file)
@@ -739,7 +739,7 @@ FRAME corresponds to the longjmp frame.
 )
 
 Method(
-    type="int",
+    type="bool",
     name="convert_register_p",
     params=[("int", "regnum"), ("struct type *", "type")],
     predefault="generic_convert_register_p",
index 07eeba4c3c41eebab64dbfd95a0a4be0ccfe612c..312cef8a4faa0bffabf9d4c3877c2c49017521f9 100644 (file)
@@ -3506,10 +3506,10 @@ i386_next_regnum (int regnum)
   return -1;
 }
 
-/* Return nonzero if a value of type TYPE stored in register REGNUM
+/* Return true if a value of type TYPE stored in register REGNUM
    needs any special handling.  */
 
-static int
+static bool
 i386_convert_register_p (struct gdbarch *gdbarch,
                         int regnum, struct type *type)
 {
@@ -3531,7 +3531,7 @@ i386_convert_register_p (struct gdbarch *gdbarch,
        }
 
       if (last_regnum != -1)
-       return 1;
+       return true;
     }
 
   return i387_convert_register_p (gdbarch, regnum, type);
index 4b038f8d15d09f22d30a16cb8a97e93ad87f7cb1..a1f4510ecd55f12f3b4ac8b72be6bcaa7e038fd7 100644 (file)
@@ -320,10 +320,10 @@ i387_print_float_info (struct gdbarch *gdbarch, struct ui_file *file,
 }
 \f
 
-/* Return nonzero if a value of type TYPE stored in register REGNUM
+/* Return true if a value of type TYPE stored in register REGNUM
    needs any special handling.  */
 
-int
+bool
 i387_convert_register_p (struct gdbarch *gdbarch, int regnum,
                         struct type *type)
 {
@@ -333,12 +333,12 @@ i387_convert_register_p (struct gdbarch *gdbarch, int regnum,
         accessing them in their hardware type or TYPE is not float.  */
       if (type == i387_ext_type (gdbarch)
          || type->code () != TYPE_CODE_FLT)
-       return 0;
+       return false;
       else
-       return 1;
+       return true;
     }
 
-  return 0;
+  return false;
 }
 
 /* Read a value of type TYPE from register REGNUM in frame FRAME, and
index ce8b1fb1ca3d2fa3f6d8b2ba20d2bf39b48b69cd..5fb4f196fc2e85dbf7eadef8761e261a7e093e16 100644 (file)
@@ -85,11 +85,11 @@ extern void i387_print_float_info (struct gdbarch *gdbarch,
                                   const frame_info_ptr &frame,
                                   const char *args);
 
-/* Return nonzero if a value of type TYPE stored in register REGNUM
+/* Return true if a value of type TYPE stored in register REGNUM
    needs any special handling.  */
 
-extern int i387_convert_register_p (struct gdbarch *gdbarch, int regnum,
-                                   struct type *type);
+extern bool i387_convert_register_p (struct gdbarch *gdbarch, int regnum,
+                                    struct type *type);
 
 /* Read a value of type TYPE from register REGNUM in frame FRAME, and
    return its contents in TO.  */
index 378823a43e3ebc6f2b6e8c9c2aa3018947a114a4..9064af105fa0c0dca8e608948ed489cf9608b5f8 100644 (file)
@@ -1210,7 +1210,7 @@ ia64_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
 /* The ia64 needs to convert between various ieee floating-point formats
    and the special ia64 floating point register format.  */
 
-static int
+static bool
 ia64_convert_register_p (struct gdbarch *gdbarch, int regno, struct type *type)
 {
   return (regno >= IA64_FR0_REGNUM && regno <= IA64_FR127_REGNUM
index 8613062482d8101c34074bd5b8c184c7db4ee505..ae545c0f9aa82a3d9defa1da2259119fca6a12f5 100644 (file)
@@ -184,17 +184,17 @@ m68k_register_name (struct gdbarch *gdbarch, int regnum)
     return m68k_register_names[regnum];
 }
 \f
-/* Return nonzero if a value of type TYPE stored in register REGNUM
+/* Return true if a value of type TYPE stored in register REGNUM
    needs any special handling.  */
 
-static int
+static bool
 m68k_convert_register_p (struct gdbarch *gdbarch,
                         int regnum, struct type *type)
 {
   m68k_gdbarch_tdep *tdep = gdbarch_tdep<m68k_gdbarch_tdep> (gdbarch);
 
   if (!tdep->fpregs_present)
-    return 0;
+    return false;
   return (regnum >= M68K_FP0_REGNUM && regnum <= M68K_FP0_REGNUM + 7
          /* We only support floating-point values.  */
          && type->code () == TYPE_CODE_FLT
index 4c017f51c265416dab30e5646bf0f3ac68ec994b..6661e300c86e57cf63fd89458692a5f5479f1f8b 100644 (file)
@@ -238,10 +238,10 @@ mips_fpa0_regnum (struct gdbarch *gdbarch)
   return mips_regnum (gdbarch)->fp0 + 12;
 }
 
-/* Return 1 if REGNUM refers to a floating-point general register, raw
-   or cooked.  Otherwise return 0.  */
+/* Return true if REGNUM refers to a floating-point general register, raw
+   or cooked.  Otherwise return false.  */
 
-static int
+static bool
 mips_float_register_p (struct gdbarch *gdbarch, int regnum)
 {
   int rawnum = regnum % gdbarch_num_regs (gdbarch);
@@ -906,7 +906,7 @@ set_mips64_transfers_32bit_regs (const char *args, int from_tty,
    value that is being transferred to or from a pair of floating point
    registers each of which are (or are considered to be) only 4 bytes
    wide.  */
-static int
+static bool
 mips_convert_register_float_case_p (struct gdbarch *gdbarch, int regnum,
                                    struct type *type)
 {
@@ -919,7 +919,7 @@ mips_convert_register_float_case_p (struct gdbarch *gdbarch, int regnum,
 /* This predicate tests for the case of a value of less than 8
    bytes in width that is being transferred to or from an 8 byte
    general purpose register.  */
-static int
+static bool
 mips_convert_register_gpreg_case_p (struct gdbarch *gdbarch, int regnum,
                                    struct type *type)
 {
@@ -930,7 +930,7 @@ mips_convert_register_gpreg_case_p (struct gdbarch *gdbarch, int regnum,
          && type->length () < 8);
 }
 
-static int
+static bool
 mips_convert_register_p (struct gdbarch *gdbarch,
                         int regnum, struct type *type)
 {
index d5efd936c9e21a22b3a9f6ed60ae80fc4c839009..8723854812a0414f42f5da418c243eb33461c2fd 100644 (file)
@@ -2659,7 +2659,7 @@ rs6000_pseudo_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
 /* The register format for RS/6000 floating point registers is always
    double, we need a conversion if the memory format is float.  */
 
-static int
+static bool
 rs6000_convert_register_p (struct gdbarch *gdbarch, int regnum,
                           struct type *type)
 {