On Tue, Oct 31, 2023 at 02:56:24PM -0700, Dave Marchevsky wrote: > BPF kfuncs are meant to be called from BPF programs. Accordingly, most > kfuncs are not called from anywhere in the kernel, which the > -Wmissing-prototypes warning is unhappy about. We've peppered > __diag_ignore_all("-Wmissing-prototypes", ... everywhere kfuncs are > defined in the codebase to suppress this warning. > > This patch adds two macros meant to bound one or many kfunc definitions. > All existing kfunc definitions which use these __diag calls to suppress > -Wmissing-prototypes are migrated to use the newly-introduced macros. > A new __diag_ignore_all - for "-Wmissing-declarations" - is added to the > __bpf_kfunc_start_defs macro based on feedback from Andrii on an earlier > version of this patch [0] and another recent mailing list thread [1]. > > In the future we might need to ignore different warnings or do other > kfunc-specific things. This change will make it easier to make such > modifications for all kfunc defs. > > [0]: https://lore.kernel.org/bpf/CAEf4BzaE5dRWtK6RPLnjTW-MW9sx9K3Fn6uwqCTChK2Dcb1Xig@xxxxxxxxxxxxxx/ > [1]: https://lore.kernel.org/bpf/ZT+2qCc%2FaXep0%2FLf@krava/ > > Signed-off-by: Dave Marchevsky <davemarchevsky@xxxxxx> > Suggested-by: Andrii Nakryiko <andrii@xxxxxxxxxx> > Acked-by: Andrii Nakryiko <andrii@xxxxxxxxxx> > Cc: Jiri Olsa <olsajiri@xxxxxxxxx> Acked-by: David Vernet <void@xxxxxxxxxxxxx> Thanks for taking care of this!