Commit 96d84882 by Paolo Bonzini Committed by Paolo Bonzini

revert: re PR c++/35049 (g++.dg/conversion/simd3.C:12: error: invalid operands…

revert: re PR c++/35049 (g++.dg/conversion/simd3.C:12: error: invalid operands to binary + (have 'float __vector__' and 'int __vector__'))

cp:
2008-03-07  Paolo Bonzini  <bonzini@gnu.org>

	Revert:

	2008-02-06  Douglas Gregor  <doug.gregor@gmail.com>

	PR c++/35049
	PR c++/35096
	* typeck.c (structural_comptypes): Call cp_comptypes.
	(comptypes): New; called from the C/C++ common bits to perform
	strict checks.
	(cp_comptypes): Renamed from comptypes, which is already used,
	with a different signature, by the C++ front end.
	(build_reinterpret_cast_1): Call cp_comptypes.
	(ptr_reasonably_similar): Ditto.
	* decl.c (decls_match): Ditto.
	* cvt.c (convert_to_reference): Ditto.
	* cp-tree.h (same_type_p): Ditto.
	(same_or_base_type_p): Ditto.
	(comptypes): Rename to cp_comptypes.
	* pt.c (canonical_type_parameter): Call cp_comptypes.

objcp:
2008-03-07  Paolo Bonzini  <bonzini@gnu.org>

	Revert:

	2008-02-07  Andreas Tobler  <andreast-list@fgznet.ch>
	            Douglas Gregor  <doug.gregor@gmail.com>
 
	PR bootstrap/35115
	* objcp-decl.c (objcp_comptypes): Call cp_comptypes, not comptypes.

From-SVN: r133007
parent 31908b79
2008-03-07 Paolo Bonzini <bonzini@gnu.org> 2008-03-07 Paolo Bonzini <bonzini@gnu.org>
Revert:
2008-02-06 Douglas Gregor <doug.gregor@gmail.com>
PR c++/35049
PR c++/35096
* typeck.c (structural_comptypes): Call cp_comptypes.
(comptypes): New; called from the C/C++ common bits to perform
strict checks.
(cp_comptypes): Renamed from comptypes, which is already used,
with a different signature, by the C++ front end.
(build_reinterpret_cast_1): Call cp_comptypes.
(ptr_reasonably_similar): Ditto.
* decl.c (decls_match): Ditto.
* cvt.c (convert_to_reference): Ditto.
* cp-tree.h (same_type_p): Ditto.
(same_or_base_type_p): Ditto.
(comptypes): Rename to cp_comptypes.
* pt.c (canonical_type_parameter): Call cp_comptypes.
2008-03-07 Paolo Bonzini <bonzini@gnu.org>
* cp-objcp-common.c (cxx_types_compatible_p): Remove obsolete * cp-objcp-common.c (cxx_types_compatible_p): Remove obsolete
test for equivalence between pointer and references. test for equivalence between pointer and references.
......
...@@ -281,7 +281,7 @@ typedef struct ptrmem_cst * ptrmem_cst_t; ...@@ -281,7 +281,7 @@ typedef struct ptrmem_cst * ptrmem_cst_t;
/* Returns nonzero iff TYPE1 and TYPE2 are the same type, in the usual /* Returns nonzero iff TYPE1 and TYPE2 are the same type, in the usual
sense of `same'. */ sense of `same'. */
#define same_type_p(TYPE1, TYPE2) \ #define same_type_p(TYPE1, TYPE2) \
cp_comptypes ((TYPE1), (TYPE2), COMPARE_STRICT) comptypes ((TYPE1), (TYPE2), COMPARE_STRICT)
/* Returns nonzero iff TYPE1 and TYPE2 are the same type, ignoring /* Returns nonzero iff TYPE1 and TYPE2 are the same type, ignoring
top-level qualifiers. */ top-level qualifiers. */
...@@ -3744,7 +3744,7 @@ enum overload_flags { NO_SPECIAL = 0, DTOR_FLAG, OP_FLAG, TYPENAME_FLAG }; ...@@ -3744,7 +3744,7 @@ enum overload_flags { NO_SPECIAL = 0, DTOR_FLAG, OP_FLAG, TYPENAME_FLAG };
#define WANT_VECTOR 32 /* vector types */ #define WANT_VECTOR 32 /* vector types */
#define WANT_ARITH (WANT_INT | WANT_FLOAT | WANT_VECTOR) #define WANT_ARITH (WANT_INT | WANT_FLOAT | WANT_VECTOR)
/* Used with cp_comptypes, and related functions, to guide type /* Used with comptypes, and related functions, to guide type
comparison. */ comparison. */
#define COMPARE_STRICT 0 /* Just check if the types are the #define COMPARE_STRICT 0 /* Just check if the types are the
...@@ -3780,7 +3780,7 @@ enum overload_flags { NO_SPECIAL = 0, DTOR_FLAG, OP_FLAG, TYPENAME_FLAG }; ...@@ -3780,7 +3780,7 @@ enum overload_flags { NO_SPECIAL = 0, DTOR_FLAG, OP_FLAG, TYPENAME_FLAG };
is derived from TYPE1, or if TYPE2 is a pointer (reference) to a is derived from TYPE1, or if TYPE2 is a pointer (reference) to a
class derived from the type pointed to (referred to) by TYPE1. */ class derived from the type pointed to (referred to) by TYPE1. */
#define same_or_base_type_p(TYPE1, TYPE2) \ #define same_or_base_type_p(TYPE1, TYPE2) \
cp_comptypes ((TYPE1), (TYPE2), COMPARE_BASE) comptypes ((TYPE1), (TYPE2), COMPARE_BASE)
/* These macros are used to access a TEMPLATE_PARM_INDEX. */ /* These macros are used to access a TEMPLATE_PARM_INDEX. */
#define TEMPLATE_PARM_INDEX_CAST(NODE) \ #define TEMPLATE_PARM_INDEX_CAST(NODE) \
...@@ -4765,7 +4765,7 @@ extern tree complete_type (tree); ...@@ -4765,7 +4765,7 @@ extern tree complete_type (tree);
extern tree complete_type_or_else (tree, tree); extern tree complete_type_or_else (tree, tree);
extern int type_unknown_p (const_tree); extern int type_unknown_p (const_tree);
extern bool comp_except_specs (const_tree, const_tree, bool); extern bool comp_except_specs (const_tree, const_tree, bool);
extern bool cp_comptypes (tree, tree, int); extern bool comptypes (tree, tree, int);
extern bool compparms (const_tree, const_tree); extern bool compparms (const_tree, const_tree);
extern int comp_cv_qualification (const_tree, const_tree); extern int comp_cv_qualification (const_tree, const_tree);
extern int comp_cv_qual_signature (tree, tree); extern int comp_cv_qual_signature (tree, tree);
......
...@@ -465,7 +465,7 @@ convert_to_reference (tree reftype, tree expr, int convtype, ...@@ -465,7 +465,7 @@ convert_to_reference (tree reftype, tree expr, int convtype,
/* B* bp; A& ar = (A&)bp; is valid, but it's probably not what they /* B* bp; A& ar = (A&)bp; is valid, but it's probably not what they
meant. */ meant. */
if (TREE_CODE (intype) == POINTER_TYPE if (TREE_CODE (intype) == POINTER_TYPE
&& (cp_comptypes (TREE_TYPE (intype), type, && (comptypes (TREE_TYPE (intype), type,
COMPARE_BASE | COMPARE_DERIVED))) COMPARE_BASE | COMPARE_DERIVED)))
warning (0, "casting %qT to %qT does not dereference pointer", warning (0, "casting %qT to %qT does not dereference pointer",
intype, reftype); intype, reftype);
...@@ -604,7 +604,7 @@ ocp_convert (tree type, tree expr, int convtype, int flags) ...@@ -604,7 +604,7 @@ ocp_convert (tree type, tree expr, int convtype, int flags)
/* The call to fold will not always remove the NOP_EXPR as /* The call to fold will not always remove the NOP_EXPR as
might be expected, since if one of the types is a typedef; might be expected, since if one of the types is a typedef;
the comparison in fold is just equality of pointers, not a the comparison in fold is just equality of pointers, not a
call to cp_comptypes. We don't call fold in this case because call to comptypes. We don't call fold in this case because
that can result in infinite recursion; fold will call that can result in infinite recursion; fold will call
convert, which will call ocp_convert, etc. */ convert, which will call ocp_convert, etc. */
return e; return e;
......
...@@ -1010,7 +1010,7 @@ decls_match (tree newdecl, tree olddecl) ...@@ -1010,7 +1010,7 @@ decls_match (tree newdecl, tree olddecl)
else if (TREE_TYPE (newdecl) == NULL_TREE) else if (TREE_TYPE (newdecl) == NULL_TREE)
types_match = 0; types_match = 0;
else else
types_match = cp_comptypes (TREE_TYPE (newdecl), types_match = comptypes (TREE_TYPE (newdecl),
TREE_TYPE (olddecl), TREE_TYPE (olddecl),
COMPARE_REDECLARATION); COMPARE_REDECLARATION);
} }
......
...@@ -2891,7 +2891,7 @@ canonical_type_parameter (tree type) ...@@ -2891,7 +2891,7 @@ canonical_type_parameter (tree type)
VEC_safe_push (tree, gc, canonical_template_parms, NULL_TREE); VEC_safe_push (tree, gc, canonical_template_parms, NULL_TREE);
list = VEC_index (tree, canonical_template_parms, idx); list = VEC_index (tree, canonical_template_parms, idx);
while (list && !cp_comptypes (type, TREE_VALUE (list), COMPARE_STRUCTURAL)) while (list && !comptypes (type, TREE_VALUE (list), COMPARE_STRUCTURAL))
list = TREE_CHAIN (list); list = TREE_CHAIN (list);
if (list) if (list)
......
...@@ -160,7 +160,7 @@ type_unknown_p (const_tree exp) ...@@ -160,7 +160,7 @@ type_unknown_p (const_tree exp)
/* Return the common type of two parameter lists. /* Return the common type of two parameter lists.
We assume that cp_comptypes has already been done and returned 1; We assume that comptypes has already been done and returned 1;
if that isn't so, this may crash. if that isn't so, this may crash.
As an optimization, free the space we allocate if the parameter As an optimization, free the space we allocate if the parameter
...@@ -573,7 +573,7 @@ composite_pointer_type (tree t1, tree t2, tree arg1, tree arg2, ...@@ -573,7 +573,7 @@ composite_pointer_type (tree t1, tree t2, tree arg1, tree arg2,
} }
/* Return the merged type of two types. /* Return the merged type of two types.
We assume that cp_comptypes has already been done and returned 1; We assume that comptypes has already been done and returned 1;
if that isn't so, this may crash. if that isn't so, this may crash.
This just combines attributes and default arguments; any other This just combines attributes and default arguments; any other
...@@ -735,7 +735,7 @@ merge_types (tree t1, tree t2) ...@@ -735,7 +735,7 @@ merge_types (tree t1, tree t2)
} }
/* Return the common type of two types. /* Return the common type of two types.
We assume that cp_comptypes has already been done and returned 1; We assume that comptypes has already been done and returned 1;
if that isn't so, this may crash. if that isn't so, this may crash.
This is the type for the result of most arithmetic operations This is the type for the result of most arithmetic operations
...@@ -926,7 +926,7 @@ comp_array_types (const_tree t1, const_tree t2, bool allow_redeclaration) ...@@ -926,7 +926,7 @@ comp_array_types (const_tree t1, const_tree t2, bool allow_redeclaration)
return true; return true;
} }
/* Subroutine in cp_comptypes. */ /* Subroutine in comptypes. */
static bool static bool
structural_comptypes (tree t1, tree t2, int strict) structural_comptypes (tree t1, tree t2, int strict)
...@@ -1034,7 +1034,7 @@ structural_comptypes (tree t1, tree t2, int strict) ...@@ -1034,7 +1034,7 @@ structural_comptypes (tree t1, tree t2, int strict)
return false; return false;
case OFFSET_TYPE: case OFFSET_TYPE:
if (!cp_comptypes (TYPE_OFFSET_BASETYPE (t1), TYPE_OFFSET_BASETYPE (t2), if (!comptypes (TYPE_OFFSET_BASETYPE (t1), TYPE_OFFSET_BASETYPE (t2),
strict & ~COMPARE_REDECLARATION)) strict & ~COMPARE_REDECLARATION))
return false; return false;
if (!same_type_p (TREE_TYPE (t1), TREE_TYPE (t2))) if (!same_type_p (TREE_TYPE (t1), TREE_TYPE (t2)))
...@@ -1123,22 +1123,11 @@ structural_comptypes (tree t1, tree t2, int strict) ...@@ -1123,22 +1123,11 @@ structural_comptypes (tree t1, tree t2, int strict)
return targetm.comp_type_attributes (t1, t2); return targetm.comp_type_attributes (t1, t2);
} }
extern int comptypes (tree, tree);
/* Type comparison function that matches the signature of comptypes
from c-tree.h, which is used by the C front end and some of the
C/C++ common bits. */
int
comptypes (tree t1, tree t2)
{
return cp_comptypes (t1, t2, COMPARE_STRICT);
}
/* Return true if T1 and T2 are related as allowed by STRICT. STRICT /* Return true if T1 and T2 are related as allowed by STRICT. STRICT
is a bitwise-or of the COMPARE_* flags. */ is a bitwise-or of the COMPARE_* flags. */
bool bool
cp_comptypes (tree t1, tree t2, int strict) comptypes (tree t1, tree t2, int strict)
{ {
if (strict == COMPARE_STRICT) if (strict == COMPARE_STRICT)
{ {
...@@ -1235,7 +1224,7 @@ comp_cv_qual_signature (tree type1, tree type2) ...@@ -1235,7 +1224,7 @@ comp_cv_qual_signature (tree type1, tree type2)
return 0; return 0;
} }
/* Subroutines of `cp_comptypes'. */ /* Subroutines of `comptypes'. */
/* Return true if two parameter type lists PARMS1 and PARMS2 are /* Return true if two parameter type lists PARMS1 and PARMS2 are
equivalent in the sense that functions with those parameter types equivalent in the sense that functions with those parameter types
...@@ -5264,7 +5253,7 @@ build_reinterpret_cast_1 (tree type, tree expr, bool c_cast_p, ...@@ -5264,7 +5253,7 @@ build_reinterpret_cast_1 (tree type, tree expr, bool c_cast_p,
"B" are related class types; the reinterpret_cast does not "B" are related class types; the reinterpret_cast does not
adjust the pointer. */ adjust the pointer. */
if (TYPE_PTR_P (intype) if (TYPE_PTR_P (intype)
&& (cp_comptypes (TREE_TYPE (intype), TREE_TYPE (type), && (comptypes (TREE_TYPE (intype), TREE_TYPE (type),
COMPARE_BASE | COMPARE_DERIVED))) COMPARE_BASE | COMPARE_DERIVED)))
warning (0, "casting %qT to %qT does not dereference pointer", warning (0, "casting %qT to %qT does not dereference pointer",
intype, type); intype, type);
...@@ -6923,7 +6912,7 @@ ptr_reasonably_similar (const_tree to, const_tree from) ...@@ -6923,7 +6912,7 @@ ptr_reasonably_similar (const_tree to, const_tree from)
return 0; return 0;
if (TREE_CODE (from) == OFFSET_TYPE if (TREE_CODE (from) == OFFSET_TYPE
&& cp_comptypes (TYPE_OFFSET_BASETYPE (to), && comptypes (TYPE_OFFSET_BASETYPE (to),
TYPE_OFFSET_BASETYPE (from), TYPE_OFFSET_BASETYPE (from),
COMPARE_BASE | COMPARE_DERIVED)) COMPARE_BASE | COMPARE_DERIVED))
continue; continue;
...@@ -6940,7 +6929,7 @@ ptr_reasonably_similar (const_tree to, const_tree from) ...@@ -6940,7 +6929,7 @@ ptr_reasonably_similar (const_tree to, const_tree from)
return 1; return 1;
if (TREE_CODE (to) != POINTER_TYPE) if (TREE_CODE (to) != POINTER_TYPE)
return cp_comptypes return comptypes
(TYPE_MAIN_VARIANT (to), TYPE_MAIN_VARIANT (from), (TYPE_MAIN_VARIANT (to), TYPE_MAIN_VARIANT (from),
COMPARE_BASE | COMPARE_DERIVED); COMPARE_BASE | COMPARE_DERIVED);
} }
......
2008-03-07 Paolo Bonzini <bonzini@gnu.org>
Revert:
2008-02-07 Andreas Tobler <andreast-list@fgznet.ch>
Douglas Gregor <doug.gregor@gmail.com>
PR bootstrap/35115
* objcp-decl.c (objcp_comptypes): Call cp_comptypes, not comptypes.
2008-02-07 Andreas Tobler <andreast-list@fgznet.ch> 2008-02-07 Andreas Tobler <andreast-list@fgznet.ch>
Douglas Gregor <doug.gregor@gmail.com> Douglas Gregor <doug.gregor@gmail.com>
......
...@@ -95,7 +95,7 @@ objcp_xref_tag (enum tree_code code ATTRIBUTE_UNUSED, tree name) ...@@ -95,7 +95,7 @@ objcp_xref_tag (enum tree_code code ATTRIBUTE_UNUSED, tree name)
int int
objcp_comptypes (tree type1, tree type2) objcp_comptypes (tree type1, tree type2)
{ {
return cp_comptypes (type1, type2, COMPARE_STRICT); return comptypes (type1, type2, COMPARE_STRICT);
} }
tree tree
......
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