From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1075) id 7C1053858C83; Fri, 21 Apr 2023 13:44:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7C1053858C83 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1682084671; bh=j6Vl3Wiu5o8JGQzg6g/Cga1tHH8M5F8fTEij2tig16g=; h=From:To:Subject:Date:From; b=p2du08Q7//xYLtGNyAHFaeSAmzPozr7FgxnohEMXtfIUdmh8QWuo2zVMZ5FU7ePlp ksRtG4RNMvpR5ychCKgfxRua8fX+BIVb9QoJdHoyzZwmZW5V6m/6LXZuriUb6kUTro pcjjSgoU4czsDcMVGMPFZU+OUjwIzSloginO8SxY= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Jan Hubicka To: gcc-cvs@gcc.gnu.org Subject: [gcc r14-141] Cleanup odr_types_equivalent_p X-Act-Checkin: gcc X-Git-Author: Jan Hubicka X-Git-Refname: refs/heads/master X-Git-Oldrev: a7e1ee39e4fa37d005929c4ff9457d1a199559c6 X-Git-Newrev: b5c3abcd77cbca6b2d921fa2f7d21a52e5a36080 Message-Id: <20230421134431.7C1053858C83@sourceware.org> Date: Fri, 21 Apr 2023 13:44:31 +0000 (GMT) List-Id: https://gcc.gnu.org/g:b5c3abcd77cbca6b2d921fa2f7d21a52e5a36080 commit r14-141-gb5c3abcd77cbca6b2d921fa2f7d21a52e5a36080 Author: Jan Hubicka Date: Fri Apr 21 15:44:06 2023 +0200 Cleanup odr_types_equivalent_p gcc/ChangeLog: 2023-04-21 Jan Hubicka * ipa-devirt.cc (odr_types_equivalent_p): Cleanup warned checks. Diff: --- gcc/ipa-devirt.cc | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/gcc/ipa-devirt.cc b/gcc/ipa-devirt.cc index 14cf132c767..819860258d1 100644 --- a/gcc/ipa-devirt.cc +++ b/gcc/ipa-devirt.cc @@ -1221,6 +1221,9 @@ odr_types_equivalent_p (tree t1, tree t2, bool warn, bool *warned, hash_set *visited, location_t loc1, location_t loc2) { + /* If we are asked to warn, we need warned to keep track if warning was + output. */ + gcc_assert (!warn || warned); /* Check first for the obvious case of pointer identity. */ if (t1 == t2) return true; @@ -1300,7 +1303,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 == NULL || *warned)) + if (warn && *warned) warn_types_mismatch (TREE_TYPE (t1), TREE_TYPE (t2), loc1, loc2); return false; @@ -1315,7 +1318,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 == NULL || *warned)) + if (warn && *warned) warn_types_mismatch (TREE_TYPE (t1), TREE_TYPE (t2), loc1, loc2); return false; } @@ -1333,7 +1336,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 == NULL || *warned)) + if (warn && *warned) warn_types_mismatch (TREE_TYPE (t1), TREE_TYPE (t2), loc1, loc2); } gcc_assert (TYPE_STRING_FLAG (t1) == TYPE_STRING_FLAG (t2)); @@ -1375,7 +1378,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 == NULL || *warned)) + if (warn && *warned) warn_types_mismatch (TREE_TYPE (t1), TREE_TYPE (t2), loc1, loc2); return false; } @@ -1398,7 +1401,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 == NULL || *warned)) + if (warn && *warned) warn_types_mismatch (TREE_VALUE (parms1), TREE_VALUE (parms2), loc1, loc2); return false; @@ -1484,7 +1487,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 == NULL || *warned)) + if (warn && *warned) warn_types_mismatch (TREE_TYPE (f1), TREE_TYPE (f2), loc1, loc2); return false; }