powerpc: sstep: Mark variable `rc` as unused in function 'analyse_instr'
PATCH 1/1 powerpc: sstep: Mark variable `rc` as unused in function 'analyse_instr'
Add gcc attribute unused for rc variable.
Fix warnings treated as errors with W=1:
arch/powerpc/lib/sstep.c:1172:31: error: variable 'rc' set but not used [-Werror=unused-but-set-variable]
--- arch/powerpc/lib/sstep.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/lib/sstep.c +1 -1
@@ -1169,7 +1169,7 @@ static nokprobe_inline int trap_compare(long v1, long v2)int analyse_instr (struct instruction_op *op,const struct pt_regs *regs,unsigned int instr) { -unsigned int opcode, ra, rb, rc, rd, spr, u; +unsigned int opcode, ra, rb, rc__maybe_unused , rd, spr, u;unsigned long int imm;unsigned long int val, val2;unsigned int mb, me, sh;
Signature · 1 line
2.20.1
Le 12/03/2019 à 21:20, Mathieu Malaterre a écrit :
Quoted 16 lines
Add gcc attribute unused for
rcvariable.Fix warnings treated as errors with W=1:
arch/powerpc/lib/sstep.c:1172:31: error: variable 'rc' set but not used [-Werror=unused-but-set-variable]Signed-off-by Mathieu Malaterre <[email protected]>--- arch/powerpc/lib/sstep.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/powerpc/lib/sstep.c +0
-0
arch/powerpc/lib/sstep.c static nokprobe_inline int trap_compare(long v1, long v2) · line 1172
Quoted 5 lines
arch/powerpc/lib/sstep.c +1
-1@@ -1169,7 +1169,7 @@ static nokprobe_inline int trap_compare(long v1, long v2)int analyse_instr (struct instruction_op *op,const struct pt_regs *regs,unsigned int instr) { -unsigned int opcode, ra, rb, rc, rd, spr, u; +unsigned int opcode, ra, rb, rc__maybe_unused , rd, spr, u;
I think it would be better to enclose 'rc' inside a #ifdef CONFIG_PPC64
Christophe
Quoted 4 lines
arch/powerpc/lib/sstep.c +0
-0unsigned long int imm;unsigned long int val, val2;unsigned int mb, me, sh;
Quoted 15 lines · Christophe Leroy
Quoted 11 lines · Mathieu Malaterre
Add gcc attribute unused for
rcvariable.Fix warnings treated as errors with W=1:
arch/powerpc/lib/sstep.c:1172:31: error: variable 'rc' set but not used [-Werror=unused-but-set-variable]Signed-off-by Mathieu Malaterre <[email protected]>--- arch/powerpc/lib/sstep.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 12 lines
arch/powerpc/lib/sstep.c static nokprobe_inline int trap_compare(long v1, long v2) · line 1172
Quoted 10 lines
arch/powerpc/lib/sstep.c +1
-1@@ -1169,7 +1169,7 @@ static nokprobe_inline int trap_compare(long v1, long v2)int analyse_instr (struct instruction_op *op,const struct pt_regs *regs,unsigned int instr) { -unsigned int opcode, ra, rb, rc, rd, spr, u; +unsigned int opcode, ra, rb, rc__maybe_unused , rd, spr, u;I think it would be better to enclose 'rc' inside a #ifdef
CONFIG_PPC64
Hum odd, I would have bet you would have suggested me to use IS_ENABLED with some crazy scheme (I was not able to mix it with the switch case nicely).
Anyway I'll try your suggestion and post a v2.
Quoted 6 lines
Christophe
Quoted 4 lines
arch/powerpc/lib/sstep.c +0
-0unsigned long int imm;unsigned long int val, val2;unsigned int mb, me, sh;
Le 12/03/2019 à 22:12, Mathieu Malaterre a écrit :
Quoted 30 lines
Quoted 15 lines · Christophe Leroy
Quoted 11 lines · Mathieu Malaterre
Add gcc attribute unused for
rcvariable.Fix warnings treated as errors with W=1:
arch/powerpc/lib/sstep.c:1172:31: error: variable 'rc' set but not used [-Werror=unused-but-set-variable]Signed-off-by Mathieu Malaterre <[email protected]>--- arch/powerpc/lib/sstep.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Quoted 12 lines
arch/powerpc/lib/sstep.c static nokprobe_inline int trap_compare(long v1, long v2) · line 1172
Quoted 10 lines
arch/powerpc/lib/sstep.c +1
-1@@ -1169,7 +1169,7 @@ static nokprobe_inline int trap_compare(long v1, long v2)int analyse_instr (struct instruction_op *op,const struct pt_regs *regs,unsigned int instr) { -unsigned int opcode, ra, rb, rc, rd, spr, u; +unsigned int opcode, ra, rb, rc__maybe_unused , rd, spr, u;I think it would be better to enclose 'rc' inside a #ifdef
CONFIG_PPC64
Quoted 3 lines
Hum odd, I would have bet you would have suggested me to use
IS_ENABLEDwith some crazy scheme (I was not able to mix it with the switch case nicely).
Well I guess yes, you could also get rid of the #ifdef __powerpc64__ and instead add the following just after the 'case 4:'
if (!IS_ENABLED(CONFIG_64))
break;
That's less uggly than adding two #ifdef/#endif
Christophe
Quoted 9 lines
Anyway I'll try your suggestion and post a v2.
Quoted 6 lines
Christophe
Quoted 4 lines
arch/powerpc/lib/sstep.c +0
-0unsigned long int imm;unsigned long int val, val2;unsigned int mb, me, sh;
Quoted 38 lines · Christophe Leroy
Quoted 30 lines · Mathieu Malaterre
Quoted 15 lines · Christophe Leroy
Quoted 11 lines · Mathieu Malaterre
Add gcc attribute unused for
rcvariable.Fix warnings treated as errors with W=1:
arch/powerpc/lib/sstep.c:1172:31: error: variable 'rc' set but not used [-Werror=unused-but-set-variable]Signed-off-by Mathieu Malaterre <[email protected]>--- arch/powerpc/lib/sstep.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Quoted 12 lines
arch/powerpc/lib/sstep.c static nokprobe_inline int trap_compare(long v1, long v2) · line 1172
Quoted 10 lines
arch/powerpc/lib/sstep.c +1
-1@@ -1169,7 +1169,7 @@ static nokprobe_inline int trap_compare(long v1, long v2)int analyse_instr (struct instruction_op *op,const struct pt_regs *regs,unsigned int instr) { -unsigned int opcode, ra, rb, rc, rd, spr, u; +unsigned int opcode, ra, rb, rc__maybe_unused , rd, spr, u;I think it would be better to enclose 'rc' inside a #ifdef
CONFIG_PPC64Quoted 3 lines
Hum odd, I would have bet you would have suggested me to use
IS_ENABLEDwith some crazy scheme (I was not able to mix it with the switch case nicely).
Quoted 7 lines
Well I guess yes, you could also get rid of the #ifdef
__powerpc64__and instead add the following just after the 'case 4:'if (!IS_ENABLED(CONFIG_64))
break;That's less uggly than adding two #ifdef/#endif
So you mean changing:
#ifdef __powerpc64__
case 4:
if (!cpu_has_feature(CPU_FTR_ARCH_300))
return -1;into:
case 4:
if (!IS_ENABLED(CONFIG_PPC64))
break;
if (!cpu_has_feature(CPU_FTR_ARCH_300))
return -1;So suddenly case label '4' becomes visible for ppc32, is that really what you wanted ?
Quoted 11 lines
Christophe
Quoted 9 lines
Anyway I'll try your suggestion and post a v2.
Quoted 6 lines
Christophe
Quoted 4 lines
arch/powerpc/lib/sstep.c +0
-0unsigned long int imm;unsigned long int val, val2;unsigned int mb, me, sh;
PATCH v2 1/1 powerpc/32: sstep: Move variable `rc` within CONFIG_PPC64 sentinels
In reply to Mathieu MalaterreFix warnings treated as errors with W=1:
arch/powerpc/lib/sstep.c:1172:31: error: variable 'rc' set but not used [-Werror=unused-but-set-variable]
---
v2: as suggested prefer CONFIG_PPC64 sentinel instead of unused keyword
arch/powerpc/lib/sstep.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
arch/powerpc/lib/sstep.c +6 -1
@@ -1169,7 +1169,10 @@ static nokprobe_inline int trap_compare(long v1, long v2)int analyse_instr (struct instruction_op *op,const struct pt_regs *regs,unsigned int instr) { -unsigned int opcode, ra, rb, rc, rd, spr, u; +unsigned int opcode, ra, rb, rd, spr, u; +#ifdef CONFIG_PPC64 +unsigned int rc; +#endif unsigned long int imm;unsigned long int val, val2;unsigned int mb, me, sh;
@@ -1292,7 +1295,9 @@ int analyse_instr(struct instruction_op *op, const struct pt_regs *regs, rd = (instr >>21 ) &0x1f ; ra = (instr >>16 ) &0x1f ; rb = (instr >>11 ) &0x1f ; +#ifdef CONFIG_PPC64 rc = (instr >>6 ) &0x1f ; +#endif switch (opcode) {#ifdef __powerpc64__
Signature · 1 line
2.20.1
Re: [PATCH v2] powerpc/32: sstep: Move variable `rc` within CONFIG_PPC64 sentinels
ping ?
Quoted 42 lines · Mathieu Malaterre
Fix warnings treated as errors with W=1:
arch/powerpc/lib/sstep.c:1172:31: error: variable 'rc' set but not used [-Werror=unused-but-set-variable]Suggested-by Christophe Leroy <[email protected]>Signed-off-by Mathieu Malaterre <[email protected]>---
v2: as suggested preferCONFIG_PPC64sentinel instead of unused keywordarch/powerpc/lib/sstep.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)arch/powerpc/lib/sstep.c +6
-2@@ -1169,7 +1169,10 @@ static nokprobe_inline int trap_compare(long v1, long v2)int analyse_instr (struct instruction_op *op,const struct pt_regs *regs,unsigned int instr) { -unsigned int opcode, ra, rb, rc, rd, spr, u; +unsigned int opcode, ra, rb, rd, spr, u; +#ifdef CONFIG_PPC64 +unsigned int rc; +#endif unsigned long int imm;unsigned long int val, val2;unsigned int mb, me, sh;@@ -1292,7 +1295,9 @@ int analyse_instr(struct instruction_op *op, const struct pt_regs *regs, rd = (instr >>21 ) &0x1f ; ra = (instr >>16 ) &0x1f ; rb = (instr >>11 ) &0x1f ; +#ifdef CONFIG_PPC64 rc = (instr >>6 ) &0x1f ; +#endif switch (opcode) {#ifdef __powerpc64__ --2.20.1
Michael Ellerman
reviewerRe: [PATCH v2] powerpc/32: sstep: Move variable `rc` within CONFIG_PPC64 sentinels
In reply to Mathieu MalaterreQuoted 8 lines · Mathieu Malaterre
Fix warnings treated as errors with W=1:
arch/powerpc/lib/sstep.c:1172:31: error: variable 'rc' set but not used [-Werror=unused-but-set-variable]Suggested-by Christophe Leroy <[email protected]>Signed-off-by Mathieu Malaterre <[email protected]>---
v2: as suggested preferCONFIG_PPC64sentinel instead of unused keyword
I'd rather avoid adding more ifdefs if we can.
I think this works?
cheers
arch/powerpc/lib/sstep.c +7 -3
@@ -1169,7 +1169,7 @@ static nokprobe_inline int trap_compare(long v1, long v2)int analyse_instr (struct instruction_op *op,const struct pt_regs *regs,unsigned int instr) { -unsigned int opcode, ra, rb, rc, rd, spr, u; +unsigned int opcode, ra, rb, rd, spr, u;unsigned long int imm;unsigned long int val, val2;unsigned int mb, me, sh;
@@ -1292,7 +1292,6 @@ int analyse_instr(struct instruction_op *op, const struct pt_regs *regs, rd = (instr >>21 ) &0x1f ; ra = (instr >>16 ) &0x1f ; rb = (instr >>11 ) &0x1f ; - rc = (instr >>6 ) &0x1f ;switch (opcode) {#ifdef __powerpc64__
@@ -1307,10 +1306,14 @@ int analyse_instr(struct instruction_op *op, const struct pt_regs *regs,return 1 ;#ifdef __powerpc64__ -case 4 : +case 4 : { +unsigned int rc; +if (!cpu_has_feature (CPU_FTR_ARCH_300 ))return -1 ; + rc = (instr >>6 ) &0x1f ; +switch (instr &0x3f ) { case 48: /* maddhd */ asm volatile(PPC_MADDHD(%0, %1, %2, %3) :
@@ -1336,6 +1339,7 @@ int analyse_instr(struct instruction_op *op, const struct pt_regs *regs,* primary opcode which do not have emulation support yet. */ return -1; + }#endif case 7 :/* mulli */
Mathieu Malaterre
Reviewed-byRe: [PATCH v2] powerpc/32: sstep: Move variable `rc` within CONFIG_PPC64 sentinels
Quoted 7 lines · Michael Ellerman
Quoted 4 lines · Mathieu Malaterre
Fix warnings treated as errors with W=1:
arch/powerpc/lib/sstep.c:1172:31: error: variable 'rc' set but not used [-Werror=unused-but-set-variable]
Quoted 8 lines
Quoted 4 lines
Suggested-by Christophe Leroy <[email protected]>Signed-off-by Mathieu Malaterre <[email protected]>---
v2: as suggested preferCONFIG_PPC64sentinel instead of unused keywordI'd rather avoid adding more ifdefs if we can.
I think this works?
It does ! ;)
Quoted 47 lines
cheers
arch/powerpc/lib/sstep.c +7
-3@@ -1169,7 +1169,7 @@ static nokprobe_inline int trap_compare(long v1, long v2)int analyse_instr (struct instruction_op *op,const struct pt_regs *regs,unsigned int instr) { -unsigned int opcode, ra, rb, rc, rd, spr, u; +unsigned int opcode, ra, rb, rd, spr, u;unsigned long int imm;unsigned long int val, val2;unsigned int mb, me, sh;@@ -1292,7 +1292,6 @@ int analyse_instr(struct instruction_op *op, const struct pt_regs *regs, rd = (instr >>21 ) &0x1f ; ra = (instr >>16 ) &0x1f ; rb = (instr >>11 ) &0x1f ; - rc = (instr >>6 ) &0x1f ;switch (opcode) {#ifdef __powerpc64__@@ -1307,10 +1306,14 @@ int analyse_instr(struct instruction_op *op, const struct pt_regs *regs,return 1 ;#ifdef __powerpc64__ -case 4 : +case 4 : { +unsigned int rc; +if (!cpu_has_feature (CPU_FTR_ARCH_300 ))return -1 ; + rc = (instr >>6 ) &0x1f ; +switch (instr &0x3f ) {case 48 :/* maddhd */ asm volatile(PPC_MADDHD(%0, %1, %2, %3) :@@ -1336,6 +1339,7 @@ int analyse_instr(struct instruction_op *op, const struct pt_regs *regs,* primary opcode which do not have emulation support yet. */ return -1; + }#endif case 7 :/* mulli */