This is the mail archive of the 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]

[buildrobot][PATCH]: gas/config/tc-score.c:4492: error: missing braces around initializer


I think this is another fallout of the cppcheck silencing:

gcc -DHAVE_CONFIG_H -I. -I/home/jbglaw/repos/binutils/gas  -I. -I/home/jbglaw/repos/binutils/gas -I../bfd -I/home/jbglaw/repos/binutils/gas/config -I/home/jbglaw/repos/binutils/gas/../include -I/home/jbglaw/repos/binutils/gas/.. -I/home/jbglaw/repos/binutils/gas/../bfd -DLOCALEDIR="\"/home/jbglaw/build/score-elf/_install_/share/locale\""  -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Werror -g -O2 -MT tc-score.o -MD -MP -MF .deps/tc-score.Tpo -c -o tc-score.o `test -f 'config/tc-score.c' || echo '/home/jbglaw/repos/binutils/gas/'`config/tc-score.c
cc1: warnings being treated as errors
/home/jbglaw/repos/binutils/gas/config/tc-score.c: In function âs3_do_macro_bcmpâ:
/home/jbglaw/repos/binutils/gas/config/tc-score.c:4492: error: missing braces around initializer
/home/jbglaw/repos/binutils/gas/config/tc-score.c:4492: error: (near initialization for âinst_main.nameâ)
/home/jbglaw/repos/binutils/gas/config/tc-score.c:4492: error: missing initializer
/home/jbglaw/repos/binutils/gas/config/tc-score.c:4492: error: (near initialization for âinst_main.instructionâ)
make[3]: *** [tc-score.o] Error 1

This is from gcc76 (cfarm machine), you can find the full build log

While the "missing initializer" warning is actually wrong, it's right
that there are braces missing around the char[] initializer:

 383 struct s3_score_it
 384 {
 385   char name[s3_INSN_NAME_LEN];
 386   bfd_vma instruction;
 387   bfd_vma relax_inst;
 388   int size;
 389   int relax_size;
 390   enum score_insn_type type;
 391   char str[s3_MAX_LITERAL_POOL_SIZE];
 392   const char *error;
 393   int bwarn;
 394   char reg[s3_INSN_NAME_LEN];
 395   struct
 396   {
 397     bfd_reloc_code_real_type type;
 398     expressionS exp;
 399     int pc_rel;
 400   }reloc;
 401 };
4492   struct s3_score_it inst_main = { 0 };

A similar error (though due to a bogus warning) is generated for tic6x

gcc -DHAVE_CONFIG_H -I. -I/home/jbglaw/repos/binutils/gas  -I. -I/home/jbglaw/repos/binutils/gas -I../bfd -I/home/jbglaw/repos/binutils/gas/config -I/home/jbglaw/repos/binutils/gas/../include -I/home/jbglaw/repos/binutils/gas/.. -I/home/jbglaw/repos/binutils/gas/../bfd -DLOCALEDIR="\"/home/jbglaw/build/tic6x-uclinux/_install_/share/locale\""  -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Werror -g -O2 -MT tc-tic6x.o -MD -MP -MF .deps/tc-tic6x.Tpo -c -o tc-tic6x.o `test -f 'config/tc-tic6x.c' || echo '/home/jbglaw/repos/binutils/gas/'`config/tc-tic6x.c
cc1: warnings being treated as errors
/home/jbglaw/repos/binutils/gas/config/tc-tic6x.c: In function âtic6x_parse_operandâ:
/home/jbglaw/repos/binutils/gas/config/tc-tic6x.c:1599: error: missing initializer
/home/jbglaw/repos/binutils/gas/config/tc-tic6x.c:1599: error: (near initialization for âsecond_reg.numâ)
make[3]: *** [tc-tic6x.o] Error 1

1109 /* A register or register pair read by the assembler.  */
1110 typedef struct
1111 {
1112   /* The side the register is on (1 or 2).  */
1113   unsigned int side;
1114   /* The register number (0 to 31).  */
1115   unsigned int num;
1116 } tic6x_register;
1599       tic6x_register first_reg, second_reg = { 0 };

Thus is suggest:

2013-10-14  Jan-Benedict Glaw  <>

	* config/tc-score.c (s3_do_macro_bcmp): Don't initialize variable.
	* config/tc-tic6x.c (tic6x_parse_operand): Ditto.
diff --git a/gas/config/tc-score.c b/gas/config/tc-score.c
index 2bb3fbe..822b9cf 100644
--- a/gas/config/tc-score.c
+++ b/gas/config/tc-score.c
@@ -4489,7 +4489,7 @@ s3_do_macro_bcmp (char *str)
   char* ptemp;
   int i = 0;
   struct s3_score_it inst_expand[2];
-  struct s3_score_it inst_main = { 0 };
+  struct s3_score_it inst_main;
   memset (inst_expand, 0, sizeof inst_expand);
   s3_skip_whitespace (str);
diff --git a/gas/config/tc-tic6x.c b/gas/config/tc-tic6x.c
index fda9cd3..81f33f4 100644
--- a/gas/config/tc-tic6x.c
+++ b/gas/config/tc-tic6x.c
@@ -1596,7 +1596,7 @@ tic6x_parse_operand (char **p, tic6x_operand *op, unsigned int op_forms,
   /* See if this looks like a register or register pair.  */
   if (!operand_parsed && (op_forms & (TIC6X_OP_REG | TIC6X_OP_REGPAIR)))
-      tic6x_register first_reg, second_reg = { 0 };
+      tic6x_register first_reg, second_reg;
       bfd_boolean reg_ok;
       char *rq = q;


      Jan-Benedict Glaw              +49-172-7608481
 Signature of:                    Arroganz verkÃrzt fruchtlose GesprÃche.
 the second  :                                   -- Jan-Benedict Glaw

Attachment: signature.asc
Description: Digital signature

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