[binutils-gdb] gdb: remove unnecessary predefaults in gdbarch.py

Simon Marchi via Gdb-cvs <[email protected]>
Newsgroups gmane.comp.gdb.cvs
Message-ID <[email protected]>
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=f54b1dccfe4032a35843021175ab08719a94d5aa

commit f54b1dccfe4032a35843021175ab08719a94d5aa
Author: Simon Marchi <[email protected]>
Date:   Fri Feb 27 15:05:30 2026 -0500

    gdb: remove unnecessary predefaults in gdbarch.py
    
    These predefaults are unnecessary, because 0/nullptr/false is already
    the default value.
    
    Change-Id: I28b82ec4802075faa8f349f13f724542fa43f054
    Approved-By: Tom Tromey <[email protected]>

Diff:
---
 gdb/gdbarch-gen.c         |  8 ++++----
 gdb/gdbarch_components.py | 14 --------------
 2 files changed, 4 insertions(+), 18 deletions(-)

diff --git a/gdb/gdbarch-gen.c b/gdb/gdbarch-gen.c
index 1becb9702de..79347b87053 100644
--- a/gdb/gdbarch-gen.c
+++ b/gdb/gdbarch-gen.c
@@ -120,7 +120,7 @@ struct gdbarch
   gdbarch_inner_than_ftype *inner_than = nullptr;
   gdbarch_breakpoint_from_pc_ftype *breakpoint_from_pc = default_breakpoint_from_pc;
   gdbarch_breakpoint_kind_from_pc_ftype *breakpoint_kind_from_pc = nullptr;
-  gdbarch_sw_breakpoint_from_kind_ftype *sw_breakpoint_from_kind = NULL;
+  gdbarch_sw_breakpoint_from_kind_ftype *sw_breakpoint_from_kind = nullptr;
   gdbarch_breakpoint_kind_from_current_state_ftype *breakpoint_kind_from_current_state = default_breakpoint_kind_from_current_state;
   gdbarch_adjust_breakpoint_address_ftype *adjust_breakpoint_address = nullptr;
   gdbarch_memory_insert_breakpoint_ftype *memory_insert_breakpoint = default_memory_insert_breakpoint;
@@ -187,9 +187,9 @@ struct gdbarch
   ULONGEST max_insn_length = 0;
   gdbarch_displaced_step_copy_insn_ftype *displaced_step_copy_insn = nullptr;
   gdbarch_displaced_step_hw_singlestep_ftype *displaced_step_hw_singlestep = default_displaced_step_hw_singlestep;
-  gdbarch_displaced_step_fixup_ftype *displaced_step_fixup = NULL;
+  gdbarch_displaced_step_fixup_ftype *displaced_step_fixup = nullptr;
   gdbarch_displaced_step_prepare_ftype *displaced_step_prepare = nullptr;
-  gdbarch_displaced_step_finish_ftype *displaced_step_finish = NULL;
+  gdbarch_displaced_step_finish_ftype *displaced_step_finish = nullptr;
   gdbarch_displaced_step_copy_insn_closure_by_addr_ftype *displaced_step_copy_insn_closure_by_addr = nullptr;
   gdbarch_displaced_step_restore_all_in_ptid_ftype *displaced_step_restore_all_in_ptid = nullptr;
   ULONGEST displaced_step_buffer_length = 0;
@@ -230,7 +230,7 @@ struct gdbarch
   gdbarch_gen_return_address_ftype *gen_return_address = default_gen_return_address;
   gdbarch_info_proc_ftype *info_proc = nullptr;
   gdbarch_core_info_proc_ftype *core_info_proc = nullptr;
-  struct ravenscar_arch_ops * ravenscar_ops = NULL;
+  struct ravenscar_arch_ops * ravenscar_ops = nullptr;
   gdbarch_insn_is_call_ftype *insn_is_call = default_insn_is_call;
   gdbarch_insn_is_ret_ftype *insn_is_ret = default_insn_is_ret;
   gdbarch_insn_is_jump_ftype *insn_is_jump = default_insn_is_jump;
diff --git a/gdb/gdbarch_components.py b/gdb/gdbarch_components.py
index f817bcb3c3f..de4335f1515 100644
--- a/gdb/gdbarch_components.py
+++ b/gdb/gdbarch_components.py
@@ -334,7 +334,6 @@ addr_bit is the size of a target address as represented in gdb
 """,
     type="int",
     name="addr_bit",
-    predefault="0",
     postdefault="gdbarch_ptr_bit (gdbarch)",
     invalid=False,
 )
@@ -481,7 +480,6 @@ combinations of other registers, or they may be computed by GDB.
 """,
     type="int",
     name="num_pseudo_regs",
-    predefault="0",
     invalid=False,
 )
 
@@ -1025,7 +1023,6 @@ SIZE is set to the software breakpoint's length in memory.
     type="const gdb_byte *",
     name="sw_breakpoint_from_kind",
     params=[("int", "kind"), ("int *", "size")],
-    predefault="NULL",
     invalid=False,
 )
 
@@ -1528,7 +1525,6 @@ stop PC.
 Value(
     type="bool",
     name="cannot_step_breakpoint",
-    predefault="false",
     invalid=False,
 )
 
@@ -1539,7 +1535,6 @@ non-steppable watchpoints.
 """,
     type="bool",
     name="have_nonsteppable_watchpoint",
-    predefault="false",
     invalid=False,
 )
 
@@ -1783,7 +1778,6 @@ set this to true.
 """,
     type="bool",
     name="vtable_function_descriptors",
-    predefault="false",
     invalid=False,
 )
 
@@ -1803,7 +1797,6 @@ The maximum length of an instruction on this architecture in bytes.
 """,
     type="ULONGEST",
     name="max_insn_length",
-    predefault="0",
     predicate=True,
 )
 
@@ -1895,7 +1888,6 @@ see the comments in infrun.c.
         ("bool", "completed_p"),
     ],
     predicate=False,
-    predefault="NULL",
     invalid="(gdbarch->displaced_step_copy_insn == nullptr) != (gdbarch->displaced_step_fixup == nullptr)",
 )
 
@@ -1922,7 +1914,6 @@ checking if WS.kind is TARGET_WAITKIND_THREAD_EXITED.
     type="displaced_step_finish_status",
     name="displaced_step_finish",
     params=[("thread_info *", "thread"), ("const target_waitstatus &", "ws")],
-    predefault="NULL",
     invalid="(! gdbarch->displaced_step_finish) != (! gdbarch->displaced_step_prepare)",
 )
 
@@ -1956,7 +1947,6 @@ displaced-step instruction to multiple replacement instructions.
 """,
     type="ULONGEST",
     name="displaced_step_buffer_length",
-    predefault="0",
     postdefault="gdbarch->max_insn_length",
     invalid="gdbarch->displaced_step_buffer_length < gdbarch->max_insn_length",
 )
@@ -2373,7 +2363,6 @@ addresses.
 """,
     type="bool",
     name="has_global_solist",
-    predefault="false",
     invalid=False,
 )
 
@@ -2386,7 +2375,6 @@ this property should be set to true.
 """,
     type="bool",
     name="has_global_breakpoints",
-    predefault="false",
     invalid=False,
 )
 
@@ -2445,7 +2433,6 @@ considered a directory separator.
 """,
     type="bool",
     name="has_dos_based_file_system",
-    predefault="false",
     invalid=False,
 )
 
@@ -2500,7 +2487,6 @@ Ravenscar arch-dependent ops.
 """,
     type="struct ravenscar_arch_ops *",
     name="ravenscar_ops",
-    predefault="NULL",
     invalid=False,
     printer="host_address_to_string (gdbarch->ravenscar_ops)",
 )
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.