Commit d840d7a2 by Jan Hubicka Committed by Jan Hubicka

lto-symtab.c (lto_symtab_merge_decls_2): Do not report ODR violations for method…

lto-symtab.c (lto_symtab_merge_decls_2): Do not report ODR violations for method whose basetype was already reported.


	* lto-symtab.c (lto_symtab_merge_decls_2): Do not report ODR violations
	for method whose basetype was already reported.

	* ipa-devirt.c (odr_type_violation_reported_p): New.
	* ipa-utils.h (odr_type_violation_reported_p): Declare.

From-SVN: r267397
parent c23f39f8
2018-12-24 Jan Hubicka <hubicka@ucw.cz>
* lto-symtab.c (lto_symtab_merge_decls_2): Do not report ODR violations
for method whose basetype was already reported.
* ipa-devirt.c (odr_type_violation_reported_p): New.
* ipa-utils.h (odr_type_violation_reported_p): Declare.
2018-12-24 Iain Sandoe <iain@sandoe.co.uk> 2018-12-24 Iain Sandoe <iain@sandoe.co.uk>
* configure.ac (dwarf2_debug_line): Check for the debug_line * configure.ac (dwarf2_debug_line): Check for the debug_line
...@@ -2152,6 +2152,12 @@ get_odr_type (tree type, bool insert) ...@@ -2152,6 +2152,12 @@ get_odr_type (tree type, bool insert)
return val; return val;
} }
bool
odr_type_violation_reported_p (tree type)
{
return get_odr_type (type, false)->odr_violated;
}
/* Add TYPE od ODR type hash. */ /* Add TYPE od ODR type hash. */
void void
......
...@@ -90,6 +90,7 @@ void warn_types_mismatch (tree t1, tree t2, location_t loc1 = UNKNOWN_LOCATION, ...@@ -90,6 +90,7 @@ void warn_types_mismatch (tree t1, tree t2, location_t loc1 = UNKNOWN_LOCATION,
location_t loc2 = UNKNOWN_LOCATION); location_t loc2 = UNKNOWN_LOCATION);
bool odr_or_derived_type_p (const_tree t); bool odr_or_derived_type_p (const_tree t);
bool odr_types_equivalent_p (tree type1, tree type2); bool odr_types_equivalent_p (tree type1, tree type2);
bool odr_type_violation_reported_p (tree type);
/* Return vector containing possible targets of polymorphic call E. /* Return vector containing possible targets of polymorphic call E.
If COMPLETEP is non-NULL, store true if the list is complete. If COMPLETEP is non-NULL, store true if the list is complete.
......
2018-12-24 Jan Hubicka <hubicka@ucw.cz>
* lto-symtab.c (lto_symtab_merge_decls_2): Do not report ODR violations
for method whose basetype was already reported.
2018-11-30 Michael Ploujnikov <michael.ploujnikov@oracle.com> 2018-11-30 Michael Ploujnikov <michael.ploujnikov@oracle.com>
Minimize clone counter memory usage in LTO. Minimize clone counter memory usage in LTO.
......
...@@ -697,10 +697,21 @@ lto_symtab_merge_decls_2 (symtab_node *first, bool diagnosed_p) ...@@ -697,10 +697,21 @@ lto_symtab_merge_decls_2 (symtab_node *first, bool diagnosed_p)
{ {
bool diag = false; bool diag = false;
if (level & 2) if (level & 2)
diag = warning_at (DECL_SOURCE_LOCATION (decl), {
OPT_Wodr, /* Silence warning for method and variables which belong
"%qD violates the C++ One Definition Rule", to types which already have ODR violation reported. Complaining
decl); once is enough. */
if (TREE_CODE (decl) != FUNCTION_DECL
|| TREE_CODE (TREE_TYPE (decl)) != METHOD_TYPE
|| !TYPE_METHOD_BASETYPE (TREE_TYPE (decl))
|| !odr_type_p (TYPE_METHOD_BASETYPE (TREE_TYPE (decl)))
|| !odr_type_violation_reported_p
(TYPE_METHOD_BASETYPE (TREE_TYPE (decl))))
diag = warning_at (DECL_SOURCE_LOCATION (decl),
OPT_Wodr,
"%qD violates the C++ One Definition Rule",
decl);
}
if (!diag && (level & 1)) if (!diag && (level & 1))
diag = warning_at (DECL_SOURCE_LOCATION (decl), diag = warning_at (DECL_SOURCE_LOCATION (decl),
OPT_Wlto_type_mismatch, OPT_Wlto_type_mismatch,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment