2023-11-29 21:05:59

by Stephen Rothwell

[permalink] [raw]
Subject: linux-next: lots of errors/warnings from the -Werror=missing-prototypes addition

Hi all,

please see the kernelci results here:

https://lore.kernel.org/all/[email protected]/
--
Cheers,
Stephen Rothwell


Attachments:
(No filename) (499.00 B)
OpenPGP digital signature

2023-11-29 21:10:25

by Andrew Morton

[permalink] [raw]
Subject: Re: linux-next: lots of errors/warnings from the -Werror=missing-prototypes addition

On Thu, 30 Nov 2023 07:58:38 +1100 Stephen Rothwell <[email protected]> wrote:

> Hi all,
>
> please see the kernelci results here:
>
> https://lore.kernel.org/all/[email protected]/

And I'm not seeing a lot of fixing activity for these. Arnd, do you
think it was just too soon?

2023-11-29 23:00:35

by Arnd Bergmann

[permalink] [raw]
Subject: Re: linux-next: lots of errors/warnings from the -Werror=missing-prototypes addition

On Wed, Nov 29, 2023, at 22:10, Andrew Morton wrote:
> On Thu, 30 Nov 2023 07:58:38 +1100 Stephen Rothwell <[email protected]> wrote:
>
>> Hi all,
>>
>> please see the kernelci results here:
>>
>> https://lore.kernel.org/all/[email protected]/
>
> And I'm not seeing a lot of fixing activity for these. Arnd, do you
> think it was just too soon?

I was aware that a couple of architectures get new warnings,
and a previous version of my patch series turned -Wmissing-prototypes
off for those architectures.

Since most other architecture maintainers had already fixed all
the warnings after that series, my hope was that this would
happen for the rest as well.

I did all my testing with CONFIG_WERROR force-enabled, so
the bit I missed here is that at least three architectures
that are missing fixes also set -Werror: mips, sparc and alpha.

How about adding a patch to no longer force -Werror for
these?

diff --git a/arch/alpha/lib/Makefile b/arch/alpha/lib/Makefile
index 1cc74f7b50ef..6a779b9018fd 100644
--- a/arch/alpha/lib/Makefile
+++ b/arch/alpha/lib/Makefile
@@ -4,7 +4,6 @@
#

asflags-y := $(KBUILD_CFLAGS)
-ccflags-y := -Werror

# Many of these routines have implementations tuned for ev6.
# Choose them iff we're targeting ev6 specifically.
diff --git a/arch/alpha/mm/Makefile b/arch/alpha/mm/Makefile
index bd770302eb82..101dbd06b4ce 100644
--- a/arch/alpha/mm/Makefile
+++ b/arch/alpha/mm/Makefile
@@ -3,6 +3,4 @@
# Makefile for the linux alpha-specific parts of the memory manager.
#

-ccflags-y := -Werror
-
obj-y := init.o fault.o
diff --git a/arch/mips/Kbuild b/arch/mips/Kbuild
index af2967bffb73..e2d623621a00 100644
--- a/arch/mips/Kbuild
+++ b/arch/mips/Kbuild
@@ -1,10 +1,4 @@
# SPDX-License-Identifier: GPL-2.0
-# Fail on warnings - also for files referenced in subdirs
-# -Werror can be disabled for specific files using:
-# CFLAGS_<file.o> := -Wno-error
-ifeq ($(W),)
-subdir-ccflags-y := -Werror
-endif

# platform specific definitions
include $(srctree)/arch/mips/Kbuild.platforms
diff --git a/arch/sparc/kernel/Makefile b/arch/sparc/kernel/Makefile
index 1ce4d5028c86..58ea4ef9b622 100644
--- a/arch/sparc/kernel/Makefile
+++ b/arch/sparc/kernel/Makefile
@@ -5,7 +5,6 @@
#

asflags-y := -ansi
-#ccflags-y := -Werror

# Undefine sparc when processing vmlinux.lds - it is used
# And teach CPP we are doing $(BITS) builds (for this case)
diff --git a/arch/sparc/lib/Makefile b/arch/sparc/lib/Makefile
index 80b07bbe4978..59669ebddd4e 100644
--- a/arch/sparc/lib/Makefile
+++ b/arch/sparc/lib/Makefile
@@ -3,7 +3,6 @@
#

asflags-y := -ansi -DST_DIV0=0x02
-#ccflags-y := -Werror

lib-$(CONFIG_SPARC32) += ashrdi3.o
lib-$(CONFIG_SPARC32) += memcpy.o memset.o
diff --git a/arch/sparc/mm/Makefile b/arch/sparc/mm/Makefile
index a199484e131f..809d993f6d88 100644
--- a/arch/sparc/mm/Makefile
+++ b/arch/sparc/mm/Makefile
@@ -3,7 +3,6 @@
#

asflags-y := -ansi
-#ccflags-y := -Werror

obj-$(CONFIG_SPARC64) += ultra.o tlb.o tsb.o
obj-y += fault_$(BITS).o
diff --git a/arch/sparc/prom/Makefile b/arch/sparc/prom/Makefile
index 397b79af77f7..a1adc75d8055 100644
--- a/arch/sparc/prom/Makefile
+++ b/arch/sparc/prom/Makefile
@@ -3,7 +3,6 @@
# Linux.
#
asflags := -ansi
-ccflags := -Werror

lib-y := bootstr_$(BITS).o
lib-y += init_$(BITS).o


I'll also follow up with patches for the top warnings on mips
and arc, which should make most of the currently failing builds
clean again even with CONFIG_WERROR:

37 arch/mips/kernel/signal.c:903:17: error: no previous prototype for ‘do_notify_resume’ [-Werror=missing-prototypes]
37 arch/mips/kernel/signal.c:673:17: error: no previous prototype for ‘sys_rt_sigreturn’ [-Werror=missing-prototypes]
37 arch/mips/kernel/signal.c:515:5: error: no previous prototype for ‘restore_sigcontext’ [-Werror=missing-prototypes]
37 arch/mips/kernel/signal.c:438:5: error: no previous prototype for ‘setup_sigcontext’ [-Werror=missing-prototypes]
34 arch/mips/kernel/signal.c:636:17: error: no previous prototype for ‘sys_sigreturn’ [-Werror=missing-prototypes]
11 arch/mips/kernel/syscall.c:51:16: error: no previous prototype for ‘sysm_pipe’ [-Werror=missing-prototypes]
8 arch/mips/mm/fault.c:323:17: error: no previous prototype for ‘do_page_fault’ [-Werror=missing-prototypes]
12 arch/arc/kernel/ptrace.c:342:16: warning: no previous prototype for 'syscall_trace_enter' [-Wmissing-prototypes]
5 arch/arc/kernel/kprobes.c:193:15: warning: no previous prototype for 'arc_kprobe_handler' [-Wmissing-prototypes]

Arnd

2023-11-29 23:11:33

by Andrew Morton

[permalink] [raw]
Subject: Re: linux-next: lots of errors/warnings from the -Werror=missing-prototypes addition

On Wed, 29 Nov 2023 23:51:04 +0100 "Arnd Bergmann" <[email protected]> wrote:

> I did all my testing with CONFIG_WERROR force-enabled, so
> the bit I missed here is that at least three architectures
> that are missing fixes also set -Werror: mips, sparc and alpha.
>
> How about adding a patch to no longer force -Werror for
> these?

These architectures are doing it wrong, aren't they? They should be
using the CONFIG_WERROR infrastructure rather than hard-coding it? If
so then sure, a standalone patch to clean that up sounds sounds
appropriate. I guess it should precede "Makefile.extrawarn: turn on
missing-prototypes globally".

2023-11-30 11:50:19

by Arnd Bergmann

[permalink] [raw]
Subject: Re: linux-next: lots of errors/warnings from the -Werror=missing-prototypes addition

On Thu, Nov 30, 2023, at 00:10, Andrew Morton wrote:
> On Wed, 29 Nov 2023 23:51:04 +0100 "Arnd Bergmann" <[email protected]> wrote:
>
>> I did all my testing with CONFIG_WERROR force-enabled, so
>> the bit I missed here is that at least three architectures
>> that are missing fixes also set -Werror: mips, sparc and alpha.
>>
>> How about adding a patch to no longer force -Werror for
>> these?
>
> These architectures are doing it wrong, aren't they? They should be
> using the CONFIG_WERROR infrastructure rather than hard-coding it? If
> so then sure, a standalone patch to clean that up sounds sounds
> appropriate.

Yes, I think we should have already removed them when CONFIG_WERROR
was added in v5.15, the architecture specific logic dates back
to v2.6 times.

> I guess it should precede "Makefile.extrawarn: turn on
> missing-prototypes globally".

I already have a collection of patches to fix up known
-Wmissing-prototype warnings across architectures in the
asm-generic tree, so I'll add this patch there:

commit bdef96eb0b89dfa80992312a8e3b2613bf178ae5
Author: Arnd Bergmann <[email protected]>
Date: Thu Nov 30 00:07:07 2023 +0100

arch: turn off -Werror for architectures with known warnings

A couple of architectures enable -Werror for their own files regardless
of CONFIG_WERROR but also have known warnings that fail the build
with -Wmissing-prototypes enabled by default:

arch/alpha/lib/memcpy.c:153:8: error: no previous prototype for 'memcpy' [-Werror=missing-prototypes]
arch/alpha/kernel/irq.c:96:1: error: no previous prototype for 'handle_irq' [-Werror=missing-prototypes]
arch/mips/kernel/signal.c:673:17: error: no previous prototype for ‘sys_rt_sigreturn’ [-Werror=missing-prototypes]
arch/mips/kernel/signal.c:636:17: error: no previous prototype for ‘sys_sigreturn’ [-Werror=missing-prototypes]
arch/mips/kernel/syscall.c:51:16: error: no previous prototype for ‘sysm_pipe’ [-Werror=missing-prototypes]
arch/mips/mm/fault.c:323:17: error: no previous prototype for ‘do_page_fault’ [-Werror=missing-prototypes]
arch/sparc/vdso/vma.c:246:12: warning: no previous prototype for ‘init_vdso_image’ [-Wmissing-prototypes]v
arch/sparc/vdso/vdso32/../vclock_gettime.c:343:1: warning: no previous prototype for ‘__vdso_gettimeofday_stick’ [-Wmissing-prototypes]
arch/sparc/vdso/vclock_gettime.c:343:1: warning: no previous prototype for ‘__vdso_gettimeofday_stick’ [-Wmissing-prototypes]
arch/sparc/prom/p1275.c:52:6: warning: no previous prototype for ‘prom_cif_init’ [-Wmissing-prototypes]
arch/sparc/prom/misc_64.c:165:5: warning: no previous prototype for ‘prom_get_mmu_ihandle’ [-Wmissing-prototypes]

This appears to be an artifact from the times when this architecture
code was better maintained that most device drivers and before CONFIG_WERROR
was added. Now it just gets in the way, so remove all of these.

Powerpc and x86 both still have their own Kconfig options to enable -Werror
for some of their files. These architectures are better maintained than most
and the options are easy to disable, so leave those untouched.

Reported-by: Stephen Rothwell <[email protected]>
Signed-off-by: Arnd Bergmann <[email protected]>

diff --git a/arch/alpha/lib/Makefile b/arch/alpha/lib/Makefile
index 1cc74f7b50ef..6a779b9018fd 100644
--- a/arch/alpha/lib/Makefile
+++ b/arch/alpha/lib/Makefile
@@ -4,7 +4,6 @@
#

asflags-y := $(KBUILD_CFLAGS)
-ccflags-y := -Werror

# Many of these routines have implementations tuned for ev6.
# Choose them iff we're targeting ev6 specifically.
diff --git a/arch/alpha/mm/Makefile b/arch/alpha/mm/Makefile
index bd770302eb82..101dbd06b4ce 100644
--- a/arch/alpha/mm/Makefile
+++ b/arch/alpha/mm/Makefile
@@ -3,6 +3,4 @@
# Makefile for the linux alpha-specific parts of the memory manager.
#

-ccflags-y := -Werror
-
obj-y := init.o fault.o
diff --git a/arch/mips/Kbuild b/arch/mips/Kbuild
index af2967bffb73..e2d623621a00 100644
--- a/arch/mips/Kbuild
+++ b/arch/mips/Kbuild
@@ -1,10 +1,4 @@
# SPDX-License-Identifier: GPL-2.0
-# Fail on warnings - also for files referenced in subdirs
-# -Werror can be disabled for specific files using:
-# CFLAGS_<file.o> := -Wno-error
-ifeq ($(W),)
-subdir-ccflags-y := -Werror
-endif

# platform specific definitions
include $(srctree)/arch/mips/Kbuild.platforms
diff --git a/arch/sparc/kernel/Makefile b/arch/sparc/kernel/Makefile
index 1ce4d5028c86..58ea4ef9b622 100644
--- a/arch/sparc/kernel/Makefile
+++ b/arch/sparc/kernel/Makefile
@@ -5,7 +5,6 @@
#

asflags-y := -ansi
-#ccflags-y := -Werror

# Undefine sparc when processing vmlinux.lds - it is used
# And teach CPP we are doing $(BITS) builds (for this case)
diff --git a/arch/sparc/lib/Makefile b/arch/sparc/lib/Makefile
index 80b07bbe4978..59669ebddd4e 100644
--- a/arch/sparc/lib/Makefile
+++ b/arch/sparc/lib/Makefile
@@ -3,7 +3,6 @@
#

asflags-y := -ansi -DST_DIV0=0x02
-#ccflags-y := -Werror

lib-$(CONFIG_SPARC32) += ashrdi3.o
lib-$(CONFIG_SPARC32) += memcpy.o memset.o
diff --git a/arch/sparc/mm/Makefile b/arch/sparc/mm/Makefile
index a199484e131f..809d993f6d88 100644
--- a/arch/sparc/mm/Makefile
+++ b/arch/sparc/mm/Makefile
@@ -3,7 +3,6 @@
#

asflags-y := -ansi
-#ccflags-y := -Werror

obj-$(CONFIG_SPARC64) += ultra.o tlb.o tsb.o
obj-y += fault_$(BITS).o
diff --git a/arch/sparc/prom/Makefile b/arch/sparc/prom/Makefile
index 397b79af77f7..a1adc75d8055 100644
--- a/arch/sparc/prom/Makefile
+++ b/arch/sparc/prom/Makefile
@@ -3,7 +3,6 @@
# Linux.
#
asflags := -ansi
-ccflags := -Werror

lib-y := bootstr_$(BITS).o
lib-y += init_$(BITS).o

2023-11-30 16:21:55

by Andrew Morton

[permalink] [raw]
Subject: Re: linux-next: lots of errors/warnings from the -Werror=missing-prototypes addition

On Thu, 30 Nov 2023 09:07:38 +0100 "Arnd Bergmann" <[email protected]> wrote:

> > I guess it should precede "Makefile.extrawarn: turn on
> > missing-prototypes globally".
>
> I already have a collection of patches to fix up known
> -Wmissing-prototype warnings across architectures in the
> asm-generic tree, so I'll add this patch there:
>
> commit bdef96eb0b89dfa80992312a8e3b2613bf178ae5
> Author: Arnd Bergmann <[email protected]>
> Date: Thu Nov 30 00:07:07 2023 +0100
>
> arch: turn off -Werror for architectures with known warnings

I think this would be better in the mm-nonmm tree, alongside
"Makefile.extrawarn: turn on missing-prototypes globally". Can I steal it?

2023-11-30 21:37:25

by Arnd Bergmann

[permalink] [raw]
Subject: Re: linux-next: lots of errors/warnings from the -Werror=missing-prototypes addition

On Thu, Nov 30, 2023, at 17:19, Andrew Morton wrote:
> On Thu, 30 Nov 2023 09:07:38 +0100 "Arnd Bergmann" <[email protected]> wrote:
>
>> > I guess it should precede "Makefile.extrawarn: turn on
>> > missing-prototypes globally".
>>
>> I already have a collection of patches to fix up known
>> -Wmissing-prototype warnings across architectures in the
>> asm-generic tree, so I'll add this patch there:
>>
>> commit bdef96eb0b89dfa80992312a8e3b2613bf178ae5
>> Author: Arnd Bergmann <[email protected]>
>> Date: Thu Nov 30 00:07:07 2023 +0100
>>
>> arch: turn off -Werror for architectures with known warnings
>
> I think this would be better in the mm-nonmm tree, alongside
> "Makefile.extrawarn: turn on missing-prototypes globally". Can I steal it?

Agreed, that does help with bisection. I had pushed out the
asm-generic branch with the patch earlier today but now reverted
back to the previous state.

Arnd