This is the mail archive of the binutils@sourceware.org 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]
Other format: [Raw text]

RE: GDB multi-build failure in lm32-opc.c file


Here is my patch,
it allows me to complete a gdb build
with --enable-targets=all
on a ix86 ubuntu.



Pierre Muller
Pascal language support maintainer for GDB


ChangeLog entry

2009-02-16  Pierre Muller  <muller@ics.u-strasbg.fr>

	* lm32-opc.c (lm32_cgen_init_opcode_table): Avoid compiler warning
in memset call.
	* mt-opc.c (mt_cgen_init_opcode_table ): Ditto.
	* xc16x-opc.c (xc16x_cgen_init_opcode_table):Ditto.
	* tic54x-dis.c (print_instruction): Avoid compiler warning on sprint
call.

	

Index: opcodes/lm32-opc.c
===================================================================
RCS file: /cvs/src/src/opcodes/lm32-opc.c,v
retrieving revision 1.1
diff -u -p -r1.1 lm32-opc.c
--- opcodes/lm32-opc.c	23 Dec 2008 19:10:25 -0000	1.1
+++ opcodes/lm32-opc.c	16 Feb 2009 13:35:32 -0000
@@ -844,7 +844,10 @@ lm32_cgen_init_opcode_table (CGEN_CPU_DE
   const CGEN_OPCODE *oc = & lm32_cgen_macro_insn_opcode_table[0];
   CGEN_INSN *insns = xmalloc (num_macros * sizeof (CGEN_INSN));
 
-  memset (insns, 0, num_macros * sizeof (CGEN_INSN));
+  /* This test has been added to avoid a warning generated
+     if memset is called with a third argument of value zero.  */
+  if (num_macros >= 1)
+    memset (insns, 0, num_macros * sizeof (CGEN_INSN));
   for (i = 0; i < num_macros; ++i)
     {
       insns[i].base = &ib[i];
Index: opcodes/mt-opc.c
===================================================================
RCS file: /cvs/src/src/opcodes/mt-opc.c,v
retrieving revision 1.3
diff -u -p -r1.3 mt-opc.c
--- opcodes/mt-opc.c	5 Jul 2007 09:49:02 -0000	1.3
+++ opcodes/mt-opc.c	16 Feb 2009 13:35:32 -0000
@@ -915,7 +915,10 @@ mt_cgen_init_opcode_table (CGEN_CPU_DESC
   const CGEN_OPCODE *oc = & mt_cgen_macro_insn_opcode_table[0];
   CGEN_INSN *insns = xmalloc (num_macros * sizeof (CGEN_INSN));
 
-  memset (insns, 0, num_macros * sizeof (CGEN_INSN));
+  /* This test has been added to avoid a warning generated
+     if memset is called with a third argument of value zero.  */
+  if (num_macros >= 1)
+    memset (insns, 0, num_macros * sizeof (CGEN_INSN));
   for (i = 0; i < num_macros; ++i)
     {
       insns[i].base = &ib[i];
Index: opcodes/tic54x-dis.c
===================================================================
RCS file: /cvs/src/src/opcodes/tic54x-dis.c,v
retrieving revision 1.10
diff -u -p -r1.10 tic54x-dis.c
--- opcodes/tic54x-dis.c	5 Jul 2007 09:49:02 -0000	1.10
+++ opcodes/tic54x-dis.c	16 Feb 2009 13:35:33 -0000
@@ -380,7 +380,9 @@ print_instruction (info, memaddr, opcode
         case OP_CC3:
         {
           const char *code[] = { "eq", "lt", "gt", "neq" };
-          sprintf (operand[i], code[CC3 (opcode)]);
+	  /* Do not use sprintf with only two parameters as
+	     a compiler warning could be generated in such conditions.  */
+          sprintf (operand[i], "%s", code[CC3 (opcode)]);
           info->fprintf_func (info->stream, "%s%s", comma, operand[i]);
           break;
         }
Index: opcodes/xc16x-opc.c
===================================================================
RCS file: /cvs/src/src/opcodes/xc16x-opc.c,v
retrieving revision 1.2
diff -u -p -r1.2 xc16x-opc.c
--- opcodes/xc16x-opc.c	5 Jul 2007 09:49:02 -0000	1.2
+++ opcodes/xc16x-opc.c	16 Feb 2009 13:35:34 -0000
@@ -3041,7 +3041,10 @@ xc16x_cgen_init_opcode_table (CGEN_CPU_D
   const CGEN_OPCODE *oc = & xc16x_cgen_macro_insn_opcode_table[0];
   CGEN_INSN *insns = xmalloc (num_macros * sizeof (CGEN_INSN));
 
-  memset (insns, 0, num_macros * sizeof (CGEN_INSN));
+  /* This test has been added to avoid a warning generated
+     if memset is called with a third argument of value zero.  */
+  if (num_macros >= 1)
+    memset (insns, 0, num_macros * sizeof (CGEN_INSN));
   for (i = 0; i < num_macros; ++i)
     {
       insns[i].base = &ib[i];

> -----Message d'origine-----
> De?: Dave Korn [mailto:dave.korn.cygwin@googlemail.com]
> Envoyé?: Monday, February 16, 2009 11:24 AM
> À?: Pierre Muller
> Cc?: Dave Korn; binutils@sourceware.org
> Objet?: Re: GDB multi-build failure in lm32-opc.c file
> 
> Pierre Muller wrote:
> > Dave Korn a écrit :
> 
> >>   Does that still work at -O0?
> >
> >   You are right, this is not sure at all...
> > But I tried it out, and got no error recompiling
> > opcodes directory with
> > make clean all CFLAGS="-g -O0"
> 
>   Ah, the warning must depend on optimisation then.  Guess the fix is
> fine as
> it is.
> 
> >   I was wondering if we should add some
> > comment inside the source files themselves to explain
> > why this condition was added...
> 
>   That would be a good idea come to think of it, or someone might
> optimise it
> away somewhere down the line.
> 
> >   Would my GDB assignment be OK for a commit to opcodes?
> > This is really part of the code I need to compile GDB,
> > so it should be OK, no?
> 
>   I'm sure it is, and in any case, all this stuff is small enough not
> to worry
> about an assign anyway.  Add the comment to your patch and resubmit it
> with a
> ChangeLog entry and we'll get it accepted.
> 
>     cheers,
>       DaveK


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