public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-7473] tree: Fix up warn_deprecated_use [PR104627] Date: Fri, 4 Mar 2022 08:54:24 +0000 (GMT) [thread overview] Message-ID: <20220304085424.051773858038@sourceware.org> (raw) https://gcc.gnu.org/g:49bc9c6c1ef9441c3db586882e1985da3be9cfa1 commit r12-7473-g49bc9c6c1ef9441c3db586882e1985da3be9cfa1 Author: Jakub Jelinek <jakub@redhat.com> Date: Fri Mar 4 09:53:36 2022 +0100 tree: Fix up warn_deprecated_use [PR104627] The r12-7287-g1b71bc7c8b18bd1b change improved the -Wdeprecated warning for C++, but regressed it for C, in particular in gcc.dg/deprecated.c testcase we now report a type that actually isn't deprecated as deprecated instead of the one that is deprecated. The following change tries to find the middle ground between what we used to do before and what r12-7287 change does. If TYPE_STUB_DECL (node) is non-NULL (that is what happens with those C tests), then it will do what it used to do before (just smarter, there is no need to lookup_attribute when it is called again a few lines below this), if it is NULL, it will try TYPE_STUB_DECL (TYPE_MAIN_VARIANT (node)) - what the deprecated-16.C test needs. 2022-03-04 Jakub Jelinek <jakub@redhat.com> PR c/104627 * tree.cc (warn_deprecated_use): For types prefer to use node and only use TYPE_MAIN_VARIANT (node) if TYPE_STUB_DECL (node) is NULL. Diff: --- gcc/tree.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gcc/tree.cc b/gcc/tree.cc index 4522d90c4d9..d6f900c53b4 100644 --- a/gcc/tree.cc +++ b/gcc/tree.cc @@ -12047,8 +12047,11 @@ warn_deprecated_use (tree node, tree attr) attr = DECL_ATTRIBUTES (node); else if (TYPE_P (node)) { - tree decl = TYPE_STUB_DECL (TYPE_MAIN_VARIANT (node)); + tree decl = TYPE_STUB_DECL (node); if (decl) + attr = TYPE_ATTRIBUTES (TREE_TYPE (decl)); + else if ((decl = TYPE_STUB_DECL (TYPE_MAIN_VARIANT (node))) + != NULL_TREE) { node = TREE_TYPE (decl); attr = TYPE_ATTRIBUTES (node);
reply other threads:[~2022-03-04 8:54 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20220304085424.051773858038@sourceware.org \ --to=jakub@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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 read-only IMAP folder(s) and NNTP newsgroup(s).