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]

[RFA:] Compilation warning fixes for sh-dis.c


Fixing some more compilation warnings:

src/opcodes/sh-dis.c: In function `print_insn_ddt':
src/opcodes/sh-dis.c:114: warning: comparison between signed and unsigned
src/opcodes/sh-dis.c:124: warning: comparison between signed and unsigned
src/opcodes/sh-dis.c: In function `print_insn_ppi':
src/opcodes/sh-dis.c:244: warning: comparison between signed and unsigned
src/opcodes/sh-dis.c:245: warning: comparison between signed and unsigned
src/opcodes/sh-dis.c:245: warning: comparison between signed and unsigned
src/opcodes/sh-dis.c:186: warning: `dc' might be used uninitialized in this function
src/opcodes/sh-dis.c: In function `print_insn_shx':
src/opcodes/sh-dis.c:615: warning: label `d_reg_n' defined but not used

Right now it is somewhat obvious that dc is not used uninitialized.  But
that can change easily and few or none would notice it from new compiler
warnings.  With this patch, it would then at least crash consistently, if
you're not a friend of silencing compiler warnings for its own sake.

Ok to commit?

	* sh-dis.c (print_insn_ddt): Make insn_x, insn_y unsigned.
	(print_insn_ppi): Make nib1, nib2, nib3 unsigned.
	Initialize variable dc to NULL.
	(print_insn_shx): Remove unused label d_reg_n.

Index: sh-dis.c
===================================================================
RCS file: /cvs/src/src/opcodes/sh-dis.c,v
retrieving revision 1.5
diff -p -c -r1.5 sh-dis.c
*** sh-dis.c	2000/08/26 18:50:14	1.5
--- sh-dis.c	2000/11/26 19:34:48
*************** print_insn_ddt (insn, info)
*** 99,105 ****
      {
        static sh_opcode_info *first_movx, *first_movy;
        sh_opcode_info *opx, *opy;
!       int insn_x, insn_y;
  
        if (! first_movx)
  	{
--- 99,105 ----
      {
        static sh_opcode_info *first_movx, *first_movy;
        sh_opcode_info *opx, *opy;
!       unsigned int insn_x, insn_y;
  
        if (! first_movx)
  	{
*************** print_insn_ppi (field_b, info)
*** 182,189 ****
    static char *sy_tab[] = { "y0", "y1", "m0", "m1" };
    fprintf_ftype fprintf_fn = info->fprintf_func;
    void *stream = info->stream;
!   int nib1, nib2, nib3;
!   char *dc;
    sh_opcode_info *op;
  
    if ((field_b & 0xe800) == 0)
--- 182,189 ----
    static char *sy_tab[] = { "y0", "y1", "m0", "m1" };
    fprintf_ftype fprintf_fn = info->fprintf_func;
    void *stream = info->stream;
!   unsigned int nib1, nib2, nib3;
!   char *dc = NULL;
    sh_opcode_info *op;
  
    if ((field_b & 0xe800) == 0)
*************** print_insn_shx (memaddr, info)
*** 612,618 ****
  		  fprintf_fn (stream, "xd%d", rn & ~1);
  		  break;
  		}
- 	    d_reg_n:
  	    case D_REG_N:
  	      fprintf_fn (stream, "dr%d", rn);
  	      break;
--- 612,617 ----

brgds, H-P



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