mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yonghong Song <yhs@fb.com>
To: Wang Hai <wanghai38@huawei.com>, <davem@davemloft.net>,
	<kuba@kernel.org>, <ast@kernel.org>, <daniel@iogearbox.net>,
	<kafai@fb.com>, <songliubraving@fb.com>, <andriin@fb.com>,
	<john.fastabend@gmail.com>, <kpsingh@chromium.org>
Cc: <netdev@vger.kernel.org>, <bpf@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH -next] bpf: Make some functions static
Date: Mon, 20 Jul 2020 09:18:13 -0700	[thread overview]
Message-ID: <cf3411eb-8129-ecc4-4975-a995d114cf7e@fb.com> (raw)
In-Reply-To: <20200718115135.34856-1-wanghai38@huawei.com>



On 7/18/20 4:51 AM, Wang Hai wrote:
> Fix sparse build warning:
> 
> net/bpf/test_run.c:120:14: warning:
>   symbol 'bpf_fentry_test1' was not declared. Should it be static?
> net/bpf/test_run.c:125:14: warning:
>   symbol 'bpf_fentry_test2' was not declared. Should it be static?
> net/bpf/test_run.c:130:14: warning:
>   symbol 'bpf_fentry_test3' was not declared. Should it be static?
> net/bpf/test_run.c:135:14: warning:
>   symbol 'bpf_fentry_test4' was not declared. Should it be static?
> net/bpf/test_run.c:140:14: warning:
>   symbol 'bpf_fentry_test5' was not declared. Should it be static?
> net/bpf/test_run.c:145:14: warning:
>   symbol 'bpf_fentry_test6' was not declared. Should it be static?
> net/bpf/test_run.c:154:14: warning:
>   symbol 'bpf_fentry_test7' was not declared. Should it be static?
> net/bpf/test_run.c:159:14: warning:
>   symbol 'bpf_fentry_test8' was not declared. Should it be static?
> net/bpf/test_run.c:164:14: warning:
>   symbol 'bpf_modify_return_test' was not declared. Should it be static?
> 
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Wang Hai <wanghai38@huawei.com>

Please see commit:

commit e9ff9d52540a53ce8c9eff5bf8b66467fe81eb2b
Author: Jean-Philippe Menil <jpmenil@gmail.com>
Date:   Fri Mar 27 21:47:13 2020 +0100

     bpf: Fix build warning regarding missing prototypes

     Fix build warnings when building net/bpf/test_run.o with W=1 due
     to missing prototype for bpf_fentry_test{1..6}.

     Instead of declaring prototypes, turn off warnings with
     __diag_{push,ignore,pop} as pointed out by Alexei.

You probably use an old compiler (gcc < 8) which is why
the warning is emitted.

> ---
>   net/bpf/test_run.c | 18 +++++++++---------
>   1 file changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/net/bpf/test_run.c b/net/bpf/test_run.c
> index b03c469cd01f..0d78bd9b6c9d 100644
> --- a/net/bpf/test_run.c
> +++ b/net/bpf/test_run.c
> @@ -117,32 +117,32 @@ static int bpf_test_finish(const union bpf_attr *kattr,
>   __diag_push();
>   __diag_ignore(GCC, 8, "-Wmissing-prototypes",
>   	      "Global functions as their definitions will be in vmlinux BTF");
> -int noinline bpf_fentry_test1(int a)
> +static noinline int bpf_fentry_test1(int a)
>   {
>   	return a + 1;
>   }
>   
> -int noinline bpf_fentry_test2(int a, u64 b)
> +static noinline int bpf_fentry_test2(int a, u64 b)
>   {
>   	return a + b;
>   }
>   
> -int noinline bpf_fentry_test3(char a, int b, u64 c)
> +static noinline int bpf_fentry_test3(char a, int b, u64 c)
>   {
>   	return a + b + c;
>   }
>   
[...]

      reply	other threads:[~2020-07-20 16:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-18 11:51 Wang Hai
2020-07-20 16:18 ` Yonghong Song [this message]

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=cf3411eb-8129-ecc4-4975-a995d114cf7e@fb.com \
    --to=yhs@fb.com \
    --cc=andriin@fb.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=john.fastabend@gmail.com \
    --cc=kafai@fb.com \
    --cc=kpsingh@chromium.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=songliubraving@fb.com \
    --cc=wanghai38@huawei.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome