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]

[ob] Fix most warnings in dwarf2read.c


Most of the noise from dwarf2read.c comes from indecision over whether
*bytes_read should be int or unsigned int.  Unsigned makes more sense,
so I updated all of the "int" sites.  Tested on x86_64-pc-linux-gnu and
committed.

The three warnings left in this file can not be fixed locally without bogus
casts; they'll require pretty substantial changes.  Putting those off...

-- 
Daniel Jacobowitz
CodeSourcery

2006-01-17  Daniel Jacobowitz  <dan@codesourcery.com>

	* dwarf2read.c (peek_die_abbrev, read_address, read_initial_length)
	(read_offset): Change BYTES_READ argument to unsigned int.
	(dwarf2_build_psymtabs_easy, read_comp_unit_head)
	(create_all_comp_units, dwarf2_get_pc_bounds)
	(dwarf_decode_line_header, var_decode_location)
	(dwarf_decode_macros): Change local BYTES_READ variables to
	unsigned int.
	(read_indirect_string): Remove obsolete cast.

Index: dwarf2read.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2read.c,v
retrieving revision 1.187
diff -u -p -r1.187 dwarf2read.c
--- dwarf2read.c	17 Dec 2005 22:33:59 -0000	1.187
+++ dwarf2read.c	17 Jan 2006 14:27:53 -0000
@@ -754,7 +754,8 @@ static void dwarf2_read_abbrevs (bfd *ab
 
 static void dwarf2_free_abbrev_table (void *);
 
-static struct abbrev_info *peek_die_abbrev (char *, int *, struct dwarf2_cu *);
+static struct abbrev_info *peek_die_abbrev (char *, unsigned int *,
+					    struct dwarf2_cu *);
 
 static struct abbrev_info *dwarf2_lookup_abbrev (unsigned int,
 						 struct dwarf2_cu *);
@@ -792,13 +793,13 @@ static unsigned int read_4_bytes (bfd *,
 static unsigned long read_8_bytes (bfd *, char *);
 
 static CORE_ADDR read_address (bfd *, char *ptr, struct dwarf2_cu *,
-			       int *bytes_read);
+			       unsigned int *);
 
 static LONGEST read_initial_length (bfd *, char *,
-                                    struct comp_unit_head *, int *bytes_read);
+                                    struct comp_unit_head *, unsigned int *);
 
 static LONGEST read_offset (bfd *, char *, const struct comp_unit_head *,
-                            int *bytes_read);
+                            unsigned int *);
 
 static char *read_n_bytes (bfd *, char *, unsigned int);
 
@@ -1241,10 +1242,10 @@ dwarf2_build_psymtabs_easy (struct objfi
   while ((pubnames_ptr - pubnames_buffer) < dwarf2_per_objfile->pubnames_size)
     {
       struct comp_unit_head cu_header;
-      int bytes_read;
+      unsigned int bytes_read;
 
       entry_length = read_initial_length (abfd, pubnames_ptr, &cu_header,
-                                         &bytes_read);
+                                          &bytes_read);
       pubnames_ptr += bytes_read;
       version = read_1_byte (abfd, pubnames_ptr);
       pubnames_ptr += 1;
@@ -1268,7 +1269,7 @@ read_comp_unit_head (struct comp_unit_he
 		     char *info_ptr, bfd *abfd)
 {
   int signed_addr;
-  int bytes_read;
+  unsigned int bytes_read;
   cu_header->length = read_initial_length (abfd, info_ptr, cu_header,
                                            &bytes_read);
   info_ptr += bytes_read;
@@ -1626,7 +1627,7 @@ create_all_comp_units (struct objfile *o
       char *beg_of_comp_unit;
       struct dwarf2_per_cu_data *this_cu;
       unsigned long offset;
-      int bytes_read;
+      unsigned int bytes_read;
 
       offset = info_ptr - dwarf2_per_objfile->info_buffer;
 
@@ -2137,7 +2138,8 @@ add_partial_enumeration (struct partial_
    the initial number.  */
 
 static struct abbrev_info *
-peek_die_abbrev (char *info_ptr, int *bytes_read, struct dwarf2_cu *cu)
+peek_die_abbrev (char *info_ptr, unsigned int *bytes_read,
+		 struct dwarf2_cu *cu)
 {
   bfd *abfd = cu->objfile->obfd;
   unsigned int abbrev_number;
@@ -3055,7 +3057,7 @@ dwarf2_get_pc_bounds (struct die_info *d
 	  /* Base address selection entry.  */
 	  CORE_ADDR base;
 	  int found_base;
-	  int dummy;
+	  unsigned int dummy;
 	  char *buffer;
 	  CORE_ADDR marker;
 	  int low_set;
@@ -5801,7 +5803,8 @@ read_8_bytes (bfd *abfd, char *buf)
 }
 
 static CORE_ADDR
-read_address (bfd *abfd, char *buf, struct dwarf2_cu *cu, int *bytes_read)
+read_address (bfd *abfd, char *buf, struct dwarf2_cu *cu,
+	      unsigned int *bytes_read)
 {
   struct comp_unit_head *cu_header = &cu->header;
   CORE_ADDR retval = 0;
@@ -5894,7 +5897,7 @@ read_address (bfd *abfd, char *buf, stru
 
 static LONGEST
 read_initial_length (bfd *abfd, char *buf, struct comp_unit_head *cu_header,
-                     int *bytes_read)
+                     unsigned int *bytes_read)
 {
   LONGEST length = bfd_get_32 (abfd, (bfd_byte *) buf);
 
@@ -5938,7 +5941,7 @@ read_initial_length (bfd *abfd, char *bu
 
 static LONGEST
 read_offset (bfd *abfd, char *buf, const struct comp_unit_head *cu_header,
-             int *bytes_read)
+             unsigned int *bytes_read)
 {
   LONGEST retval = 0;
 
@@ -5993,7 +5996,7 @@ read_indirect_string (bfd *abfd, char *b
 		      unsigned int *bytes_read_ptr)
 {
   LONGEST str_offset = read_offset (abfd, buf, cu_header,
-				    (int *) bytes_read_ptr);
+				    bytes_read_ptr);
 
   if (dwarf2_per_objfile->str_buffer == NULL)
     {
@@ -6279,7 +6282,7 @@ dwarf_decode_line_header (unsigned int o
   struct cleanup *back_to;
   struct line_header *lh;
   char *line_ptr;
-  int bytes_read;
+  unsigned int bytes_read;
   int i;
   char *cur_dir, *cur_file;
 
@@ -6739,7 +6742,7 @@ var_decode_location (struct attribute *a
       && DW_BLOCK (attr)->size == 1 + cu_header->addr_size
       && DW_BLOCK (attr)->data[0] == DW_OP_addr)
     {
-      int dummy;
+      unsigned int dummy;
 
       SYMBOL_VALUE_ADDRESS (sym) =
 	read_address (objfile->obfd, DW_BLOCK (attr)->data + 1, cu, &dummy);
@@ -9107,7 +9110,7 @@ dwarf_decode_macros (struct line_header 
         case DW_MACINFO_define:
         case DW_MACINFO_undef:
           {
-            int bytes_read;
+            unsigned int bytes_read;
             int line;
             char *body;
 
@@ -9135,7 +9138,7 @@ dwarf_decode_macros (struct line_header 
 
         case DW_MACINFO_start_file:
           {
-            int bytes_read;
+            unsigned int bytes_read;
             int line, file;
 
             line = read_unsigned_leb128 (abfd, mac_ptr, &bytes_read);
@@ -9186,7 +9189,7 @@ dwarf_decode_macros (struct line_header 
 
         case DW_MACINFO_vendor_ext:
           {
-            int bytes_read;
+            unsigned int bytes_read;
             int constant;
             char *string;
 


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