diff mbox

Emit DW_AT_inline for C++17 inline variables (take 2)

Message ID 20161101230800.GA11998@tarox.wildebeest.org
State New
Headers show

Commit Message

Mark Wielaard Nov. 1, 2016, 11:08 p.m. UTC
On Tue, Nov 01, 2016 at 01:20:23PM -0400, Jason Merrill wrote:
> On Tue, Nov 1, 2016@12:10 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> > +         && !get_AT (var_die, DW_AT_inline)
> > +         && (origin_die == NULL || get_AT (origin_die, DW_AT_inline) == NULL)
> 
> Can we drop this repetition (here and for DW_AT_const_expr)?  get_AT
> should look through DW_AT_abstract_origin, and we should have added
> that earlier in gen_variable_die.
> 
> OK with that change.

That seemed to have been the last usage of origin_die in gen_variable_die.
So removing that caused:

/home/mark/src/gcc/gcc/dwarf2out.c: In function ‘void gen_variable_die(tree, tree, dw_die_ref)’:
/home/mark/src/gcc/gcc/dwarf2out.c:22454:14: error: variable ‘origin_die’ set but not used [-Werror=unused-but-set-variable]
   dw_die_ref origin_die = NULL;
              ^~~~~~~~~~
cc1plus: all warnings being treated as errors
make[3]: *** [dwarf2out.o] Error 1

The following seems to work around that and makes things build again for me:


Cheers,

Mark

Comments

Mark Wielaard Nov. 1, 2016, 11:15 p.m. UTC | #1
On Wed, 2016-11-02 at 00:08 +0100, Mark Wielaard wrote:
> That seemed to have been the last usage of origin_die in gen_variable_die.
> So removing that caused:
> 
> /home/mark/src/gcc/gcc/dwarf2out.c: In function ‘void gen_variable_die(tree, tree, dw_die_ref)’:
> /home/mark/src/gcc/gcc/dwarf2out.c:22454:14: error: variable ‘origin_die’ set but not used [-Werror=unused-but-set-variable]
>    dw_die_ref origin_die = NULL;
>               ^~~~~~~~~~
> cc1plus: all warnings being treated as errors
> make[3]: *** [dwarf2out.o] Error 1
> 
> The following seems to work around that and makes things build again for me:

Which is precisely what Jakub checked in 5 minutes before I sent that
email.

Sorry for the noise. Everything builds again.

Thanks,

Mark
diff mbox

Patch

diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 5ff6f97..24b85c1 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -22451,7 +22451,6 @@  gen_variable_die (tree decl, tree origin, dw_die_ref context_die)
   tree ultimate_origin;
   dw_die_ref var_die;
   dw_die_ref old_die = decl ? lookup_decl_die (decl) : NULL;
-  dw_die_ref origin_die = NULL;
   bool declaration = (DECL_EXTERNAL (decl_or_origin)
                      || class_or_namespace_scope_p (context_die));
   bool specialization_p = false;
@@ -22627,7 +22626,7 @@  gen_variable_die (tree decl, tree origin, dw_die_ref context_die)
     var_die = new_die (DW_TAG_variable, context_die, decl);
 
   if (origin != NULL)
-    origin_die = add_abstract_origin_attribute (var_die, origin);
+    add_abstract_origin_attribute (var_die, origin);
 
   /* Loop unrolling can create multiple blocks that refer to the same
      static variable, so we must test for the DW_AT_declaration flag.