Re: [PATCH] LoongArch: Fix build warnings in VDSO

From: Arnd Bergmann
Date: Wed Aug 24 2022 - 06:10:35 EST


On Sat, Aug 20, 2022 at 5:35 PM Huacai Chen <chenhuacai@xxxxxxxxxxx> wrote:
>
> diff --git a/arch/loongarch/vdso/vgetcpu.c b/arch/loongarch/vdso/vgetcpu.c
> index 43a0078e4418..e02e775f5360 100644
> --- a/arch/loongarch/vdso/vgetcpu.c
> +++ b/arch/loongarch/vdso/vgetcpu.c
> @@ -24,6 +24,8 @@ static __always_inline const struct vdso_pcpu_data *get_pcpu_data(void)
> return (struct vdso_pcpu_data *)(get_vdso_base() - VDSO_DATA_SIZE);
> }
>
> +extern
> +int __vdso_getcpu(unsigned int *cpu, unsigned int *node, struct getcpu_cache *unused);
> int __vdso_getcpu(unsigned int *cpu, unsigned int *node, struct getcpu_cache *unused)
> {

I don't think that adding the declaration before the function is a
good workaround here,
that is likely to just trigger another warning about declarations in .c files.

I would add the declarations into a header file instead. If the
prototypes are the same
across architectures, this can be a global header that also avoids the
warnings elsewhere,
otherwise just keep it local to this directory.

Arnd