public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Andrew Burgess <andrew.burgess@embecosm.com>
To: Cooper Qu <cooper.qu@linux.alibaba.com>
Cc: binutils@sourceware.org, lifang_xia@c-sky.com,
	Simon Marchi <simark@simark.ca>
Subject: [PUSHED] Re: [PATCH] CSKY: Add objdump option -M abi-names.
Date: Thu, 24 Sep 2020 15:14:33 +0100	[thread overview]
Message-ID: <20200924141433.GA1540867@embecosm.com> (raw)
In-Reply-To: <20200917063028.74459-1-cooper.qu@linux.alibaba.com>

I pushed the patch below under the "obvious" rule.

I inspected the code and concluded that either the strcat should be
included in the if body or the buf would be undefined, in which case
the original patch has other issues.

Thanks,
Andrew

---

commit 7b6addc226a004622a12c87d3292176dbc8da041
Author: Andrew Burgess <andrew.burgess@embecosm.com>
Date:   Thu Sep 24 15:03:43 2020 +0100

    csky/opcodes: enclose if body in curly braces
    
    This commit:
    
      commit afdcafe89118cee761f9bf67ea1b1efc29311300
      Date:   Thu Sep 17 14:30:28 2020 +0800
    
          CSKY: Add objdump option -M abi-names.
    
    cases the build of GDB (configured with --enabled-targets=all) to fail
    with this error:
    
      libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I../../src/opcodes -I. -I../../src/opcodes -I../bfd -I../../src/opcodes/../include -I../../src/opcodes/../bfd -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wstack-usage=262144 -Werror -O0 -g3 -D_GLIBCXX_DEBUG=1 -MT csky-dis.lo -MD -MP -MF .deps/csky-dis.Tpo -c ../../src/opcodes/csky-dis.c -o csky-dis.o
      ../../src/opcodes/csky-dis.c: In function ‘csky_output_operand’:
      ../../src/opcodes/csky-dis.c:849:7: error: this ‘if’ clause does not guard... [-Werror=misleading-indentation]
        849 |       if (IS_CSKY_V1 (mach_flag))
            |       ^~
      ../../src/opcodes/csky-dis.c:851:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
        851 |  strcat (str, buf);
            |  ^~~~~~
    
    this commit adds { ... } around the if body to resolve this issue.
    
    opcodes/ChangeLog:
    
            * csky-dis.c (csky_output_operand): Enclose body of if in curly
            braces.

diff --git a/opcodes/csky-dis.c b/opcodes/csky-dis.c
index 67fb4ee87ed..ce20f58c473 100644
--- a/opcodes/csky-dis.c
+++ b/opcodes/csky-dis.c
@@ -847,8 +847,10 @@ csky_output_operand (char *str, struct operand const *oprnd,
       }
     case OPRND_TYPE_REGr4_r7:
       if (IS_CSKY_V1 (mach_flag))
-	sprintf (buf, "%s-%s", get_gr_name (4), get_gr_name (7));
-	strcat (str, buf);
+	{
+	  sprintf (buf, "%s-%s", get_gr_name (4), get_gr_name (7));
+	  strcat (str, buf);
+	}
       break;
     case OPRND_TYPE_CONST1:
       strcat (str, "1");

      parent reply	other threads:[~2020-09-24 14:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-17  6:30 Cooper Qu
2020-09-23 15:50 ` Lifang Xia
2020-09-25 13:18   ` Alan Modra
2020-09-25 16:45     ` Cooper Qu
2020-09-24 14:14 ` Andrew Burgess [this message]

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=20200924141433.GA1540867@embecosm.com \
    --to=andrew.burgess@embecosm.com \
    --cc=binutils@sourceware.org \
    --cc=cooper.qu@linux.alibaba.com \
    --cc=lifang_xia@c-sky.com \
    --cc=simark@simark.ca \
    /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).