mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Progyan Bhattacharya <bprogyan@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: Josh Poimboeuf <jpoimboe@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@kernel.org>,
	Nick Desaulniers <nick.desaulniers@gmail.com>,
	Lukas Bulwahn <lukas.bulwahn@gmail.com>,
	Nicholas Mc Guire <der.herr@hofr.at>
Subject: [PATCH] objtool/x86: Replace Non-standard Range Expression in Case
Date: Fri, 16 Feb 2018 20:09:24 +0530	[thread overview]
Message-ID: <20180216143924.9918-1-progyanb@acm.org> (raw)
In-Reply-To: <20180216142513.9520-1-progyanb@acm.org>

Replace range expressions with seperate individual cases, i.e. convert case 1...3: to case 1: case 2: case 3
Range expression within case statements are non-standard C code and can create issues over compiler and platform variety.

While compiling with gcc 4.8 (RHEL) I encountered this error on range expression in case statements:
error: range expressions in switch statements are non-standard [-Werror=pedantic]

Signed-off-by: Progyan Bhattacharya <progyanb@acm.org>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Nick Desaulniers <nick.desaulniers@gmail.com>
Cc: Lukas Bulwahn <lukas.bulwahn@gmail.com>
Cc: Nicholas Mc Guire <der.herr@hofr.at>
Cc: linux-kernel@vger.kernel.org
---
 tools/objtool/arch/x86/decode.c | 35 ++++++++++++++++++++++++++++++++---
 1 file changed, 32 insertions(+), 3 deletions(-)

diff --git a/tools/objtool/arch/x86/decode.c b/tools/objtool/arch/x86/decode.c
index 540a209b78ab..e6803dd79958 100644
--- a/tools/objtool/arch/x86/decode.c
+++ b/tools/objtool/arch/x86/decode.c
@@ -143,7 +143,14 @@ int arch_decode_instruction(struct elf *elf, struct section *sec,
 		}
 		break;
 
-	case 0x50 ... 0x57:
+	case 0x50:
+	case 0x51:
+	case 0x52:
+	case 0x53:
+	case 0x54:
+	case 0x55:
+	case 0x56:
+	case 0x57:
 
 		/* push reg */
 		*type = INSN_STACK;
@@ -153,7 +160,14 @@ int arch_decode_instruction(struct elf *elf, struct section *sec,
 
 		break;
 
-	case 0x58 ... 0x5f:
+	case 0x58:
+	case 0x59:
+	case 0x5a:
+	case 0x5b:
+	case 0x5c:
+	case 0x5d:
+	case 0x5e:
+	case 0x5f:
 
 		/* pop reg */
 		*type = INSN_STACK;
@@ -171,7 +185,22 @@ int arch_decode_instruction(struct elf *elf, struct section *sec,
 		op->dest.type = OP_DEST_PUSH;
 		break;
 
-	case 0x70 ... 0x7f:
+	case 0x70:
+	case 0x71:
+	case 0x72:
+	case 0x73:
+	case 0x74:
+	case 0x75:
+	case 0x76:
+	case 0x77:
+	case 0x78:
+	case 0x79:
+	case 0x7a:
+	case 0x7b:
+	case 0x7c:
+	case 0x7d:
+	case 0x7e:
+	case 0x7f:
 		*type = INSN_JUMP_CONDITIONAL;
 		break;
 
-- 
Regards,
Progyan Bhattacharya
http://codeprogyan.me
2.16.1

  parent reply	other threads:[~2018-02-16 14:39 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-16 14:19 Progyan Bhattacharya
2018-02-16 14:25 ` Progyan Bhattacharya
2018-02-16 14:35   ` Josh Poimboeuf
2018-02-16 16:47     ` Peter Zijlstra
2018-02-18  3:36       ` Progyan Bhattacharya
2018-02-16 14:39   ` Progyan Bhattacharya [this message]
2018-02-16 15:03     ` Josh Poimboeuf

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=20180216143924.9918-1-progyanb@acm.org \
    --to=bprogyan@gmail.com \
    --cc=der.herr@hofr.at \
    --cc=jpoimboe@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lukas.bulwahn@gmail.com \
    --cc=mingo@kernel.org \
    --cc=nick.desaulniers@gmail.com \
    --cc=peterz@infradead.org \
    /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

all inboxes | Powered by JetHome®