Message ID | 20190312202008.29681-1-malat@debian.org (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | powerpc: sstep: Mark variable `rc` as unused in function 'analyse_instr' | expand |
Context | Check | Description |
---|---|---|
snowpatch_ozlabs/apply_patch | success | Successfully applied on branch next (9580b71b5a7863c24a9bd18bcd2ad759b86b1eff) |
snowpatch_ozlabs/build-ppc64le | success | build succeeded & removed 0 sparse warning(s) |
snowpatch_ozlabs/build-ppc64be | success | build succeeded & removed 0 sparse warning(s) |
snowpatch_ozlabs/build-ppc64e | success | build succeeded & removed 0 sparse warning(s) |
snowpatch_ozlabs/build-pmac32 | success | build succeeded & removed 0 sparse warning(s) |
snowpatch_ozlabs/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 8 lines checked |
Le 12/03/2019 à 21:20, Mathieu Malaterre a écrit : > 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] > > Signed-off-by: Mathieu Malaterre <malat@debian.org> > --- > arch/powerpc/lib/sstep.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/powerpc/lib/sstep.c b/arch/powerpc/lib/sstep.c > index 3d33fb509ef4..32d092f62ae0 100644 > --- a/arch/powerpc/lib/sstep.c > +++ b/arch/powerpc/lib/sstep.c > @@ -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 > unsigned long int imm; > unsigned long int val, val2; > unsigned int mb, me, sh; >
On Tue, Mar 12, 2019 at 9:56 PM Christophe Leroy <christophe.leroy@c-s.fr> wrote: > > > > Le 12/03/2019 à 21:20, Mathieu Malaterre a écrit : > > 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] > > > > Signed-off-by: Mathieu Malaterre <malat@debian.org> > > --- > > arch/powerpc/lib/sstep.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/arch/powerpc/lib/sstep.c b/arch/powerpc/lib/sstep.c > > index 3d33fb509ef4..32d092f62ae0 100644 > > --- a/arch/powerpc/lib/sstep.c > > +++ b/arch/powerpc/lib/sstep.c > > @@ -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. > Christophe > > > unsigned long int imm; > > unsigned long int val, val2; > > unsigned int mb, me, sh; > >
Le 12/03/2019 à 22:12, Mathieu Malaterre a écrit : > On Tue, Mar 12, 2019 at 9:56 PM Christophe Leroy > <christophe.leroy@c-s.fr> wrote: >> >> >> >> Le 12/03/2019 à 21:20, Mathieu Malaterre a écrit : >>> 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] >>> >>> Signed-off-by: Mathieu Malaterre <malat@debian.org> >>> --- >>> arch/powerpc/lib/sstep.c | 2 +- >>> 1 file changed, 1 insertion(+), 1 deletion(-) >>> >>> diff --git a/arch/powerpc/lib/sstep.c b/arch/powerpc/lib/sstep.c >>> index 3d33fb509ef4..32d092f62ae0 100644 >>> --- a/arch/powerpc/lib/sstep.c >>> +++ b/arch/powerpc/lib/sstep.c >>> @@ -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). 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 > > Anyway I'll try your suggestion and post a v2. > >> Christophe >> >>> unsigned long int imm; >>> unsigned long int val, val2; >>> unsigned int mb, me, sh; >>>
On Tue, Mar 12, 2019 at 10:26 PM Christophe Leroy <christophe.leroy@c-s.fr> wrote: > > > > Le 12/03/2019 à 22:12, Mathieu Malaterre a écrit : > > On Tue, Mar 12, 2019 at 9:56 PM Christophe Leroy > > <christophe.leroy@c-s.fr> wrote: > >> > >> > >> > >> Le 12/03/2019 à 21:20, Mathieu Malaterre a écrit : > >>> 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] > >>> > >>> Signed-off-by: Mathieu Malaterre <malat@debian.org> > >>> --- > >>> arch/powerpc/lib/sstep.c | 2 +- > >>> 1 file changed, 1 insertion(+), 1 deletion(-) > >>> > >>> diff --git a/arch/powerpc/lib/sstep.c b/arch/powerpc/lib/sstep.c > >>> index 3d33fb509ef4..32d092f62ae0 100644 > >>> --- a/arch/powerpc/lib/sstep.c > >>> +++ b/arch/powerpc/lib/sstep.c > >>> @@ -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). > > 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 ? > Christophe > > > > > Anyway I'll try your suggestion and post a v2. > > > >> Christophe > >> > >>> unsigned long int imm; > >>> unsigned long int val, val2; > >>> unsigned int mb, me, sh; > >>>
diff --git a/arch/powerpc/lib/sstep.c b/arch/powerpc/lib/sstep.c index 3d33fb509ef4..32d092f62ae0 100644 --- a/arch/powerpc/lib/sstep.c +++ b/arch/powerpc/lib/sstep.c @@ -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;
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] Signed-off-by: Mathieu Malaterre <malat@debian.org> --- arch/powerpc/lib/sstep.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)