* [PATCH bpf-next] libbpf: fix false unused variable warning
@ 2020-04-30 1:25 Andrii Nakryiko
2020-04-30 1:49 ` Yuehaibing
2020-04-30 1:52 ` Yuehaibing
0 siblings, 2 replies; 4+ messages in thread
From: Andrii Nakryiko @ 2020-04-30 1:25 UTC (permalink / raw)
To: bpf, netdev, ast, daniel; +Cc: andrii.nakryiko, kernel-team, Andrii Nakryiko
Some versions of GCC falsely detect that vi might not be initialized. That's
not true, but let's silence it with NULL initialization.
Signed-off-by: Andrii Nakryiko <andriin@fb.com>
---
tools/lib/bpf/libbpf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
index d86ff8214b96..977add1b73e2 100644
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf.c
@@ -5003,8 +5003,8 @@ static int bpf_object__collect_map_relos(struct bpf_object *obj,
GElf_Shdr *shdr, Elf_Data *data)
{
int i, j, nrels, new_sz, ptr_sz = sizeof(void *);
+ const struct btf_var_secinfo *vi = NULL;
const struct btf_type *sec, *var, *def;
- const struct btf_var_secinfo *vi;
const struct btf_member *member;
struct bpf_map *map, *targ_map;
const char *name, *mname;
--
2.24.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH bpf-next] libbpf: fix false unused variable warning
2020-04-30 1:25 [PATCH bpf-next] libbpf: fix false unused variable warning Andrii Nakryiko
@ 2020-04-30 1:49 ` Yuehaibing
2020-04-30 1:52 ` Yuehaibing
1 sibling, 0 replies; 4+ messages in thread
From: Yuehaibing @ 2020-04-30 1:49 UTC (permalink / raw)
To: Andrii Nakryiko, bpf, netdev, ast, daniel; +Cc: andrii.nakryiko, kernel-team
On 2020/4/30 9:25, Andrii Nakryiko wrote:
> Some versions of GCC falsely detect that vi might not be initialized. That's
> not true, but let's silence it with NULL initialization.
>
This title seems not appropriate, 'unused' --> 'initialized' ?
> Signed-off-by: Andrii Nakryiko <andriin@fb.com>
> ---
> tools/lib/bpf/libbpf.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
> index d86ff8214b96..977add1b73e2 100644
> --- a/tools/lib/bpf/libbpf.c
> +++ b/tools/lib/bpf/libbpf.c
> @@ -5003,8 +5003,8 @@ static int bpf_object__collect_map_relos(struct bpf_object *obj,
> GElf_Shdr *shdr, Elf_Data *data)
> {
> int i, j, nrels, new_sz, ptr_sz = sizeof(void *);
> + const struct btf_var_secinfo *vi = NULL;
> const struct btf_type *sec, *var, *def;
> - const struct btf_var_secinfo *vi;
> const struct btf_member *member;
> struct bpf_map *map, *targ_map;
> const char *name, *mname;
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH bpf-next] libbpf: fix false unused variable warning
2020-04-30 1:25 [PATCH bpf-next] libbpf: fix false unused variable warning Andrii Nakryiko
2020-04-30 1:49 ` Yuehaibing
@ 2020-04-30 1:52 ` Yuehaibing
2020-04-30 2:13 ` Andrii Nakryiko
1 sibling, 1 reply; 4+ messages in thread
From: Yuehaibing @ 2020-04-30 1:52 UTC (permalink / raw)
To: Andrii Nakryiko, bpf, netdev, ast, daniel; +Cc: andrii.nakryiko, kernel-team
On 2020/4/30 9:25, Andrii Nakryiko wrote:
> Some versions of GCC falsely detect that vi might not be initialized. That's
> not true, but let's silence it with NULL initialization.
>
Title should be fixed 'unused' --> 'uninitialized' ?
> Signed-off-by: Andrii Nakryiko <andriin@fb.com>
> ---
> tools/lib/bpf/libbpf.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
> index d86ff8214b96..977add1b73e2 100644
> --- a/tools/lib/bpf/libbpf.c
> +++ b/tools/lib/bpf/libbpf.c
> @@ -5003,8 +5003,8 @@ static int bpf_object__collect_map_relos(struct bpf_object *obj,
> GElf_Shdr *shdr, Elf_Data *data)
> {
> int i, j, nrels, new_sz, ptr_sz = sizeof(void *);
> + const struct btf_var_secinfo *vi = NULL;
> const struct btf_type *sec, *var, *def;
> - const struct btf_var_secinfo *vi;
> const struct btf_member *member;
> struct bpf_map *map, *targ_map;
> const char *name, *mname;
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH bpf-next] libbpf: fix false unused variable warning
2020-04-30 1:52 ` Yuehaibing
@ 2020-04-30 2:13 ` Andrii Nakryiko
0 siblings, 0 replies; 4+ messages in thread
From: Andrii Nakryiko @ 2020-04-30 2:13 UTC (permalink / raw)
To: Yuehaibing
Cc: Andrii Nakryiko, bpf, Networking, Alexei Starovoitov,
Daniel Borkmann, Kernel Team
On Wed, Apr 29, 2020 at 6:52 PM Yuehaibing <yuehaibing@huawei.com> wrote:
>
> On 2020/4/30 9:25, Andrii Nakryiko wrote:
> > Some versions of GCC falsely detect that vi might not be initialized. That's
> > not true, but let's silence it with NULL initialization.
> >
>
> Title should be fixed 'unused' --> 'uninitialized' ?
Yep, my bad, will send v2 with correction.
>
> > Signed-off-by: Andrii Nakryiko <andriin@fb.com>
> > ---
> > tools/lib/bpf/libbpf.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
> > index d86ff8214b96..977add1b73e2 100644
> > --- a/tools/lib/bpf/libbpf.c
> > +++ b/tools/lib/bpf/libbpf.c
> > @@ -5003,8 +5003,8 @@ static int bpf_object__collect_map_relos(struct bpf_object *obj,
> > GElf_Shdr *shdr, Elf_Data *data)
> > {
> > int i, j, nrels, new_sz, ptr_sz = sizeof(void *);
> > + const struct btf_var_secinfo *vi = NULL;
> > const struct btf_type *sec, *var, *def;
> > - const struct btf_var_secinfo *vi;
> > const struct btf_member *member;
> > struct bpf_map *map, *targ_map;
> > const char *name, *mname;
> >
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-04-30 2:14 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-30 1:25 [PATCH bpf-next] libbpf: fix false unused variable warning Andrii Nakryiko
2020-04-30 1:49 ` Yuehaibing
2020-04-30 1:52 ` Yuehaibing
2020-04-30 2:13 ` Andrii Nakryiko
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.