From: Zoran Zaric Date: Fri, 26 Feb 2021 10:14:53 +0000 (+0000) Subject: Cleanup of the dwarf_expr_context constructor X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=fb4cdecb7e3b9cab8a83f3e69a9deafcf53501fe;p=binutils-gdb.git Cleanup of the dwarf_expr_context constructor Move the initial values for dwarf_expr_context class data members to the class declaration in expr.h. gdb/ChangeLog: * dwarf2/expr.c (dwarf_expr_context::dwarf_expr_context): Remove initial data members values. * dwarf2/expr.h (dwarf_expr_context): Add initial values to the class data members. --- diff --git a/gdb/dwarf2/expr.c b/gdb/dwarf2/expr.c index 107b9cdbd5d..aa166b22d9c 100644 --- a/gdb/dwarf2/expr.c +++ b/gdb/dwarf2/expr.c @@ -90,16 +90,7 @@ dwarf_expr_context::address_type () const /* Create a new context for the expression evaluator. */ dwarf_expr_context::dwarf_expr_context (dwarf2_per_objfile *per_objfile) -: gdbarch (NULL), - addr_size (0), - ref_addr_size (0), - recursion_depth (0), - max_recursion_depth (0x100), - location (DWARF_VALUE_MEMORY), - len (0), - data (NULL), - initialized (0), - per_objfile (per_objfile) +: per_objfile (per_objfile) { } diff --git a/gdb/dwarf2/expr.h b/gdb/dwarf2/expr.h index b28a0775602..60021eb0969 100644 --- a/gdb/dwarf2/expr.h +++ b/gdb/dwarf2/expr.h @@ -132,32 +132,32 @@ struct dwarf_expr_context std::vector stack; /* Target architecture to use for address operations. */ - struct gdbarch *gdbarch; + struct gdbarch *gdbarch = nullptr; /* Target address size in bytes. */ - int addr_size; + int addr_size = 0; /* DW_FORM_ref_addr size in bytes. If -1 DWARF is executed from a frame context and operations depending on DW_FORM_ref_addr are not allowed. */ - int ref_addr_size; + int ref_addr_size = 0; /* The current depth of dwarf expression recursion, via DW_OP_call*, DW_OP_fbreg, DW_OP_push_object_address, etc., and the maximum depth we'll tolerate before raising an error. */ - int recursion_depth, max_recursion_depth; + int recursion_depth = 0, max_recursion_depth = 0x100; /* Location of the value. */ - enum dwarf_value_location location; + dwarf_value_location location = DWARF_VALUE_MEMORY; /* For DWARF_VALUE_LITERAL, the current literal value's length and data. For DWARF_VALUE_IMPLICIT_POINTER, LEN is the offset of the target DIE of sect_offset kind. */ - ULONGEST len; - const gdb_byte *data; + ULONGEST len = 0; + const gdb_byte *data = nullptr; /* Initialization status of variable: Non-zero if variable has been initialized; zero otherwise. */ - int initialized; + int initialized = 0; /* A vector of pieces.