All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexei Starovoitov <alexei.starovoitov@gmail.com>
To: Jean-Philippe Menil <jpmenil@gmail.com>
Cc: yhs@fb.com, kernel-janitors@vger.kernel.org,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Martin KaFai Lau <kafai@fb.com>, Song Liu <songliubraving@fb.com>,
	Andrii Nakryiko <andriin@fb.com>,
	netdev@vger.kernel.org, bpf@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] bpf: fix build warning - missing prototype
Date: Thu, 26 Mar 2020 16:54:26 -0700	[thread overview]
Message-ID: <20200326235426.ei6ae2z5ek6uq3tt@ast-mbp> (raw)
In-Reply-To: <20200324072231.5780-1-jpmenil@gmail.com>

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@gmail.com>
> ---
>  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.

WARNING: multiple messages have this Message-ID (diff)
From: Alexei Starovoitov <alexei.starovoitov@gmail.com>
To: Jean-Philippe Menil <jpmenil@gmail.com>
Cc: yhs@fb.com, kernel-janitors@vger.kernel.org,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Martin KaFai Lau <kafai@fb.com>, Song Liu <songliubraving@fb.com>,
	Andrii Nakryiko <andriin@fb.com>,
	netdev@vger.kernel.org, bpf@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] bpf: fix build warning - missing prototype
Date: Thu, 26 Mar 2020 23:54:26 +0000	[thread overview]
Message-ID: <20200326235426.ei6ae2z5ek6uq3tt@ast-mbp> (raw)
In-Reply-To: <20200324072231.5780-1-jpmenil@gmail.com>

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@gmail.com>
> ---
>  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.

  parent reply	other threads:[~2020-03-26 23:54 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-22 14:08 [PATCH] bpf: fix build warning - missing prototype Jean-Philippe Menil
2020-03-22 14:08 ` Jean-Philippe Menil
2020-03-23  5:32 ` Yonghong Song
2020-03-23  5:32   ` Yonghong Song
2020-03-23  7:42   ` Jean-Philippe Menil
2020-03-23  7:42     ` Jean-Philippe Menil
2020-03-23 14:52     ` Yonghong Song
2020-03-23 14:52       ` Yonghong Song
2020-03-24  7:22       ` [PATCH v2] " Jean-Philippe Menil
2020-03-24  7:22         ` Jean-Philippe Menil
2020-03-24 16:19         ` Yonghong Song
2020-03-24 16:19           ` Yonghong Song
2020-03-26 23:54         ` Alexei Starovoitov [this message]
2020-03-26 23:54           ` Alexei Starovoitov
2020-03-27  7:55           ` [PATCH v3] " Jean-Philippe Menil
2020-03-27  7:55             ` Jean-Philippe Menil
2020-03-27 20:34             ` Daniel Borkmann
2020-03-27 20:34               ` Daniel Borkmann
2020-03-27 20:47               ` [PATCH v4] " Jean-Philippe Menil
2020-03-27 20:47                 ` Jean-Philippe Menil
2020-03-28 17:15                 ` Daniel Borkmann
2020-03-28 17:15                   ` Daniel Borkmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200326235426.ei6ae2z5ek6uq3tt@ast-mbp \
    --to=alexei.starovoitov@gmail.com \
    --cc=andriin@fb.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=jpmenil@gmail.com \
    --cc=kafai@fb.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=songliubraving@fb.com \
    --cc=yhs@fb.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.