From a7bdace9ca16df47a3700502fa13d180b56a4a2e Mon Sep 17 00:00:00 2001 From: Gabriel Corona Date: Mon, 15 Jun 2015 12:37:49 +0200 Subject: [PATCH] Remove non-statis initializer in s_dw_type, s_mc_object_info Not supported with GCC < 4.8. --- src/mc/mc_dwarf.cpp | 26 ++++++++++++++++++-- src/mc/mc_object_info.h | 54 ++++++++++++++++++++--------------------- 2 files changed, 51 insertions(+), 29 deletions(-) diff --git a/src/mc/mc_dwarf.cpp b/src/mc/mc_dwarf.cpp index 67bb0e3ee5..c81b34fb12 100644 --- a/src/mc/mc_dwarf.cpp +++ b/src/mc/mc_dwarf.cpp @@ -1074,6 +1074,18 @@ void mc_frame_free(dw_frame_t frame) s_dw_type::s_dw_type() { + this->type = 0; + this->id = 0; + this->name = nullptr; + this->byte_size = 0; + this->element_count = 0; + this->dw_type_id = nullptr; + this->members = nullptr; + this->is_pointer_type = 0; + this->location = { 0, 0, 0, 0}; + this->offset = 0; + this->subtype = nullptr; + this->full_type = nullptr; } s_dw_type::~s_dw_type() @@ -1110,12 +1122,22 @@ void dw_variable_free_voidp(void *t) s_mc_object_info::s_mc_object_info() { - this->types = xbt_dict_new_homogeneous((void (*)(void *)) dw_type_free); + this->flags = 0; + this->file_name = nullptr; + this->start = nullptr; + this->end = nullptr; + this->start_exec = nullptr; + this->end_exec = nullptr; + this->start_rw = nullptr; + this->end_rw = nullptr; + this->start_ro = nullptr; + this->end_ro = nullptr; this->subprograms = xbt_dict_new_homogeneous((void (*)(void *)) mc_frame_free); this->global_variables = xbt_dynar_new(sizeof(dw_variable_t), dw_variable_free_voidp); - + this->types = xbt_dict_new_homogeneous((void (*)(void *)) dw_type_free); this->full_types_by_name = xbt_dict_new_homogeneous(NULL); + this->functions_index = nullptr; } s_mc_object_info::~s_mc_object_info() diff --git a/src/mc/mc_object_info.h b/src/mc/mc_object_info.h index 3b1f60a8c0..cf0b742a5c 100644 --- a/src/mc/mc_object_info.h +++ b/src/mc/mc_object_info.h @@ -33,21 +33,21 @@ struct s_dw_type { s_dw_type(); ~s_dw_type(); - e_dw_type_type type = 0; - Dwarf_Off id = 0; /* Offset in the section (in hexadecimal form) */ - char *name = nullptr; /* Name of the type */ - int byte_size = 0; /* Size in bytes */ - int element_count = 0; /* Number of elements for array type */ - char *dw_type_id = nullptr; /* DW_AT_type id */ - xbt_dynar_t members = nullptr; /* if DW_TAG_structure_type, DW_TAG_class_type, DW_TAG_union_type*/ - int is_pointer_type = 0; + e_dw_type_type type; + Dwarf_Off id; /* Offset in the section (in hexadecimal form) */ + char *name; /* Name of the type */ + int byte_size; /* Size in bytes */ + int element_count; /* Number of elements for array type */ + char *dw_type_id; /* DW_AT_type id */ + xbt_dynar_t members; /* if DW_TAG_structure_type, DW_TAG_class_type, DW_TAG_union_type*/ + int is_pointer_type; // Location (for members) is either of: - struct s_mc_expression location = { 0, 0, 0, 0 }; - int offset = 0; + struct s_mc_expression location; + int offset; - dw_type_t subtype = nullptr; // DW_AT_type - dw_type_t full_type = nullptr; // The same (but more complete) type + dw_type_t subtype; // DW_AT_type + dw_type_t full_type; // The same (but more complete) type }; XBT_INTERNAL void dw_variable_free(dw_variable_t v); @@ -66,25 +66,25 @@ struct s_mc_object_info { s_mc_object_info(s_mc_object_info const&) = delete; s_mc_object_info& operator=(s_mc_object_info const&) = delete; - mc_object_info_flags flags = 0; - char* file_name = nullptr; - const void* start = nullptr; - const void *end = nullptr; - char *start_exec = nullptr; - char *end_exec = nullptr; // Executable segment - char *start_rw = nullptr; - char *end_rw = nullptr; // Read-write segment - char *start_ro = nullptr; - char *end_ro = nullptr; // read-only segment - xbt_dict_t subprograms = nullptr; // xbt_dict_t - xbt_dynar_t global_variables = nullptr; // xbt_dynar_t - xbt_dict_t types = nullptr; // xbt_dict_t - xbt_dict_t full_types_by_name = nullptr; // xbt_dict_t (full defined type only) + mc_object_info_flags flags; + char* file_name; + const void* start; + const void *end; + char *start_exec; + char *end_exec; // Executable segment + char *start_rw; + char *end_rw; // Read-write segment + char *start_ro; + char *end_ro; // read-only segment + xbt_dict_t subprograms; // xbt_dict_t + xbt_dynar_t global_variables; // xbt_dynar_t + xbt_dict_t types; // xbt_dict_t + xbt_dict_t full_types_by_name; // xbt_dict_t (full defined type only) // Here we sort the minimal information for an efficient (and cache-efficient) // lookup of a function given an instruction pointer. // The entries are sorted by low_pc and a binary search can be used to look them up. - xbt_dynar_t functions_index = nullptr; + xbt_dynar_t functions_index; }; static inline __attribute__ ((always_inline)) -- 2.20.1