2022-01-22 01:00:22

by Vincenzo Frascino

[permalink] [raw]
Subject: [PATCH] arm64: vdso: Fix "no previous prototype" warning

If compiling the arm64 kernel with W=1 the following warning is produced:

| arch/arm64/kernel/vdso/vgettimeofday.c:9:5: error: no previous prototype for ‘__kernel_clock_gettime’ [-Werror=missing-prototypes]
| 9 | int __kernel_clock_gettime(clockid_t clock,
| | ^~~~~~~~~~~~~~~~~~~~~~
| arch/arm64/kernel/vdso/vgettimeofday.c:15:5: error: no previous prototype for ‘__kernel_gettimeofday’ [-Werror=missing-prototypes]
| 15 | int __kernel_gettimeofday(struct __kernel_old_timeval *tv,
| | ^~~~~~~~~~~~~~~~~~~~~
| arch/arm64/kernel/vdso/vgettimeofday.c:21:5: error: no previous prototype for ‘__kernel_clock_getres’ [-Werror=missing-prototypes]
| 21 | int __kernel_clock_getres(clockid_t clock_id,
| | ^~~~~~~~~~~~~~~~~~~~~

This patch removes "-Wmissing-prototypes" and "-Wmissing-declarations" compilers
flags from the compilation of vgettimeofday.c to make possible to build the
kernel with CONFIG_WERROR enabled.

Cc: Catalin Marinas <[email protected]>
Cc: Will Deacon <[email protected]>
Suggested-by: Marc Kleine-Budde <[email protected]>
Signed-off-by: Vincenzo Frascino <[email protected]>
---
arch/arm64/kernel/vdso/Makefile | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/kernel/vdso/Makefile b/arch/arm64/kernel/vdso/Makefile
index 60813497a381..172452f79e46 100644
--- a/arch/arm64/kernel/vdso/Makefile
+++ b/arch/arm64/kernel/vdso/Makefile
@@ -29,8 +29,11 @@ ldflags-y := -shared -soname=linux-vdso.so.1 --hash-style=sysv \
ccflags-y := -fno-common -fno-builtin -fno-stack-protector -ffixed-x18
ccflags-y += -DDISABLE_BRANCH_PROFILING -DBUILD_VDSO

+# -Wmissing-prototypes and -Wmissing-declarations are removed from
+# the CFLAGS of vgettimeofday.c to make possible to build the
+# kernel with CONFIG_WERROR enabled.
CFLAGS_REMOVE_vgettimeofday.o = $(CC_FLAGS_FTRACE) -Os $(CC_FLAGS_SCS) $(GCC_PLUGINS_CFLAGS) \
- $(CC_FLAGS_LTO)
+ $(CC_FLAGS_LTO) -Wmissing-prototypes -Wmissing-declarations
KASAN_SANITIZE := n
KCSAN_SANITIZE := n
UBSAN_SANITIZE := n
--
2.34.1


2022-01-23 15:09:33

by Marc Kleine-Budde

[permalink] [raw]
Subject: Re: [PATCH] arm64: vdso: Fix "no previous prototype" warning

On 21.01.2022 12:12:34, Vincenzo Frascino wrote:
> If compiling the arm64 kernel with W=1 the following warning is produced:
>
> | arch/arm64/kernel/vdso/vgettimeofday.c:9:5: error: no previous prototype for ‘__kernel_clock_gettime’ [-Werror=missing-prototypes]
> | 9 | int __kernel_clock_gettime(clockid_t clock,
> | | ^~~~~~~~~~~~~~~~~~~~~~
> | arch/arm64/kernel/vdso/vgettimeofday.c:15:5: error: no previous prototype for ‘__kernel_gettimeofday’ [-Werror=missing-prototypes]
> | 15 | int __kernel_gettimeofday(struct __kernel_old_timeval *tv,
> | | ^~~~~~~~~~~~~~~~~~~~~
> | arch/arm64/kernel/vdso/vgettimeofday.c:21:5: error: no previous prototype for ‘__kernel_clock_getres’ [-Werror=missing-prototypes]
> | 21 | int __kernel_clock_getres(clockid_t clock_id,
> | | ^~~~~~~~~~~~~~~~~~~~~
>
> This patch removes "-Wmissing-prototypes" and "-Wmissing-declarations" compilers
> flags from the compilation of vgettimeofday.c to make possible to build the
> kernel with CONFIG_WERROR enabled.
>
> Cc: Catalin Marinas <[email protected]>
> Cc: Will Deacon <[email protected]>
> Suggested-by: Marc Kleine-Budde <[email protected]>
> Signed-off-by: Vincenzo Frascino <[email protected]>

Tested-by: Marc Kleine-Budde <[email protected]>

regards,
Marc

--
Pengutronix e.K. | Marc Kleine-Budde |
Embedded Linux | https://www.pengutronix.de |
Vertretung West/Dortmund | Phone: +49-231-2826-924 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |


Attachments:
(No filename) (1.58 kB)
signature.asc (499.00 B)
Download all attachments

2022-01-24 19:28:13

by Catalin Marinas

[permalink] [raw]
Subject: Re: [PATCH] arm64: vdso: Fix "no previous prototype" warning

On Fri, 21 Jan 2022 12:12:34 +0000, Vincenzo Frascino wrote:
> If compiling the arm64 kernel with W=1 the following warning is produced:
>
> | arch/arm64/kernel/vdso/vgettimeofday.c:9:5: error: no previous prototype for ‘__kernel_clock_gettime’ [-Werror=missing-prototypes]
> | 9 | int __kernel_clock_gettime(clockid_t clock,
> | | ^~~~~~~~~~~~~~~~~~~~~~
> | arch/arm64/kernel/vdso/vgettimeofday.c:15:5: error: no previous prototype for ‘__kernel_gettimeofday’ [-Werror=missing-prototypes]
> | 15 | int __kernel_gettimeofday(struct __kernel_old_timeval *tv,
> | | ^~~~~~~~~~~~~~~~~~~~~
> | arch/arm64/kernel/vdso/vgettimeofday.c:21:5: error: no previous prototype for ‘__kernel_clock_getres’ [-Werror=missing-prototypes]
> | 21 | int __kernel_clock_getres(clockid_t clock_id,
> | | ^~~~~~~~~~~~~~~~~~~~~
>
> [...]

Applied to arm64 (for-next/fixes), thanks!

[1/1] arm64: vdso: Fix "no previous prototype" warning
https://git.kernel.org/arm64/c/58cd4a088e89

--
Catalin