lkml.org 
[lkml]   [2023]   [Aug]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH 15/17] arch: fix asm-offsets.c building with -Wmissing-prototypes
On Sat, Aug 12, 2023 at 3:30 AM Arnd Bergmann <arnd@kernel.org> wrote:
>
> From: Arnd Bergmann <arnd@arndb.de>
>
> When -Wmissing-prototypes is enabled, the some asm-offsets.c files fail
> to build, even when this warning is disabled in the Makefile for normal
> files:
>
> arch/sparc/kernel/asm-offsets.c:22:5: error: no previous prototype for 'sparc32_foo' [-Werror=missing-prototypes]
> arch/sparc/kernel/asm-offsets.c:48:5: error: no previous prototype for 'foo' [-Werror=missing-prototypes]
>
> Address this by making use of the same trick we have on other architectures,
> renaming the unused global function to main(), which has an implicit
> prototype.


main() only works for one function call, but
there are some cases where splitting the code
into some functions makes the code cleaner.




> On loongarch, there are many functions in this file, so the trick does
> not work, adding explicit declarations works around it in a slightly
> more ugly way but is the best I could come up with here.

I do not like repeating the function names.

Could you try "static + __used" as in
arch/x86/kernel/asm-offsets.c ?





--
Best Regards
Masahiro Yamada

\
 
 \ /
  Last update: 2023-08-12 00:14    [W:0.934 / U:0.384 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site