* [PATCH] objtool/x86: Replace Non-standard Range Expression in Case
@ 2018-02-16 14:19 Progyan Bhattacharya
2018-02-16 14:25 ` Progyan Bhattacharya
0 siblings, 1 reply; 7+ messages in thread
From: Progyan Bhattacharya @ 2018-02-16 14:19 UTC (permalink / raw)
To: linux-kernel
Cc: Josh Poimboeuf, Peter Zijlstra, Ingo Molnar, Nick Desaulniers,
Lukas Bulwahn, Nicholas Mc Guire
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..b4433433863b 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;
--
2.16.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH] objtool/x86: Replace Non-standard Range Expression in Case
2018-02-16 14:19 [PATCH] objtool/x86: Replace Non-standard Range Expression in Case Progyan Bhattacharya
@ 2018-02-16 14:25 ` Progyan Bhattacharya
2018-02-16 14:35 ` Josh Poimboeuf
2018-02-16 14:39 ` Progyan Bhattacharya
0 siblings, 2 replies; 7+ messages in thread
From: Progyan Bhattacharya @ 2018-02-16 14:25 UTC (permalink / raw)
To: linux-kernel
Cc: Josh Poimboeuf, Peter Zijlstra, Ingo Molnar, Nick Desaulniers,
Lukas Bulwahn, Nicholas Mc Guire
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..4fb9b1307598 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;
--
2.16.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] objtool/x86: Replace Non-standard Range Expression in Case
2018-02-16 14:25 ` Progyan Bhattacharya
@ 2018-02-16 14:35 ` Josh Poimboeuf
2018-02-16 16:47 ` Peter Zijlstra
2018-02-16 14:39 ` Progyan Bhattacharya
1 sibling, 1 reply; 7+ messages in thread
From: Josh Poimboeuf @ 2018-02-16 14:35 UTC (permalink / raw)
To: Progyan Bhattacharya
Cc: linux-kernel, Peter Zijlstra, Ingo Molnar, Nick Desaulniers,
Lukas Bulwahn, Nicholas Mc Guire
On Fri, Feb 16, 2018 at 07:55:13PM +0530, Progyan Bhattacharya wrote:
> 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>
Hi Progyan,
Thank you for the patch.
I think this makes the code unnecessarily verbose and less readable. We
rely on many such GCC extensions, and we don't aim to comply with
standard C. And AFAIK, we don't use -Werror=pedantic in the kernel.
--
Josh
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] objtool/x86: Replace Non-standard Range Expression in Case
2018-02-16 14:35 ` Josh Poimboeuf
@ 2018-02-16 16:47 ` Peter Zijlstra
2018-02-18 3:36 ` Progyan Bhattacharya
0 siblings, 1 reply; 7+ messages in thread
From: Peter Zijlstra @ 2018-02-16 16:47 UTC (permalink / raw)
To: Josh Poimboeuf
Cc: Progyan Bhattacharya, linux-kernel, Ingo Molnar, Nick Desaulniers,
Lukas Bulwahn, Nicholas Mc Guire
On Fri, Feb 16, 2018 at 08:35:11AM -0600, Josh Poimboeuf wrote:
> On Fri, Feb 16, 2018 at 07:55:13PM +0530, Progyan Bhattacharya wrote:
> > 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>
>
> Hi Progyan,
>
> Thank you for the patch.
>
> I think this makes the code unnecessarily verbose and less readable. We
> rely on many such GCC extensions, and we don't aim to comply with
> standard C. And AFAIK, we don't use -Werror=pedantic in the kernel.
Agreed, it makes the code actively worse. Just don't use error=pedantic.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] objtool/x86: Replace Non-standard Range Expression in Case
2018-02-16 16:47 ` Peter Zijlstra
@ 2018-02-18 3:36 ` Progyan Bhattacharya
0 siblings, 0 replies; 7+ messages in thread
From: Progyan Bhattacharya @ 2018-02-18 3:36 UTC (permalink / raw)
To: Peter Zijlstra, Josh Poimboeuf
Cc: linux-kernel, Ingo Molnar, Nick Desaulniers, Lukas Bulwahn,
Nicholas Mc Guire
On Fri, 2018-02-16 at 17:47 +0100, Peter Zijlstra wrote:
> On Fri, Feb 16, 2018 at 08:35:11AM -0600, Josh Poimboeuf wrote:
> > On Fri, Feb 16, 2018 at 07:55:13PM +0530, Progyan Bhattacharya
> > wrote:
> > > 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>
> >
> > Hi Progyan,
> >
> > Thank you for the patch.
> >
> > I think this makes the code unnecessarily verbose and less
> > readable. We
> > rely on many such GCC extensions, and we don't aim to comply with
> > standard C. And AFAIK, we don't use -Werror=pedantic in the
> > kernel.
>
> Agreed, it makes the code actively worse. Just don't use
> error=pedantic.
But I cannot figure it out how Werror=pedantic flag is being set. :(
--
Regards,
Progyan Bhattacharya
(http://codeprogyan.me)
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH] objtool/x86: Replace Non-standard Range Expression in Case
2018-02-16 14:25 ` Progyan Bhattacharya
2018-02-16 14:35 ` Josh Poimboeuf
@ 2018-02-16 14:39 ` Progyan Bhattacharya
2018-02-16 15:03 ` Josh Poimboeuf
1 sibling, 1 reply; 7+ messages in thread
From: Progyan Bhattacharya @ 2018-02-16 14:39 UTC (permalink / raw)
To: linux-kernel
Cc: Josh Poimboeuf, Peter Zijlstra, Ingo Molnar, Nick Desaulniers,
Lukas Bulwahn, Nicholas Mc Guire
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
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] objtool/x86: Replace Non-standard Range Expression in Case
2018-02-16 14:39 ` Progyan Bhattacharya
@ 2018-02-16 15:03 ` Josh Poimboeuf
0 siblings, 0 replies; 7+ messages in thread
From: Josh Poimboeuf @ 2018-02-16 15:03 UTC (permalink / raw)
To: Progyan Bhattacharya
Cc: linux-kernel, Peter Zijlstra, Ingo Molnar, Nick Desaulniers,
Lukas Bulwahn, Nicholas Mc Guire
On Fri, Feb 16, 2018 at 08:09:24PM +0530, Progyan Bhattacharya wrote:
> 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>
Progyan,
Please try to be respectful of reviewers' time by
a) running scripts/checkpatch.pl and closely reviewing your patch
before sending;
b) not sending multiple revisions in a single day;
c) when sending a new revision, add the version number in the subject
line and clarify what has changed.
I'd also recommend reviewing the following resources:
- https://www.youtube.com/watch?v=-3HNeoFuSH0
- Documentation/process/submitting-patches.rst
--
Josh
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2018-02-18 3:37 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-16 14:19 [PATCH] objtool/x86: Replace Non-standard Range Expression in Case 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
2018-02-16 15:03 ` Josh Poimboeuf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox