public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Jan-Benedict Glaw <jbglaw@lug-owl.de>
To: Nick Clifton <nickc@redhat.com>
Cc: Binutils <binutils@sourceware.org>
Subject: [buildrobot][PATCH]: gas/config/tc-score.c:4492: error: missing braces around initializer
Date: Mon, 14 Oct 2013 19:20:00 -0000	[thread overview]
Message-ID: <20131014192017.GE27569@lug-owl.de> (raw)

[-- Attachment #1: Type: text/plain, Size: 5033 bytes --]

Hi!

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
here:
http://toolchain.lug-owl.de/buildbot/show_build_details.php?id=19332
http://toolchain.lug-owl.de/buildbot/deliver_artifact.php?mode=view&id=69223

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
(see
http://toolchain.lug-owl.de/buildbot/show_build_details.php?id=19186
and
http://toolchain.lug-owl.de/buildbot/deliver_artifact.php?mode=view&id=67284):

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  <jbglaw@lug-owl.de>

gas/
	* 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;
 


MfG, JBG

-- 
      Jan-Benedict Glaw      jbglaw@lug-owl.de              +49-172-7608481
 Signature of:                    Arroganz verkürzt fruchtlose Gespräche.
 the second  :                                   -- Jan-Benedict Glaw

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

             reply	other threads:[~2013-10-14 19:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-14 19:20 Jan-Benedict Glaw [this message]
2013-10-16 19:39 ` [ping] " Jan-Benedict Glaw

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20131014192017.GE27569@lug-owl.de \
    --to=jbglaw@lug-owl.de \
    --cc=binutils@sourceware.org \
    --cc=nickc@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).