]> git.ipfire.org Git - thirdparty/gcc.git/commit
c-family: copy attribute diagnostic fixes [PR113262]
authorJakub Jelinek <jakub@redhat.com>
Tue, 9 Jan 2024 14:37:04 +0000 (15:37 +0100)
committerJakub Jelinek <jakub@redhat.com>
Thu, 20 Jun 2024 10:01:59 +0000 (12:01 +0200)
commit3741efc7402bf421bd77e5e2b30ae513a9867372
tree240b5a6aa7f1fb14c5365300cce0c1236795f631
parent4b202779eaef81e70c739118e0a43ecf64d92941
c-family: copy attribute diagnostic fixes [PR113262]

The copy attributes is allowed on decls as well as types and even has
checks whether decl (set to *node) is DECL_P or TYPE_P, but for diagnostics
unconditionally uses DECL_SOURCE_LOCATION (decl), which obviously only works
if it applies to a decl.

2024-01-09  Jakub Jelinek  <jakub@redhat.com>

PR c/113262
* c-attribs.c (handle_copy_attribute): Don't use
DECL_SOURCE_LOCATION (decl) if decl is not DECL_P, use input_location
instead.  Formatting fixes.

* gcc.dg/pr113262.c: New test.

(cherry picked from commit c9fc7f398e8b330ff12ec8a29bfa058b6daf6624)
gcc/c-family/c-attribs.c
gcc/testsuite/gcc.dg/pr113262.c [new file with mode: 0644]