Skip to contentSkip to conversation

powerpc: Fix build warning

PATCH In review Guenter Roeck 4 participants 9 messages Jun 13, 2014 – Jun 25, 2014 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 powerpc: Fix build warning

If compiled with W=1, the following warning is seen in powerpc builds.

arch/powerpc/kernel/smp.c:750:18: warning:
type qualifiers ignored on function return type
static const int powerpc_smt_flags(void)

                 ^

This is caused by a function returning 'const int', which doesn't make sense to gcc. Drop 'const' to fix the problem.

---
 arch/powerpc/kernel/smp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/kernel/smp.c +1 -1
index 10ffffe..49d5d4e 100644
@@ -768,7 +768,7 @@ int setup_profiling_timer(unsigned int multiplier)
 
 #ifdef CONFIG_SCHED_SMT
 /* cpumask of CPUs with asymetric SMT dependancy */
-static const int powerpc_smt_flags(void)
+static int powerpc_smt_flags(void)
 {
 	int flags = SD_SHARE_CPUPOWER | SD_SHARE_PKG_RESOURCES;
 
Signature · 1 line
1.9.1
Acked-by on v1 1/1
#1 lore raw
Quoted 5 lines · Guenter Roeck

If compiled with W=1, the following warning is seen in powerpc builds.

arch/powerpc/kernel/smp.c:750:18: warning:
type qualifiers ignored on function return type
static const int powerpc_smt_flags(void)

Quoted 7 lines
                 ^

This is caused by a function returning 'const int', which doesn't make sense to gcc. Drop 'const' to fix the problem.

Although it's strange you report this happening on line 750 in the changelog but the patch shows it differently.

Quoted 17 lines
---
 arch/powerpc/kernel/smp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/kernel/smp.c +1 -1
index 10ffffe..49d5d4e 100644
@@ -768,7 +768,7 @@ int setup_profiling_timer(unsigned int multiplier)
 
 #ifdef CONFIG_SCHED_SMT
 /* cpumask of CPUs with asymetric SMT dependancy */
-static const int powerpc_smt_flags(void)
+static int powerpc_smt_flags(void)
 {
 	int flags = SD_SHARE_CPUPOWER | SD_SHARE_PKG_RESOURCES;
 
#2 lore raw
Quoted 12 lines · David Rientjes
Quoted 10 lines · Guenter Roeck

If compiled with W=1, the following warning is seen in powerpc builds.

arch/powerpc/kernel/smp.c:750:18: warning:
type qualifiers ignored on function return type
static const int powerpc_smt_flags(void)

                  ^

This is caused by a function returning 'const int', which doesn't make sense to gcc. Drop 'const' to fix the problem.

Quoted 8 lines
Quoted 2 lines

Although it's strange you report this happening on line 750 in the changelog but the patch shows it differently.

In the latest kernel (v3.16-rc1) the function is at line 750. It appears that I ran the build test on a later version than the one I used to write the patch. Hope that is not a problem.

Guenter

#3 lore raw
In reply to Guenter Roeck
Quoted 9 lines · Guenter Roeck

If compiled with W=1, the following warning is seen in powerpc builds.

arch/powerpc/kernel/smp.c:750:18: warning:
type qualifiers ignored on function return type
static const int powerpc_smt_flags(void)

                 ^

This is caused by a function returning 'const int', which doesn't make sense to gcc. Drop 'const' to fix the problem.

This breaks the 64-bit build:

arch/powerpc/kernel/smp.c:764:2: error: initialization from incompatible pointer type [-Werror] arch/powerpc/kernel/smp.c:764:2: error: (near initialization for 'powerpc_topology[0].sd_flags') [-Werror]

It appears that the generic definition in sched.h has this function defined as const int, so that needs to be fixed too along with all instances in all archs.

Cheers,
Ben.

Quoted 19 lines
---
 arch/powerpc/kernel/smp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/kernel/smp.c +1 -1
index 10ffffe..49d5d4e 100644
@@ -768,7 +768,7 @@ int setup_profiling_timer(unsigned int multiplier)
 
 #ifdef CONFIG_SCHED_SMT
 /* cpumask of CPUs with asymetric SMT dependancy */
-static const int powerpc_smt_flags(void)
+static int powerpc_smt_flags(void)
 {
 	int flags = SD_SHARE_CPUPOWER | SD_SHARE_PKG_RESOURCES;
 
#4 lore raw
Quoted 11 lines · Benjamin Herrenschmidt
Quoted 9 lines · Guenter Roeck

If compiled with W=1, the following warning is seen in powerpc builds.

arch/powerpc/kernel/smp.c:750:18: warning:
type qualifiers ignored on function return type
static const int powerpc_smt_flags(void)

                  ^

This is caused by a function returning 'const int', which doesn't make sense to gcc. Drop 'const' to fix the problem.

Quoted 9 lines

This breaks the 64-bit build:

arch/powerpc/kernel/smp.c:764:2: error: initialization from incompatible pointer type [-Werror] arch/powerpc/kernel/smp.c:764:2: error: (near initialization for 'powerpc_topology[0].sd_flags') [-Werror]

It appears that the generic definition in sched.h has this function defined as const int, so that needs to be fixed too along with all instances in all archs.

https://lkml.org/lkml/2014/6/12/743

Guenter

#5 lore raw
Quoted 17 lines · Guenter Roeck
Quoted 16 lines · Benjamin Herrenschmidt
Quoted 9 lines · Guenter Roeck

If compiled with W=1, the following warning is seen in powerpc builds.

arch/powerpc/kernel/smp.c:750:18: warning:
type qualifiers ignored on function return type
static const int powerpc_smt_flags(void)

                  ^

This is caused by a function returning 'const int', which doesn't make sense to gcc. Drop 'const' to fix the problem.

This breaks the 64-bit build:

arch/powerpc/kernel/smp.c:764:2: error: initialization from incompatible pointer type [-Werror] arch/powerpc/kernel/smp.c:764:2: error: (near initialization for 'powerpc_topology[0].sd_flags') [-Werror]

Quoted 6 lines
Quoted 4 lines

It appears that the generic definition in sched.h has this function defined as const int, so that needs to be fixed too along with all instances in all archs.

https://lkml.org/lkml/2014/6/12/743

Won't the patch above break powerpc then ? IE. The functions signature won't match anymore ... /me thinks you probably need to fix them all at once.

Cheers,
Ben.

#6 lore raw
Quoted 23 lines · Benjamin Herrenschmidt
Quoted 22 lines · Guenter Roeck
Quoted 20 lines · Benjamin Herrenschmidt
Quoted 9 lines · Guenter Roeck

If compiled with W=1, the following warning is seen in powerpc builds.

arch/powerpc/kernel/smp.c:750:18: warning:
type qualifiers ignored on function return type
static const int powerpc_smt_flags(void)

                   ^

This is caused by a function returning 'const int', which doesn't make sense to gcc. Drop 'const' to fix the problem.

This breaks the 64-bit build:

arch/powerpc/kernel/smp.c:764:2: error: initialization from incompatible pointer type [-Werror] arch/powerpc/kernel/smp.c:764:2: error: (near initialization for 'powerpc_topology[0].sd_flags') [-Werror]

It appears that the generic definition in sched.h has this function defined as const int, so that needs to be fixed too along with all instances in all archs.

Quoted 6 lines
Quoted 1 line

https://lkml.org/lkml/2014/6/12/743

Won't the patch above break powerpc then ? IE. The functions signature won't match anymore ... /me thinks you probably need to fix them all at once.

I thought that only happens if a const is dropped, but maybe not.

Sigh. Much easier to break something than to fix it. That would mean to get approval from at least three maintainers, and all that to get rid of a warning. I don't really have time for that. Let's just forget about it and live with the warning.

Guenter

#7 lore raw
Quoted 8 lines · Guenter Roeck

I thought that only happens if a const is dropped, but maybe not.

Sigh. Much easier to break something than to fix it. That would mean to get approval
from at least three maintainers, and all that to get rid of a warning. I don't
really have time for that. Let's just forget about it and live with the warning.

Well you have my tentative approval :) And trivial ones like that don't really need the respective maintainers to respond really, I forget regularly and they still go upstream.

Cheers,
Ben.

#8 lore raw
In reply to Guenter Roeck
Quoted 6 lines · Guenter Roeck

Sigh. Much easier to break something than to fix it. That would mean to get approval
from at least three maintainers, and all that to get rid of a warning. I don't
really have time for that. Let's just forget about it and live with the warning.

So you send it to akpm. Or perhaps even trivial.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds