This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
patch c++: opaque types for pointers
- From: Aldy Hernandez <aldyh at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org, jason at redhat dot com
- Date: Mon, 11 Aug 2003 18:12:52 -0400
- Subject: patch c++: opaque types for pointers
Yeah well, I forgot all about C++ when I wrote opaque support ;-).
This patch adds support for opaque pointers in C++.
Bootstrapped and regtested on x86 linux for C and C++ languages.
OK?
2003-08-11 Aldy Hernandez <aldyh@redhat.com>
* cp/call.c (standard_conversion): Opaque pointers interconvert.
* testsuite/g++.dg/other/opaque-3.C: New.
Index: cp/call.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/call.c,v
retrieving revision 1.418
diff -c -p -r1.418 call.c
*** cp/call.c 7 Aug 2003 12:49:56 -0000 1.418
--- cp/call.c 11 Aug 2003 20:51:39 -0000
*************** standard_conversion (tree to, tree from,
*** 647,652 ****
--- 647,658 ----
if ((tcode == POINTER_TYPE || TYPE_PTR_TO_MEMBER_P (to))
&& expr && null_ptr_cst_p (expr))
conv = build_conv (STD_CONV, to, conv);
+ else if (tcode == POINTER_TYPE && fcode == POINTER_TYPE
+ && TREE_CODE (TREE_TYPE (to)) == VECTOR_TYPE
+ && TREE_CODE (TREE_TYPE (from)) == VECTOR_TYPE
+ && ((*targetm.vector_opaque_p) (TREE_TYPE (to))
+ || (*targetm.vector_opaque_p) (TREE_TYPE (from))))
+ conv = build_conv (STD_CONV, to, conv);
else if ((tcode == INTEGER_TYPE && fcode == POINTER_TYPE)
|| (tcode == POINTER_TYPE && fcode == INTEGER_TYPE))
{
Index: testsuite/g++.dg/other/opaque-3.C
===================================================================
RCS file: testsuite/g++.dg/other/opaque-3.C
diff -N testsuite/g++.dg/other/opaque-3.C
*** /dev/null 1 Jan 1970 00:00:00 -0000
--- testsuite/g++.dg/other/opaque-3.C 11 Aug 2003 20:51:39 -0000
***************
*** 0 ****
--- 1,11 ----
+ /* { dg-do compile { target powerpc-*-eabi* } } */
+ /* { dg-options "-mcpu=8540 -mabi=spe" } */
+
+ __ev64_opaque__ o;
+ #define v __attribute__((vector_size(8)))
+ v unsigned int *p;
+
+ void m()
+ {
+ o = __builtin_spe_evldd(p, 5);
+ }