From 47bedfb079ef53e4d072174d704f99dc96e6404d Mon Sep 17 00:00:00 2001 From: Paul Brook Date: Thu, 12 Aug 2004 18:50:38 +0000 Subject: [PATCH] cxxabi_tweaks.h: Define __cxa_vec_ctor_return and _GLIBCXX_CXA_VEC_CTOR_RETURN. * config/cpu/arm/cxxabi_tweaks.h: Define __cxa_vec_ctor_return and _GLIBCXX_CXA_VEC_CTOR_RETURN. * config/cpu/generic/cxxabi_tweaks.h: Ditto. * libsupc++/cxxabi.h (__cxa_vec_ctor, __cxa_vec_cctor): Use __cxa_vec_ctor_return. * libsupc++/vec.cc (__cxa_vec_ctor, __cxa_vec_cctor): Ditto. Use _GLIBCXX_CXA_VEC_CTOR_RETURN. * g++.dg/abi/arm_cxa_vec_1.C: New test. From-SVN: r85891 --- gcc/testsuite/ChangeLog | 4 +++ gcc/testsuite/g++.dg/abi/arm_cxa_vec1.C | 32 +++++++++++++++++++ libstdc++-v3/ChangeLog | 10 ++++++ libstdc++-v3/config/cpu/arm/cxxabi_tweaks.h | 14 ++++++-- .../config/cpu/generic/cxxabi_tweaks.h | 4 +++ libstdc++-v3/libsupc++/cxxabi.h | 4 +-- libstdc++-v3/libsupc++/vec.cc | 6 ++-- 7 files changed, 68 insertions(+), 6 deletions(-) create mode 100644 gcc/testsuite/g++.dg/abi/arm_cxa_vec1.C diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 2400d1dd16c..9256ed9fd45 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2004-08-12 Paul Brook + + * g++.dg/abi/arm_cxa_vec_1.C: New test. + 2004-08-12 Janis Johnson * g++.dg/ext/altivec-2.C: Check for hardware support before diff --git a/gcc/testsuite/g++.dg/abi/arm_cxa_vec1.C b/gcc/testsuite/g++.dg/abi/arm_cxa_vec1.C new file mode 100644 index 00000000000..da66a73fa92 --- /dev/null +++ b/gcc/testsuite/g++.dg/abi/arm_cxa_vec1.C @@ -0,0 +1,32 @@ +// Check that __cxa_vec_[c]ctor returns a pointer to the array +// { dg-do run { target arm*-*-* xscale*-*-* } } + +#include + +#ifdef ___ARM_EABI__ +static void cctor (void * a, void * b) +{ + *(char *) a = *(char *) b +} + +int main() +{ + char data; + char data2; + char *p; + + p = __cxa_vec_ctor (&data, 1, 1, NULL, NULL); + if (p != &data) + return 1; + p = __cxa_vec_cctor (&data2, &data, 1, 1, cctor, NULL); + if (p != &data2) + return 1; + + return 0; +} +#else +int main() +{ + return 0; +} +#endif diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 06db841d65f..a4474c9dcad 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,13 @@ +2004-08-12 Paul Brook + + * config/cpu/arm/cxxabi_tweaks.h: Define __cxa_vec_ctor_return and + _GLIBCXX_CXA_VEC_CTOR_RETURN. + * config/cpu/generic/cxxabi_tweaks.h: Ditto. + * libsupc++/cxxabi.h (__cxa_vec_ctor, __cxa_vec_cctor): Use + __cxa_vec_ctor_return. + * libsupc++/vec.cc (__cxa_vec_ctor, __cxa_vec_cctor): Ditto. + Use _GLIBCXX_CXA_VEC_CTOR_RETURN. + 2004-08-12 Kelley Cook * Makefile.in, aclocal.m4, configure, include/Makefile.in, diff --git a/libstdc++-v3/config/cpu/arm/cxxabi_tweaks.h b/libstdc++-v3/config/cpu/arm/cxxabi_tweaks.h index 9dd9435c90e..95fe12c9d8f 100644 --- a/libstdc++-v3/config/cpu/arm/cxxabi_tweaks.h +++ b/libstdc++-v3/config/cpu/arm/cxxabi_tweaks.h @@ -45,12 +45,22 @@ namespace __cxxabiv1 // We also want the element size in array cookies. #define _GLIBCXX_ELTSIZE_IN_COOKIE 1 -#else + // __cxa_vec_ctor should return a pointer to the array. + typedef void * __cxa_vec_ctor_return_type; +#define _GLIBCXX_CXA_VEC_CTOR_RETURN(x) return x + +#else // __ARM_EABI__ + // The generic ABI uses the first byte of a 64-bit guard variable. #define _GLIBCXX_GUARD_ACQUIRE(x) (!*(char *) (x)) #define _GLIBCXX_GUARD_RELEASE(x) *(char *) (x) = 1 __extension__ typedef int __guard __attribute__((mode (__DI__))); -#endif + + // __cxa_vec_ctor has void return type. + typedef void __cxa_vec_ctor_return_type; +#define _GLIBCXX_CXA_VEC_CTOR_RETURN(x) return + +#endif //!__ARM_EABI__ #ifdef __cplusplus } // namespace __cxxabiv1 diff --git a/libstdc++-v3/config/cpu/generic/cxxabi_tweaks.h b/libstdc++-v3/config/cpu/generic/cxxabi_tweaks.h index 983be135be1..48a0dec568b 100644 --- a/libstdc++-v3/config/cpu/generic/cxxabi_tweaks.h +++ b/libstdc++-v3/config/cpu/generic/cxxabi_tweaks.h @@ -40,6 +40,10 @@ namespace __cxxabiv1 #define _GLIBCXX_GUARD_RELEASE(x) *(char *) (x) = 1 __extension__ typedef int __guard __attribute__((mode (__DI__))); + // __cxa_vec_ctor has void return type. + typedef void __cxa_vec_ctor_return_type; +#define _GLIBCXX_CXA_VEC_CTOR_RETURN(x) return + #ifdef __cplusplus } // namespace __cxxabiv1 #endif diff --git a/libstdc++-v3/libsupc++/cxxabi.h b/libstdc++-v3/libsupc++/cxxabi.h index b85019588df..dfed54e69ee 100644 --- a/libstdc++-v3/libsupc++/cxxabi.h +++ b/libstdc++-v3/libsupc++/cxxabi.h @@ -73,12 +73,12 @@ namespace __cxxabiv1 void (*__dealloc) (void*, size_t)); // Construct array. - void + __cxa_vec_ctor_return_type __cxa_vec_ctor(void* __array_address, size_t __element_count, size_t __element_size, void (*__constructor) (void*), void (*__destructor) (void*)); - void + __cxa_vec_ctor_return_type __cxa_vec_cctor(void* dest_array, void* src_array, size_t element_count, size_t element_size, void (*constructor) (void*, void*), void (*destructor) (void*)); diff --git a/libstdc++-v3/libsupc++/vec.cc b/libstdc++-v3/libsupc++/vec.cc index 7681acc7729..2708c19aca9 100644 --- a/libstdc++-v3/libsupc++/vec.cc +++ b/libstdc++-v3/libsupc++/vec.cc @@ -155,7 +155,7 @@ namespace __cxxabiv1 } // Construct array. - extern "C" void + extern "C" __cxa_vec_ctor_return_type __cxa_vec_ctor(void *array_address, std::size_t element_count, std::size_t element_size, @@ -179,10 +179,11 @@ namespace __cxxabiv1 } __throw_exception_again; } + _GLIBCXX_CXA_VEC_CTOR_RETURN (array_address); } // Construct an array by copying. - extern "C" void + extern "C" __cxa_vec_ctor_return_type __cxa_vec_cctor(void *dest_array, void *src_array, std::size_t element_count, @@ -209,6 +210,7 @@ namespace __cxxabiv1 } __throw_exception_again; } + _GLIBCXX_CXA_VEC_CTOR_RETURN (dest_array); } // Destruct array. -- 2.30.2