This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] cleanup: constify "struct attribute" function parameter


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  <sanimir.agovic@intel.com>

	* 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]