gcc/ChangeLog:
2023-04-21 Jan Hubicka <hubicka@ucw.cz>
* ipa-devirt.cc (odr_types_equivalent_p): Cleanup warned checks.
hash_set<type_pair> *visited,
location_t loc1, location_t loc2)
{
hash_set<type_pair> *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;
/* Check first for the obvious case of pointer identity. */
if (t1 == t2)
return true;
warn_odr (t1, t2, NULL, NULL, warn, warned,
G_("it is defined as a pointer to different type "
"in another translation unit"));
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))
warn_types_mismatch (TREE_TYPE (t1), TREE_TYPE (t2),
loc1, loc2);
return false;
warn_types_mismatch (TREE_TYPE (t1), TREE_TYPE (t2),
loc1, loc2);
return false;
warn_odr (t1, t2, NULL, NULL, warn, warned,
G_("a different type is defined "
"in another translation unit"));
warn_odr (t1, t2, NULL, NULL, warn, warned,
G_("a different type is defined "
"in another translation unit"));
- if (warn && (warned == NULL || *warned))
warn_types_mismatch (TREE_TYPE (t1), TREE_TYPE (t2), loc1, loc2);
return false;
}
warn_types_mismatch (TREE_TYPE (t1), TREE_TYPE (t2), loc1, loc2);
return false;
}
warn_odr (t1, t2, NULL, NULL, warn, warned,
G_("a different type is defined in another "
"translation unit"));
warn_odr (t1, t2, NULL, NULL, warn, warned,
G_("a different type is defined in another "
"translation unit"));
- 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));
warn_types_mismatch (TREE_TYPE (t1), TREE_TYPE (t2), loc1, loc2);
}
gcc_assert (TYPE_STRING_FLAG (t1) == TYPE_STRING_FLAG (t2));
warn_odr (t1, t2, NULL, NULL, warn, warned,
G_("has different return value "
"in another translation unit"));
warn_odr (t1, t2, NULL, NULL, warn, warned,
G_("has different return value "
"in another translation unit"));
- if (warn && (warned == NULL || *warned))
warn_types_mismatch (TREE_TYPE (t1), TREE_TYPE (t2), loc1, loc2);
return false;
}
warn_types_mismatch (TREE_TYPE (t1), TREE_TYPE (t2), loc1, loc2);
return false;
}
warn_odr (t1, t2, NULL, NULL, warn, warned,
G_("has different parameters in another "
"translation unit"));
warn_odr (t1, t2, NULL, NULL, warn, warned,
G_("has different parameters in another "
"translation unit"));
- if (warn && (warned == NULL || *warned))
warn_types_mismatch (TREE_VALUE (parms1),
TREE_VALUE (parms2), loc1, loc2);
return false;
warn_types_mismatch (TREE_VALUE (parms1),
TREE_VALUE (parms2), loc1, loc2);
return false;
warn_odr (t1, t2, f1, f2, warn, warned,
G_("a field of same name but different type "
"is defined in another translation unit"));
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))
warn_types_mismatch (TREE_TYPE (f1), TREE_TYPE (f2), loc1, loc2);
return false;
}
warn_types_mismatch (TREE_TYPE (f1), TREE_TYPE (f2), loc1, loc2);
return false;
}