From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18798 invoked by alias); 26 Jul 2013 07:38:51 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 18784 invoked by uid 89); 26 Jul 2013 07:38:51 -0000 X-Spam-SWARE-Status: No, score=-3.3 required=5.0 tests=AWL,BAYES_40,KHOP_RCVD_UNTRUST,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL,RDNS_NONE,TW_BJ,TW_TM autolearn=no version=3.3.1 Received: from Unknown (HELO mga03.intel.com) (143.182.124.21) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Fri, 26 Jul 2013 07:38:49 +0000 Received: from azsmga002.ch.intel.com ([10.2.17.35]) by azsmga101.ch.intel.com with ESMTP; 26 Jul 2013 00:38:41 -0700 X-ExtLoop1: 1 Received: from irvmail001.ir.intel.com ([163.33.26.43]) by AZSMGA002.ch.intel.com with ESMTP; 26 Jul 2013 00:38:40 -0700 Received: from ulliclel004.iul.intel.com (ulliclel004.iul.intel.com [172.28.50.125]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id r6Q7dMV0014996 for ; Fri, 26 Jul 2013 08:39:23 +0100 Received: from ulliclel004.iul.intel.com (ulliclel004.iul.intel.com [127.0.0.1]) by ulliclel004.iul.intel.com (8.13.8/8.12.8/MailSET/client) with ESMTP id r6Q7cclq027559 for ; Fri, 26 Jul 2013 09:38:38 +0200 Received: (from sagovic@localhost) by ulliclel004.iul.intel.com (8.13.8/8.13.1/Submit) id r6Q7cXG1027558 for gdb-patches@sourceware.org; Fri, 26 Jul 2013 09:38:33 +0200 From: Sanimir Agovic To: gdb-patches@sourceware.org Subject: [PATCH] cleanup: constify "struct attribute" function parameter Date: Fri, 26 Jul 2013 07:38:00 -0000 Message-Id: <1374824313-27525-1-git-send-email-sanimir.agovic@intel.com> X-SW-Source: 2013-07/txt/msg00634.txt.bz2 This is a follow up on [1] and constifies the remaining arguments. Main motivation is to document which functions modifiy its struct attribute parameter. [1] http://sourceware.org/ml/gdb-patches/2013-07/msg00530.html -Sanimir 2013-07-25 Sanimir Agovic * dwarf2read.c (dwarf2_get_ref_die_offset): Constify struct attribute parameter. (dwarf2_const_value_data): Constify struct attribute parameter. (dwarf2_const_value): Constify struct attribute parameter. (dwarf2_const_value_attr): Constify struct attribute parameter. (lookup_die_type): Constify struct attribute parameter. (dwarf2_get_attr_constant_value): Constify struct attribute parameter. (follow_die_ref_or_sig): Constify struct attribute parameter. (follow_die_ref): Constify struct attribute parameter. (follow_die_sig): Constify struct attribute parameter. (get_DW_AT_signature_type): Constify struct attribute parameter. (get_type_unit_group): Constify struct attribute parameter. (fill_in_loclist_baton): Constify struct attribute parameter. (dwarf2_symbol_mark_computed): Constify struct attribute parameter. (type_unit_group): Constify struct attribute parameter. --- gdb/dwarf2read.c | 50 +++++++++++++++++++++++++------------------------- 1 files changed, 25 insertions(+), 25 deletions(-) diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index 6fe1686..67a39f2 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -1452,10 +1452,10 @@ static struct symbol *new_symbol (struct die_info *, struct type *, static struct symbol *new_symbol_full (struct die_info *, struct type *, struct dwarf2_cu *, struct symbol *); -static void dwarf2_const_value (struct attribute *, struct symbol *, +static void dwarf2_const_value (const struct attribute *, struct symbol *, struct dwarf2_cu *); -static void dwarf2_const_value_attr (struct attribute *attr, +static void dwarf2_const_value_attr (const struct attribute *attr, struct type *type, const char *name, struct obstack *obstack, @@ -1476,7 +1476,7 @@ static void set_descriptive_type (struct type *, struct die_info *, static struct type *die_containing_type (struct die_info *, struct dwarf2_cu *); -static struct type *lookup_die_type (struct die_info *, struct attribute *, +static struct type *lookup_die_type (struct die_info *, const struct attribute *, struct dwarf2_cu *); static struct type *read_type_die (struct die_info *, struct dwarf2_cu *); @@ -1608,27 +1608,27 @@ static void dump_die_1 (struct ui_file *, int level, int max_level, static void store_in_ref_table (struct die_info *, struct dwarf2_cu *); -static sect_offset dwarf2_get_ref_die_offset (struct attribute *); +static sect_offset dwarf2_get_ref_die_offset (const struct attribute *); -static LONGEST dwarf2_get_attr_constant_value (struct attribute *, int); +static LONGEST dwarf2_get_attr_constant_value (const struct attribute *, int); static struct die_info *follow_die_ref_or_sig (struct die_info *, - struct attribute *, + const struct attribute *, struct dwarf2_cu **); static struct die_info *follow_die_ref (struct die_info *, - struct attribute *, + const struct attribute *, struct dwarf2_cu **); static struct die_info *follow_die_sig (struct die_info *, - struct attribute *, + const struct attribute *, struct dwarf2_cu **); static struct type *get_signatured_type (struct die_info *, ULONGEST, struct dwarf2_cu *); static struct type *get_DW_AT_signature_type (struct die_info *, - struct attribute *, + const struct attribute *, struct dwarf2_cu *); static void load_full_type_unit (struct dwarf2_per_cu_data *per_cu); @@ -1636,7 +1636,7 @@ static void load_full_type_unit (struct dwarf2_per_cu_data *per_cu); static void read_signatured_type (struct signatured_type *); static struct type_unit_group *get_type_unit_group - (struct dwarf2_cu *, struct attribute *); + (struct dwarf2_cu *, const struct attribute *); static void build_type_unit_groups (die_reader_func_ftype *, void *); @@ -1659,9 +1659,9 @@ static int attr_form_is_ref (const struct attribute *); static void fill_in_loclist_baton (struct dwarf2_cu *cu, struct dwarf2_loclist_baton *baton, - struct attribute *attr); + const struct attribute *attr); -static void dwarf2_symbol_mark_computed (struct attribute *attr, +static void dwarf2_symbol_mark_computed (const struct attribute *attr, struct symbol *sym, struct dwarf2_cu *cu, int is_block); @@ -5414,7 +5414,7 @@ create_type_unit_group (struct dwarf2_cu *cu, sect_offset line_offset_struct) STMT_LIST is a DW_AT_stmt_list attribute. */ static struct type_unit_group * -get_type_unit_group (struct dwarf2_cu *cu, struct attribute *stmt_list) +get_type_unit_group (struct dwarf2_cu *cu, const struct attribute *stmt_list) { struct tu_stats *tu_stats = &dwarf2_per_objfile->tu_stats; struct type_unit_group *tu_group; @@ -16784,7 +16784,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu) because that is the interpretation long in use by GCC. */ static gdb_byte * -dwarf2_const_value_data (struct attribute *attr, struct obstack *obstack, +dwarf2_const_value_data (const struct attribute *attr, struct obstack *obstack, struct dwarf2_cu *cu, LONGEST *value, int bits) { struct objfile *objfile = cu->objfile; @@ -16816,7 +16816,7 @@ dwarf2_const_value_data (struct attribute *attr, struct obstack *obstack, expression. */ static void -dwarf2_const_value_attr (struct attribute *attr, struct type *type, +dwarf2_const_value_attr (const struct attribute *attr, struct type *type, const char *name, struct obstack *obstack, struct dwarf2_cu *cu, LONGEST *value, const gdb_byte **bytes, @@ -16919,7 +16919,7 @@ dwarf2_const_value_attr (struct attribute *attr, struct type *type, /* Copy constant value from an attribute to a symbol. */ static void -dwarf2_const_value (struct attribute *attr, struct symbol *sym, +dwarf2_const_value (const struct attribute *attr, struct symbol *sym, struct dwarf2_cu *cu) { struct objfile *objfile = cu->objfile; @@ -17058,7 +17058,7 @@ build_error_marker_type (struct dwarf2_cu *cu, struct die_info *die) If there is no type substitute an error marker. */ static struct type * -lookup_die_type (struct die_info *die, struct attribute *attr, +lookup_die_type (struct die_info *die, const struct attribute *attr, struct dwarf2_cu *cu) { struct objfile *objfile = cu->objfile; @@ -17954,7 +17954,7 @@ store_in_ref_table (struct die_info *die, struct dwarf2_cu *cu) required kind. */ static sect_offset -dwarf2_get_ref_die_offset (struct attribute *attr) +dwarf2_get_ref_die_offset (const struct attribute *attr) { sect_offset retval = { DW_UNSND (attr) }; @@ -17972,7 +17972,7 @@ dwarf2_get_ref_die_offset (struct attribute *attr) * the value held by the attribute is not constant. */ static LONGEST -dwarf2_get_attr_constant_value (struct attribute *attr, int default_value) +dwarf2_get_attr_constant_value (const struct attribute *attr, int default_value) { if (attr->form == DW_FORM_sdata) return DW_SND (attr); @@ -17996,7 +17996,7 @@ dwarf2_get_attr_constant_value (struct attribute *attr, int default_value) On exit *REF_CU is the CU of the result. */ static struct die_info * -follow_die_ref_or_sig (struct die_info *src_die, struct attribute *attr, +follow_die_ref_or_sig (struct die_info *src_die, const struct attribute *attr, struct dwarf2_cu **ref_cu) { struct die_info *die; @@ -18070,7 +18070,7 @@ follow_die_offset (sect_offset offset, int offset_in_dwz, On exit *REF_CU is the CU of the result. */ static struct die_info * -follow_die_ref (struct die_info *src_die, struct attribute *attr, +follow_die_ref (struct die_info *src_die, const struct attribute *attr, struct dwarf2_cu **ref_cu) { sect_offset offset = dwarf2_get_ref_die_offset (attr); @@ -18382,7 +18382,7 @@ follow_die_sig_1 (struct die_info *src_die, struct signatured_type *sig_type, If the referenced type cannot be found an error is thrown. */ static struct die_info * -follow_die_sig (struct die_info *src_die, struct attribute *attr, +follow_die_sig (struct die_info *src_die, const struct attribute *attr, struct dwarf2_cu **ref_cu) { ULONGEST signature = DW_SIGNATURE (attr); @@ -18480,7 +18480,7 @@ get_signatured_type (struct die_info *die, ULONGEST signature, reading in and processing the type unit if necessary. */ static struct type * -get_DW_AT_signature_type (struct die_info *die, struct attribute *attr, +get_DW_AT_signature_type (struct die_info *die, const struct attribute *attr, struct dwarf2_cu *cu) /* ARI: editCase function */ { /* Yes, DW_AT_signature can use a non-ref_sig8 reference. */ @@ -19890,7 +19890,7 @@ cu_debug_loc_section (struct dwarf2_cu *cu) static void fill_in_loclist_baton (struct dwarf2_cu *cu, struct dwarf2_loclist_baton *baton, - struct attribute *attr) + const struct attribute *attr) { struct dwarf2_section_info *section = cu_debug_loc_section (cu); @@ -19907,7 +19907,7 @@ fill_in_loclist_baton (struct dwarf2_cu *cu, } static void -dwarf2_symbol_mark_computed (struct attribute *attr, struct symbol *sym, +dwarf2_symbol_mark_computed (const struct attribute *attr, struct symbol *sym, struct dwarf2_cu *cu, int is_block) { struct objfile *objfile = dwarf2_per_objfile->objfile; -- 1.7.1.1