diff options
author | Jakub Jelinek <jakub@redhat.com> | 2017-03-09 17:42:45 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2017-03-09 17:42:45 +0100 |
commit | 01e5af5a2f5fa4813e359bc03d42e98d091c7a2d (patch) | |
tree | 00751fa0f7edfc1585af540a59ca67baebbdd525 /gcc/c | |
parent | 6443c7c0e5e1b348ff5841463e3c3828b3036e30 (diff) | |
download | gcc-01e5af5a2f5fa4813e359bc03d42e98d091c7a2d.zip gcc-01e5af5a2f5fa4813e359bc03d42e98d091c7a2d.tar.gz gcc-01e5af5a2f5fa4813e359bc03d42e98d091c7a2d.tar.bz2 |
re PR c/79969 (C FE emits locus of forward enum declaration rather than definition into debug info)
PR c/79969
* c-decl.c (start_enum): Adjust DECL_SOURCE_LOCATION of
TYPE_STUB_DECL.
* gcc.dg/debug/dwarf2/enum-loc1.c: New test.
From-SVN: r246009
Diffstat (limited to 'gcc/c')
-rw-r--r-- | gcc/c/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/c/c-decl.c | 4 |
2 files changed, 10 insertions, 0 deletions
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index 588fe73..e6da629 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,9 @@ +2017-03-09 Jakub Jelinek <jakub@redhat.com> + + PR c/79969 + * c-decl.c (start_enum): Adjust DECL_SOURCE_LOCATION of + TYPE_STUB_DECL. + 2017-03-07 Jakub Jelinek <jakub@redhat.com> PR c/79834 diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c index 645304a..130ffa6 100644 --- a/gcc/c/c-decl.c +++ b/gcc/c/c-decl.c @@ -8201,6 +8201,10 @@ start_enum (location_t loc, struct c_enum_contents *the_enum, tree name) enumtype = make_node (ENUMERAL_TYPE); pushtag (loc, name, enumtype); } + /* Update type location to the one of the definition, instead of e.g. + a forward declaration. */ + else if (TYPE_STUB_DECL (enumtype)) + DECL_SOURCE_LOCATION (TYPE_STUB_DECL (enumtype)) = loc; if (C_TYPE_BEING_DEFINED (enumtype)) error_at (loc, "nested redefinition of %<enum %E%>", name); |