From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1851) id 54CF23858436; Wed, 1 Feb 2023 14:44:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 54CF23858436 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1675262677; bh=zcH148yNrI5KaOicHzvNtJQiiK68/ToQCAapJNdRYqQ=; h=From:To:Subject:Date:From; b=iCxzH57BBlRjGMc8x14R6K4W73ev+igN14hAkOsni95r1eIVdbyI9cwEJqU6kMbVS SQL40+Yoar2CSj5iDCjB7lE6yV7A40wBcyR2z9D4FLvj4hs+IVSJY0kJTwuLM8aBYu lemlu8SNr6d03iQ/7YjTkumXWHKH1Ze//NTMdJuQ= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Martin Liska To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-5631] ipa: silent -Wodr notes with -w X-Act-Checkin: gcc X-Git-Author: Martin Liska X-Git-Refname: refs/heads/master X-Git-Oldrev: 881bf8de9b07fb501d61ade8f521f1cc9dbe712e X-Git-Newrev: 8a7196977f6e91ad12c209cb2e3dbfe9f0fd3c3b Message-Id: <20230201144437.54CF23858436@sourceware.org> Date: Wed, 1 Feb 2023 14:44:37 +0000 (GMT) List-Id: https://gcc.gnu.org/g:8a7196977f6e91ad12c209cb2e3dbfe9f0fd3c3b commit r13-5631-g8a7196977f6e91ad12c209cb2e3dbfe9f0fd3c3b Author: Martin Liska Date: Fri Dec 2 11:37:41 2022 +0100 ipa: silent -Wodr notes with -w If -w is used, warn_odr properly sets *warned = false and so it should be preserved when calling warn_types_mismatch. Noticed that during a LTO reduction where I used -w. gcc/ChangeLog: * ipa-devirt.cc (odr_types_equivalent_p): Respect *warned value if set. Diff: --- gcc/ipa-devirt.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/gcc/ipa-devirt.cc b/gcc/ipa-devirt.cc index 5e27e4aeb30..e26266e9426 100644 --- a/gcc/ipa-devirt.cc +++ b/gcc/ipa-devirt.cc @@ -1300,7 +1300,7 @@ odr_types_equivalent_p (tree t1, tree t2, bool warn, bool *warned, warn_odr (t1, t2, NULL, NULL, warn, warned, G_("it is defined as a pointer to different type " "in another translation unit")); - if (warn && warned) + if (warn && (warned == NULL || *warned)) warn_types_mismatch (TREE_TYPE (t1), TREE_TYPE (t2), loc1, loc2); return false; @@ -1315,7 +1315,7 @@ odr_types_equivalent_p (tree t1, tree t2, bool warn, bool *warned, warn_odr (t1, t2, NULL, NULL, warn, warned, G_("a different type is defined " "in another translation unit")); - if (warn && warned) + if (warn && (warned == NULL || *warned)) warn_types_mismatch (TREE_TYPE (t1), TREE_TYPE (t2), loc1, loc2); return false; } @@ -1333,7 +1333,7 @@ odr_types_equivalent_p (tree t1, tree t2, bool warn, bool *warned, warn_odr (t1, t2, NULL, NULL, warn, warned, G_("a different type is defined in another " "translation unit")); - if (warn && warned) + if (warn && (warned == NULL || *warned)) warn_types_mismatch (TREE_TYPE (t1), TREE_TYPE (t2), loc1, loc2); } gcc_assert (TYPE_STRING_FLAG (t1) == TYPE_STRING_FLAG (t2)); @@ -1375,7 +1375,7 @@ odr_types_equivalent_p (tree t1, tree t2, bool warn, bool *warned, warn_odr (t1, t2, NULL, NULL, warn, warned, G_("has different return value " "in another translation unit")); - if (warn && warned) + if (warn && (warned == NULL || *warned)) warn_types_mismatch (TREE_TYPE (t1), TREE_TYPE (t2), loc1, loc2); return false; } @@ -1398,7 +1398,7 @@ odr_types_equivalent_p (tree t1, tree t2, bool warn, bool *warned, warn_odr (t1, t2, NULL, NULL, warn, warned, G_("has different parameters in another " "translation unit")); - if (warn && warned) + if (warn && (warned == NULL || *warned)) warn_types_mismatch (TREE_VALUE (parms1), TREE_VALUE (parms2), loc1, loc2); return false; @@ -1484,7 +1484,7 @@ odr_types_equivalent_p (tree t1, tree t2, bool warn, bool *warned, warn_odr (t1, t2, f1, f2, warn, warned, G_("a field of same name but different type " "is defined in another translation unit")); - if (warn && warned) + if (warn && (warned == NULL || *warned)) warn_types_mismatch (TREE_TYPE (f1), TREE_TYPE (f2), loc1, loc2); return false; }