Avoid warning when building with NDEBUG

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);

Signed-off-by: Ian Rogers <irogers@google.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
Ian Rogers 2021-02-18 09:51:15 -08:00 committed by Arnaldo Carvalho de Melo
parent 8e1f8c904e
commit f2889ff163
1 changed files with 2 additions and 1 deletions

View File

@ -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;