This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


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

Fix readelf.c warnings



With readelf I currently I get these warnings:

/cvs/binutils-ln/binutils/readelf.c: In function `display_debug_frames':
/cvs/binutils-ln/binutils/readelf.c:7207: warning: long unsigned int format, unsigned int arg (arg 2)
/cvs/binutils-ln/binutils/readelf.c:7211: warning: long unsigned int format, unsigned int arg (arg 2)
/cvs/binutils-ln/binutils/readelf.c:7238: warning: value computed is not used
/cvs/binutils-ln/binutils/readelf.c:7317: warning: long unsigned int format, unsigned int arg (arg 2)
/cvs/binutils-ln/binutils/readelf.c:7258: warning: unused variable `size'
/cvs/binutils-ln/binutils/readelf.c:7342: warning: unused variable `vma'
/cvs/binutils-ln/binutils/readelf.c:7464: warning: int format, long int arg (arg 3)
/cvs/binutils-ln/binutils/readelf.c:7482: warning: unsigned int format, different type arg (arg 2)
/cvs/binutils-ln/binutils/readelf.c:7493: warning: int format, long int arg (arg 2)
/cvs/binutils-ln/binutils/readelf.c:7504: warning: int format, long int arg (arg 2)
/cvs/binutils-ln/binutils/readelf.c:7515: warning: int format, long int arg (arg 2)
/cvs/binutils-ln/binutils/readelf.c:7524: warning: int format, long int arg (arg 2)
/cvs/binutils-ln/binutils/readelf.c:7524: warning: int format, long int arg (arg 3)
/cvs/binutils-ln/binutils/readelf.c:7532: warning: int format, long int arg (arg 2)
/cvs/binutils-ln/binutils/readelf.c:7540: warning: int format, long int arg (arg 2)
/cvs/binutils-ln/binutils/readelf.c:7548: warning: int format, long int arg (arg 2)
/cvs/binutils-ln/binutils/readelf.c:7557: warning: int format, long int arg (arg 2)
/cvs/binutils-ln/binutils/readelf.c:7624: warning: int format, long int arg (arg 2)
/cvs/binutils-ln/binutils/readelf.c:7633: warning: int format, long int arg (arg 2)
/cvs/binutils-ln/binutils/readelf.c:7633: warning: int format, long int arg (arg 3)

I'm appending a patch that fixes all these.

Ok to commit?

Andreas

2001-05-28  Andreas Jaeger  <aj@suse.de>

	* readelf.c (display_debug_frames): Fix warnings: Remove unused
	variables, fix format strings.


============================================================
Index: binutils/readelf.c
--- binutils/readelf.c	2001/05/16 16:20:26	1.102
+++ binutils/readelf.c	2001/05/28 14:48:22
@@ -7202,13 +7202,13 @@
 
 	  if (do_debug_frames_interp)
 	    printf ("\n%08lx %08lx %08lx CIE \"%s\" cf=%d df=%d ra=%d\n",
-		    saved_start - section_start, length, cie_id,
+		    (unsigned long)(saved_start - section_start), length, cie_id,
 		    fc->augmentation, fc->code_factor, fc->data_factor,
 		    fc->ra);
 	  else
 	    {
 	      printf ("\n%08lx %08lx %08lx CIE\n",
-		      saved_start - section_start, length, cie_id);
+		      (unsigned long)(saved_start - section_start), length, cie_id);
 	      printf ("  Version:               %d\n", version);
 	      printf ("  Augmentation:          \"%s\"\n", fc->augmentation);
 	      printf ("  Code alignment factor: %u\n", fc->code_factor);
@@ -7235,7 +7235,7 @@
 	      while (1)
 		{
 		  if (*p == 'L')
-		    *q++;
+		    q++;
 		  else if (*p == 'P')
 		    q += 1 + size_of_encoded_value (*q);
 		  else if (*p == 'R')
@@ -7255,7 +7255,6 @@
 	{
 	  unsigned char *    look_for;
 	  static Frame_Chunk fde_fc;
-	  int size;
 
 	  fc = & fde_fc;
 	  memset (fc, 0, sizeof (Frame_Chunk));
@@ -7312,7 +7311,7 @@
 	    }
 
 	  printf ("\n%08lx %08lx %08lx FDE cie=%08x pc=%08lx..%08lx\n",
-		  saved_start - section_start, length, cie_id, 
+		  (unsigned long)(saved_start - section_start), length, cie_id, 
 		  cie->chunk_start - section_start, fc->pc_begin,
 		  fc->pc_begin + fc->pc_range);
 	  if (! do_debug_frames_interp && augmentation_data_len)
@@ -7339,7 +7338,6 @@
 	  {
 	    unsigned op, opa;
 	    unsigned long reg;
-	    bfd_vma vma;
 	    
 	    op = * start ++;
 	    opa = op & 0x3f;
@@ -7460,7 +7458,7 @@
 	    case DW_CFA_offset:
 	      roffs = LEB ();
 	      if (! do_debug_frames_interp)
-	        printf ("  DW_CFA_offset: r%d at cfa%+d\n",
+	        printf ("  DW_CFA_offset: r%d at cfa%+ld\n",
 			opa, roffs * fc->data_factor);
 	      fc->col_type[opa] = DW_CFA_offset;
 	      fc->col_offset[opa] = roffs * fc->data_factor;
@@ -7479,7 +7477,7 @@
 	      if (do_debug_frames_interp)
 	        frame_display_row (fc, &need_col_headers, &max_regs);
 	      else
-	        printf ("  DW_CFA_set_loc: %08x\n", vma);
+	        printf ("  DW_CFA_set_loc: %08lx\n", (unsigned long)vma);
 	      fc->pc_begin = vma;
 	      break;
 
@@ -7488,7 +7486,7 @@
 	      if (do_debug_frames_interp)
 	        frame_display_row (fc, &need_col_headers, &max_regs);
 	      else
-	        printf ("  DW_CFA_advance_loc1: %d to %08lx\n",
+	        printf ("  DW_CFA_advance_loc1: %ld to %08lx\n",
 		        ofs * fc->code_factor,
 			fc->pc_begin + ofs * fc->code_factor);
 	      fc->pc_begin += ofs * fc->code_factor;
@@ -7499,7 +7497,7 @@
 	      if (do_debug_frames_interp)
 	        frame_display_row (fc, &need_col_headers, &max_regs);
 	      else
-	        printf ("  DW_CFA_advance_loc2: %d to %08lx\n",
+	        printf ("  DW_CFA_advance_loc2: %ld to %08lx\n",
 		        ofs * fc->code_factor,
 			fc->pc_begin + ofs * fc->code_factor);
 	      fc->pc_begin += ofs * fc->code_factor;
@@ -7510,7 +7508,7 @@
 	      if (do_debug_frames_interp)
 	        frame_display_row (fc, &need_col_headers, &max_regs);
 	      else
-	        printf ("  DW_CFA_advance_loc4: %d to %08lx\n",
+	        printf ("  DW_CFA_advance_loc4: %ld to %08lx\n",
 		        ofs * fc->code_factor,
 			fc->pc_begin + ofs * fc->code_factor);
 	      fc->pc_begin += ofs * fc->code_factor;
@@ -7520,7 +7518,7 @@
 	      reg = LEB ();
 	      roffs = LEB ();
 	      if (! do_debug_frames_interp)
-		printf ("  DW_CFA_offset_extended: r%d at cfa%+d\n",
+		printf ("  DW_CFA_offset_extended: r%ld at cfa%+ld\n",
 			reg, roffs * fc->data_factor);
 	      fc->col_type[reg] = DW_CFA_offset;
 	      fc->col_offset[reg] = roffs * fc->data_factor;
@@ -7529,7 +7527,7 @@
 	    case DW_CFA_restore_extended:
 	      reg = LEB ();
 	      if (! do_debug_frames_interp)
-	        printf ("  DW_CFA_restore_extended: r%d\n", reg);
+	        printf ("  DW_CFA_restore_extended: r%ld\n", reg);
 	      fc->col_type[reg] = cie->col_type[reg];
 	      fc->col_offset[reg] = cie->col_offset[reg];
 	      break;
@@ -7537,7 +7535,7 @@
 	    case DW_CFA_undefined:
 	      reg = LEB ();
 	      if (! do_debug_frames_interp)
-	        printf ("  DW_CFA_undefined: r%d\n", reg);
+	        printf ("  DW_CFA_undefined: r%ld\n", reg);
 	      fc->col_type[reg] = DW_CFA_undefined;
 	      fc->col_offset[reg] = 0;
 	      break;
@@ -7545,7 +7543,7 @@
 	    case DW_CFA_same_value:
 	      reg = LEB ();
 	      if (! do_debug_frames_interp)
-	        printf ("  DW_CFA_same_value: r%d\n", reg);
+	        printf ("  DW_CFA_same_value: r%ld\n", reg);
 	      fc->col_type[reg] = DW_CFA_same_value;
 	      fc->col_offset[reg] = 0;
 	      break;
@@ -7554,7 +7552,7 @@
 	      reg = LEB ();
 	      roffs = LEB ();
 	      if (! do_debug_frames_interp)
-	        printf ("  DW_CFA_register: r%d\n", reg);
+	        printf ("  DW_CFA_register: r%ld\n", reg);
 	      fc->col_type[reg] = DW_CFA_register;
 	      fc->col_offset[reg] = roffs;
 	      break;
@@ -7621,7 +7619,7 @@
 	    case DW_CFA_GNU_args_size:
 	      ul = LEB ();
 	      if (! do_debug_frames_interp)
-	        printf ("  DW_CFA_GNU_args_size: %d\n", ul);
+	        printf ("  DW_CFA_GNU_args_size: %ld\n", ul);
 	      break;
 
 	    case DW_CFA_GNU_negative_offset_extended:
@@ -7629,7 +7627,7 @@
 	      l = - LEB ();
 	      frame_need_space (fc, reg);
 	      if (! do_debug_frames_interp)
-	        printf ("  DW_CFA_GNU_negative_offset_extended: r%d at cfa%+d\n",
+	        printf ("  DW_CFA_GNU_negative_offset_extended: r%ld at cfa%+ld\n",
 			reg, l * fc->data_factor);
 	      fc->col_type[reg] = DW_CFA_offset;
 	      fc->col_offset[reg] = l * fc->data_factor;

-- 
 Andreas Jaeger
  SuSE Labs aj@suse.de
   private aj@arthur.inka.de
    http://www.suse.de/~aj


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