Re: [PATCH v2] bpf: fix build warning - missing prototype

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Mar 24, 2020 at 08:22:31AM +0100, Jean-Philippe Menil wrote:
> Fix build warnings when building net/bpf/test_run.o with W=1 due
> to missing prototype for bpf_fentry_test{1..6}.
> 
> Declare prototypes in order to silence warnings.
> 
> Signed-off-by: Jean-Philippe Menil <jpmenil@xxxxxxxxx>
> ---
>  net/bpf/test_run.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/net/bpf/test_run.c b/net/bpf/test_run.c
> index d555c0d8657d..cdf87fb0b6eb 100644
> --- a/net/bpf/test_run.c
> +++ b/net/bpf/test_run.c
> @@ -113,31 +113,37 @@ static int bpf_test_finish(const union bpf_attr *kattr,
>   * architecture dependent calling conventions. 7+ can be supported in the
>   * future.
>   */
> +int noinline bpf_fentry_test1(int a);
>  int noinline bpf_fentry_test1(int a)
>  {
>  	return a + 1;
>  }
>  
> +int noinline bpf_fentry_test2(int a, u64 b);
>  int noinline bpf_fentry_test2(int a, u64 b)
>  {
>  	return a + b;
>  }
>  
> +int noinline bpf_fentry_test3(char a, int b, u64 c);
>  int noinline bpf_fentry_test3(char a, int b, u64 c)
>  {
>  	return a + b + c;
>  }
>  
> +int noinline bpf_fentry_test4(void *a, char b, int c, u64 d);
>  int noinline bpf_fentry_test4(void *a, char b, int c, u64 d)
>  {
>  	return (long)a + b + c + d;
>  }
>  
> +int noinline bpf_fentry_test5(u64 a, void *b, short c, int d, u64 e);
>  int noinline bpf_fentry_test5(u64 a, void *b, short c, int d, u64 e)
>  {
>  	return a + (long)b + c + d + e;
>  }
>  
> +int noinline bpf_fentry_test6(u64 a, void *b, short c, int d, void *e, u64 f);
>  int noinline bpf_fentry_test6(u64 a, void *b, short c, int d, void *e, u64 f)

That's a bit too much of "watery water".
Have you considered
__diag_push();
__diag_ignore(GCC, "-Wwhatever specific flag will shut up this warn")
__diag_pop();
approach ?
It will be self documenting as well.



[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux