* Re: [PATCH] Avoid warning when building with NDEBUG
[not found] <20210218175115.2850050-1-irogers@google.com>
@ 2021-02-18 19:21 ` Arnaldo Carvalho de Melo
2021-02-18 19:34 ` Ian Rogers
0 siblings, 1 reply; 3+ messages in thread
From: Arnaldo Carvalho de Melo @ 2021-02-18 19:21 UTC (permalink / raw)
To: Ian Rogers; +Cc: dwarves
Em Thu, Feb 18, 2021 at 09:51:15AM -0800, Ian Rogers escreveu:
> The assert macro is compiled out with NDEBUG which can lead to an unused
> variable warning if the variable is only read in the assert. This is
> seen just here:
>
> dwarf_loader.c:957:17: error: unused variable 'tag' [-Werror,-Wunused-variable]
> const uint16_t tag = dwarf_tag(die);
Thanks Ian, I added:
Signed-off-by: Ian Rogers <irogers@google.com>
And CC: dwarves@vger.kernel.org
Please let me know if this is all ok.
- Arnaldo
> ---
> dwarf_loader.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/dwarf_loader.c b/dwarf_loader.c
> index b73d786..22c3a55 100644
> --- a/dwarf_loader.c
> +++ b/dwarf_loader.c
> @@ -954,9 +954,10 @@ static struct lexblock *lexblock__new(Dwarf_Die *die, struct cu *cu)
>
> static void ftype__init(struct ftype *ftype, Dwarf_Die *die, struct cu *cu)
> {
> +#ifndef NDEBUG
> const uint16_t tag = dwarf_tag(die);
> assert(tag == DW_TAG_subprogram || tag == DW_TAG_subroutine_type);
> -
> +#endif
> tag__init(&ftype->tag, cu, die);
> INIT_LIST_HEAD(&ftype->parms);
> ftype->nr_parms = 0;
> --
> 2.30.0.617.g56c4b15f3c-goog
>
--
- Arnaldo
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Avoid warning when building with NDEBUG
2021-02-18 19:21 ` [PATCH] Avoid warning when building with NDEBUG Arnaldo Carvalho de Melo
@ 2021-02-18 19:34 ` Ian Rogers
2021-02-18 19:43 ` Arnaldo Carvalho de Melo
0 siblings, 1 reply; 3+ messages in thread
From: Ian Rogers @ 2021-02-18 19:34 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo; +Cc: dwarves
On Thu, Feb 18, 2021 at 11:21 AM Arnaldo Carvalho de Melo
<acme@kernel.org> wrote:
>
> Em Thu, Feb 18, 2021 at 09:51:15AM -0800, Ian Rogers escreveu:
> > The assert macro is compiled out with NDEBUG which can lead to an unused
> > variable warning if the variable is only read in the assert. This is
> > seen just here:
> >
> > dwarf_loader.c:957:17: error: unused variable 'tag' [-Werror,-Wunused-variable]
> > const uint16_t tag = dwarf_tag(die);
>
> Thanks Ian, I added:
>
> Signed-off-by: Ian Rogers <irogers@google.com>
>
> And CC: dwarves@vger.kernel.org
>
> Please let me know if this is all ok.
>
> - Arnaldo
That's okay by me, sorry for not posting in the right way and I'm also
happy if this is just a bug report rather than a merged fix :-)
Thanks!
Ian
> > ---
> > dwarf_loader.c | 3 ++-
> > 1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/dwarf_loader.c b/dwarf_loader.c
> > index b73d786..22c3a55 100644
> > --- a/dwarf_loader.c
> > +++ b/dwarf_loader.c
> > @@ -954,9 +954,10 @@ static struct lexblock *lexblock__new(Dwarf_Die *die, struct cu *cu)
> >
> > static void ftype__init(struct ftype *ftype, Dwarf_Die *die, struct cu *cu)
> > {
> > +#ifndef NDEBUG
> > const uint16_t tag = dwarf_tag(die);
> > assert(tag == DW_TAG_subprogram || tag == DW_TAG_subroutine_type);
> > -
> > +#endif
> > tag__init(&ftype->tag, cu, die);
> > INIT_LIST_HEAD(&ftype->parms);
> > ftype->nr_parms = 0;
> > --
> > 2.30.0.617.g56c4b15f3c-goog
> >
>
> --
>
> - Arnaldo
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Avoid warning when building with NDEBUG
2021-02-18 19:34 ` Ian Rogers
@ 2021-02-18 19:43 ` Arnaldo Carvalho de Melo
0 siblings, 0 replies; 3+ messages in thread
From: Arnaldo Carvalho de Melo @ 2021-02-18 19:43 UTC (permalink / raw)
To: Ian Rogers; +Cc: dwarves
Em Thu, Feb 18, 2021 at 11:34:31AM -0800, Ian Rogers escreveu:
> On Thu, Feb 18, 2021 at 11:21 AM Arnaldo Carvalho de Melo
> <acme@kernel.org> wrote:
> >
> > Em Thu, Feb 18, 2021 at 09:51:15AM -0800, Ian Rogers escreveu:
> > > The assert macro is compiled out with NDEBUG which can lead to an unused
> > > variable warning if the variable is only read in the assert. This is
> > > seen just here:
> > >
> > > dwarf_loader.c:957:17: error: unused variable 'tag' [-Werror,-Wunused-variable]
> > > const uint16_t tag = dwarf_tag(die);
> >
> > Thanks Ian, I added:
> >
> > Signed-off-by: Ian Rogers <irogers@google.com>
> >
> > And CC: dwarves@vger.kernel.org
> >
> > Please let me know if this is all ok.
> >
> > - Arnaldo
>
> That's okay by me, sorry for not posting in the right way and I'm also
> happy if this is just a bug report rather than a merged fix :-)
It's in my local branch now, thanks!
- Arnaldo
> Thanks!
> Ian
>
> > > ---
> > > dwarf_loader.c | 3 ++-
> > > 1 file changed, 2 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/dwarf_loader.c b/dwarf_loader.c
> > > index b73d786..22c3a55 100644
> > > --- a/dwarf_loader.c
> > > +++ b/dwarf_loader.c
> > > @@ -954,9 +954,10 @@ static struct lexblock *lexblock__new(Dwarf_Die *die, struct cu *cu)
> > >
> > > static void ftype__init(struct ftype *ftype, Dwarf_Die *die, struct cu *cu)
> > > {
> > > +#ifndef NDEBUG
> > > const uint16_t tag = dwarf_tag(die);
> > > assert(tag == DW_TAG_subprogram || tag == DW_TAG_subroutine_type);
> > > -
> > > +#endif
> > > tag__init(&ftype->tag, cu, die);
> > > INIT_LIST_HEAD(&ftype->parms);
> > > ftype->nr_parms = 0;
> > > --
> > > 2.30.0.617.g56c4b15f3c-goog
> > >
> >
> > --
> >
> > - Arnaldo
--
- Arnaldo
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-02-18 19:52 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20210218175115.2850050-1-irogers@google.com>
2021-02-18 19:21 ` [PATCH] Avoid warning when building with NDEBUG Arnaldo Carvalho de Melo
2021-02-18 19:34 ` Ian Rogers
2021-02-18 19:43 ` Arnaldo Carvalho de Melo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).