Re: Powerpc: maple_defconfig: kernel/rtas_pci.c:46:5: error: no previous prototype for function 'rtas_read_config' [-Werror,-Wmissing-prototypes]

From: Nathan Lynch
Date: Mon Nov 27 2023 - 15:21:36 EST


Naresh Kamboju <naresh.kamboju@xxxxxxxxxx> writes:
> Following Powerpc maple_defconfig and other builds failed with gcc-13 / 8
> and clang toolchains on Linux next-20231127 tag.
>
> build:
> * gcc-8-cell_defconfig
> * gcc-8-maple_defconfig
> * gcc-8-tinyconfig
> * gcc-13-tinyconfig
> * gcc-13-cell_defconfig
> * gcc-13-maple_defconfig
> * clang-17-cell_defconfig
> * clang-17-tinyconfig
> * clang-17-maple_defconfig
> * clang-nightly-cell_defconfig
> * clang-nightly-maple_defconfig
> * clang-nightly-tinyconfig
>
> Reported-by: Linux Kernel Functional Testing <lkft@xxxxxxxxxx>
>
> Build logs:
> -----------
> arch/powerpc/kernel/rtas_pci.c:46:5: error: no previous prototype for
> function 'rtas_read_config' [-Werror,-Wmissing-prototypes]
> 46 | int rtas_read_config(struct pci_dn *pdn, int where, int size, u32 *val)
> | ^
> arch/powerpc/kernel/rtas_pci.c:46:1: note: declare 'static' if the
> function is not intended to be used outside of this translation unit
> 46 | int rtas_read_config(struct pci_dn *pdn, int where, int size, u32 *val)
> | ^
> | static
> arch/powerpc/kernel/rtas_pci.c:98:5: error: no previous prototype for
> function 'rtas_write_config' [-Werror,-Wmissing-prototypes]
> 98 | int rtas_write_config(struct pci_dn *pdn, int where, int size, u32 val)
> | ^
> arch/powerpc/kernel/rtas_pci.c:98:1: note: declare 'static' if the
> function is not intended to be used outside of this translation unit
> 98 | int rtas_write_config(struct pci_dn *pdn, int where, int size, u32 val)
> | ^
> | static
> 2 errors generated.
> make[5]: *** [scripts/Makefile.build:243:
> arch/powerpc/kernel/rtas_pci.o] Error 1

This appears to be a latent issue in this code... the prototypes for
rtas_read_config() and rtas_write_config() in asm/ppc-pci.h are guarded
by #ifdef CONFIG_EEH for some reason. So I would expect this to happen
whenever it is built with CONFIG_EEH disabled and -Wmissing-prototypes.

So I guess it's fallout from commit c6345dfa6e3e ("Makefile.extrawarn:
turn on missing-prototypes globally").

Unfortunately the resolution isn't as simple as moving the prototypes
out of the CONFIG_EEH-guarded region, but I think I'll have a fix for
this later today.