Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/external/bsd/libc++/dist/libcxxrt/src Import new snapshot of...
details: https://anonhg.NetBSD.org/src/rev/ce666fe7d963
branches: trunk
changeset: 325457:ce666fe7d963
user: joerg <joerg%NetBSD.org@localhost>
date: Wed Dec 25 20:19:45 2013 +0000
description:
Import new snapshot of libcxxrt. Fixes demangling of anonymous
namespaces. Avoid use of old style (C) casts.
diffstat:
external/bsd/libc++/dist/libcxxrt/src/atomic.h | 4 +-
external/bsd/libc++/dist/libcxxrt/src/cxxabi.h | 1 +
external/bsd/libc++/dist/libcxxrt/src/dwarf_eh.h | 58 +++---
external/bsd/libc++/dist/libcxxrt/src/dynamic_cast.cc | 10 +-
external/bsd/libc++/dist/libcxxrt/src/exception.cc | 109 +++++++------
external/bsd/libc++/dist/libcxxrt/src/guard.cc | 6 +-
external/bsd/libc++/dist/libcxxrt/src/libelftc_dem_gnu3.c | 76 +++++++-
external/bsd/libc++/dist/libcxxrt/src/typeinfo.cc | 13 +-
external/bsd/libc++/dist/libcxxrt/src/unwind-arm.h | 2 +-
external/bsd/libc++/dist/libcxxrt/src/unwind-itanium.h | 2 +-
10 files changed, 172 insertions(+), 109 deletions(-)
diffs (truncated from 824 to 300 lines):
diff -r c3f7aac06418 -r ce666fe7d963 external/bsd/libc++/dist/libcxxrt/src/atomic.h
--- a/external/bsd/libc++/dist/libcxxrt/src/atomic.h Wed Dec 25 19:42:23 2013 +0000
+++ b/external/bsd/libc++/dist/libcxxrt/src/atomic.h Wed Dec 25 20:19:45 2013 +0000
@@ -11,7 +11,7 @@
*/
#if __has_builtin(__c11_atomic_exchange)
#define ATOMIC_SWAP(addr, val)\
- __c11_atomic_exchange((_Atomic(__typeof__(val))*)addr, val, __ATOMIC_ACQ_REL)
+ __c11_atomic_exchange(reinterpret_cast<_Atomic(__typeof__(val))*>(addr), val, __ATOMIC_ACQ_REL)
#elif __has_builtin(__sync_swap)
#define ATOMIC_SWAP(addr, val)\
__sync_swap(addr, val)
@@ -22,7 +22,7 @@
#if __has_builtin(__c11_atomic_load)
#define ATOMIC_LOAD(addr)\
- __c11_atomic_load((_Atomic(__typeof__(*addr))*)addr, __ATOMIC_ACQUIRE)
+ __c11_atomic_load(reinterpret_cast<_Atomic(__typeof__(*addr))*>(addr), __ATOMIC_ACQUIRE)
#else
#define ATOMIC_LOAD(addr)\
(__sync_synchronize(), *addr)
diff -r c3f7aac06418 -r ce666fe7d963 external/bsd/libc++/dist/libcxxrt/src/cxxabi.h
--- a/external/bsd/libc++/dist/libcxxrt/src/cxxabi.h Wed Dec 25 19:42:23 2013 +0000
+++ b/external/bsd/libc++/dist/libcxxrt/src/cxxabi.h Wed Dec 25 20:19:45 2013 +0000
@@ -22,6 +22,7 @@
#ifndef __CXXABI_H_
#define __CXXABI_H_
+#include <stddef.h>
#include <stdint.h>
#include "unwind.h"
namespace std
diff -r c3f7aac06418 -r ce666fe7d963 external/bsd/libc++/dist/libcxxrt/src/dwarf_eh.h
--- a/external/bsd/libc++/dist/libcxxrt/src/dwarf_eh.h Wed Dec 25 19:42:23 2013 +0000
+++ b/external/bsd/libc++/dist/libcxxrt/src/dwarf_eh.h Wed Dec 25 20:19:45 2013 +0000
@@ -83,7 +83,7 @@
*/
static inline enum dwarf_data_encoding get_encoding(unsigned char x)
{
- return (enum dwarf_data_encoding)(x & 0xf);
+ return static_cast<enum dwarf_data_encoding>(x & 0xf);
}
/**
@@ -115,7 +115,7 @@
*/
static inline enum dwarf_data_relative get_base(unsigned char x)
{
- return (enum dwarf_data_relative)(x & 0x70);
+ return static_cast<enum dwarf_data_relative>(x & 0x70);
}
/**
* Returns whether an encoding represents an indirect address.
@@ -206,9 +206,9 @@
if ((uleb >> (bits-1)) == 1)
{
// Sign extend by setting all bits in front of it to 1
- uleb |= ((int64_t)-1) << bits;
+ uleb |= static_cast<int64_t>(-1) << bits;
}
- return (int64_t)uleb;
+ return static_cast<int64_t>(uleb);
}
/**
* Reads a value using the specified encoding from the address pointed to by
@@ -224,7 +224,7 @@
// Read fixed-length types
#define READ(dwarf, type) \
case dwarf:\
- v = (uint64_t)(*(type*)(*data));\
+ v = static_cast<uint64_t>(*reinterpret_cast<type*>(*data));\
*data += sizeof(type);\
break;
READ(DW_EH_PE_udata2, uint16_t)
@@ -263,16 +263,16 @@
switch (get_base(encoding))
{
case DW_EH_PE_pcrel:
- v += (uint64_t)start;
+ v += reinterpret_cast<uint64_t>(start);
break;
case DW_EH_PE_textrel:
- v += (uint64_t)_Unwind_GetTextRelBase(c);
+ v += static_cast<uint64_t>(static_cast<uintptr_t>(_Unwind_GetTextRelBase(c)));
break;
case DW_EH_PE_datarel:
- v += (uint64_t)_Unwind_GetDataRelBase(c);
+ v += static_cast<uint64_t>(static_cast<uintptr_t>(_Unwind_GetDataRelBase(c)));
break;
case DW_EH_PE_funcrel:
- v += (uint64_t)_Unwind_GetRegionStart(c);
+ v += static_cast<uint64_t>(static_cast<uintptr_t>(_Unwind_GetRegionStart(c)));
default:
break;
}
@@ -282,7 +282,7 @@
// be a GCC extensions, so not properly documented...
if (is_indirect(encoding))
{
- v = (uint64_t)(uintptr_t)*(void**)v;
+ v = static_cast<uint64_t>(reinterpret_cast<uintptr_t>(*reinterpret_cast<void**>(v)));
}
return v;
}
@@ -342,14 +342,14 @@
{
struct dwarf_eh_lsda lsda;
- lsda.region_start = (dw_eh_ptr_t)(uintptr_t)_Unwind_GetRegionStart(context);
+ lsda.region_start = reinterpret_cast<dw_eh_ptr_t>(_Unwind_GetRegionStart(context));
// If the landing pads are relative to anything other than the start of
// this region, find out where. This is @LPStart in the spec, although the
// encoding that GCC uses does not quite match the spec.
- uint64_t v = (uint64_t)(uintptr_t)lsda.region_start;
+ uint64_t v = static_cast<uint64_t>(reinterpret_cast<uintptr_t>(lsda.region_start));
read_value_with_encoding(context, &data, &v);
- lsda.landing_pads = (dw_eh_ptr_t)(uintptr_t)v;
+ lsda.landing_pads = reinterpret_cast<dw_eh_ptr_t>(static_cast<uintptr_t>(v));
// If there is a type table, find out where it is. This is @TTBase in the
// spec. Note: we find whether there is a type table pointer by checking
@@ -369,14 +369,14 @@
lsda.type_table_encoding = (DW_EH_PE_pcrel | DW_EH_PE_indirect);
#endif
- lsda.callsite_encoding = (enum dwarf_data_encoding)(*(data++));
+ lsda.callsite_encoding = static_cast<enum dwarf_data_encoding>(*(data++));
// Action table is immediately after the call site table
lsda.action_table = data;
- uintptr_t callsite_size = (uintptr_t)read_uleb128(&data);
+ uintptr_t callsite_size = static_cast<uintptr_t>(read_uleb128(&data));
lsda.action_table = data + callsite_size;
// Call site table is immediately after the header
- lsda.call_site_table = (dw_eh_ptr_t)data;
+ lsda.call_site_table = static_cast<dw_eh_ptr_t>(data);
return lsda;
@@ -413,7 +413,7 @@
result->landing_pad = 0;
// The current instruction pointer offset within the region
uint64_t ip = _Unwind_GetIP(context) - _Unwind_GetRegionStart(context);
- unsigned char *callsite_table = (unsigned char*)lsda->call_site_table;
+ unsigned char *callsite_table = static_cast<unsigned char*>(lsda->call_site_table);
while (callsite_table <= lsda->action_table)
{
@@ -463,17 +463,17 @@
/// Defines an exception class from 8 bytes (endian independent)
#define EXCEPTION_CLASS(a,b,c,d,e,f,g,h) \
- (((uint64_t)a << 56) +\
- ((uint64_t)b << 48) +\
- ((uint64_t)c << 40) +\
- ((uint64_t)d << 32) +\
- ((uint64_t)e << 24) +\
- ((uint64_t)f << 16) +\
- ((uint64_t)g << 8) +\
- ((uint64_t)h))
+ ((static_cast<uint64_t>(a) << 56) +\
+ (static_cast<uint64_t>(b) << 48) +\
+ (static_cast<uint64_t>(c) << 40) +\
+ (static_cast<uint64_t>(d) << 32) +\
+ (static_cast<uint64_t>(e) << 24) +\
+ (static_cast<uint64_t>(f) << 16) +\
+ (static_cast<uint64_t>(g) << 8) +\
+ (static_cast<uint64_t>(h)))
#define GENERIC_EXCEPTION_CLASS(e,f,g,h) \
- ((uint32_t)e << 24) +\
- ((uint32_t)f << 16) +\
- ((uint32_t)g << 8) +\
- ((uint32_t)h)
+ (static_cast<uint32_t>(e) << 24) +\
+ (static_cast<uint32_t>(f) << 16) +\
+ (static_cast<uint32_t>(g) << 8) +\
+ (static_cast<uint32_t>(h))
diff -r c3f7aac06418 -r ce666fe7d963 external/bsd/libc++/dist/libcxxrt/src/dynamic_cast.cc
--- a/external/bsd/libc++/dist/libcxxrt/src/dynamic_cast.cc Wed Dec 25 19:42:23 2013 +0000
+++ b/external/bsd/libc++/dist/libcxxrt/src/dynamic_cast.cc Wed Dec 25 20:19:45 2013 +0000
@@ -44,7 +44,7 @@
* Simple macro that does pointer arithmetic in bytes but returns a value of
* the same type as the original.
*/
-#define ADD_TO_PTR(x, off) (__typeof__(x))(((char*)x) + off)
+#define ADD_TO_PTR(x, off) reinterpret_cast<__typeof__(x)>(reinterpret_cast<char*>(x) + off)
bool std::type_info::__do_catch(std::type_info const *ex_type,
void **exception_object,
@@ -166,7 +166,7 @@
if (info->isVirtual())
{
// Object's vtable
- ptrdiff_t *off = *(ptrdiff_t**)obj;
+ ptrdiff_t *off = *static_cast<ptrdiff_t**>(obj);
// Offset location in vtable
off = ADD_TO_PTR(off, offset);
offset = *off;
@@ -202,9 +202,9 @@
const __class_type_info *dst,
ptrdiff_t src2dst_offset)
{
- char *vtable_location = *(char**)sub;
+ const char *vtable_location = *static_cast<const char * const *>(sub);
const vtable_header *header =
- (const vtable_header*)(vtable_location - sizeof(vtable_header));
- void *leaf = ADD_TO_PTR((void*)sub, header->leaf_offset);
+ reinterpret_cast<const vtable_header*>(vtable_location - sizeof(vtable_header));
+ void *leaf = ADD_TO_PTR(const_cast<void *>(sub), header->leaf_offset);
return header->type->cast_to(leaf, dst);
}
diff -r c3f7aac06418 -r ce666fe7d963 external/bsd/libc++/dist/libcxxrt/src/exception.cc
--- a/external/bsd/libc++/dist/libcxxrt/src/exception.cc Wed Dec 25 19:42:23 2013 +0000
+++ b/external/bsd/libc++/dist/libcxxrt/src/exception.cc Wed Dec 25 20:19:45 2013 +0000
@@ -74,8 +74,8 @@
#ifdef __arm__
// On ARM, we store the saved exception in the generic part of the structure
ucb->barrier_cache.sp = _Unwind_GetGR(context, 13);
- ucb->barrier_cache.bitpattern[1] = (uint32_t)selector;
- ucb->barrier_cache.bitpattern[3] = (uint32_t)landingPad;
+ ucb->barrier_cache.bitpattern[1] = static_cast<uint32_t>(selector);
+ ucb->barrier_cache.bitpattern[3] = reinterpret_cast<uint32_t>(landingPad);
#endif
// Cache the results for the phase 2 unwind, if we found a handler
// and this is not a foreign exception.
@@ -97,13 +97,13 @@
{
#ifdef __arm__
*selector = ucb->barrier_cache.bitpattern[1];
- *landingPad = (dw_eh_ptr_t)ucb->barrier_cache.bitpattern[3];
+ *landingPad = reinterpret_cast<dw_eh_ptr_t>(ucb->barrier_cache.bitpattern[3]);
return 1;
#else
if (ex)
{
*selector = ex->handlerSwitchValue;
- *landingPad = (dw_eh_ptr_t)ex->catchTemp;
+ *landingPad = reinterpret_cast<dw_eh_ptr_t>(ex->catchTemp);
return 0;
}
return 0;
@@ -267,13 +267,13 @@
static __cxa_exception *exceptionFromPointer(void *ex)
{
- return (__cxa_exception*)((char*)ex -
+ return reinterpret_cast<__cxa_exception*>(static_cast<char*>(ex) -
offsetof(struct __cxa_exception, unwindHeader));
}
static __cxa_exception *realExceptionFromException(__cxa_exception *ex)
{
if (!isDependentException(ex->unwindHeader.exception_class)) { return ex; }
- return ((__cxa_exception*)(((__cxa_dependent_exception*)ex)->primaryException))-1;
+ return reinterpret_cast<__cxa_exception*>((reinterpret_cast<__cxa_dependent_exception*>(ex))->primaryException)-1;
}
@@ -304,13 +304,13 @@
static void exception_cleanup(_Unwind_Reason_Code reason,
struct _Unwind_Exception *ex)
{
- __cxa_free_exception((void*)ex);
+ __cxa_free_exception(static_cast<void*>(ex));
}
static void dependent_exception_cleanup(_Unwind_Reason_Code reason,
struct _Unwind_Exception *ex)
{
- __cxa_free_dependent_exception((void*)ex);
+ __cxa_free_dependent_exception(static_cast<void*>(ex));
}
/**
@@ -333,13 +333,13 @@
*/
static void thread_cleanup(void* thread_info)
{
- __cxa_thread_info *info = (__cxa_thread_info*)thread_info;
+ __cxa_thread_info *info = static_cast<__cxa_thread_info*>(thread_info);
if (info->globals.caughtExceptions)
{
// If this is a foreign exception, ask it to clean itself up.
if (info->foreign_exception_state != __cxa_thread_info::none)
{
- _Unwind_Exception *e = (_Unwind_Exception*)info->globals.caughtExceptions;
+ _Unwind_Exception *e = reinterpret_cast<_Unwind_Exception*>(info->globals.caughtExceptions);
e->exception_cleanup(_URC_FOREIGN_EXCEPTION_CAUGHT, e);
}
else
@@ -379,8 +379,8 @@
return;
}
pthread_key_create(&eh_key, thread_cleanup);
- pthread_setspecific(eh_key, (void*)0x42);
- fakeTLS = (pthread_getspecific(eh_key) != (void*)0x42);
+ pthread_setspecific(eh_key, reinterpret_cast<void *>(0x42));
+ fakeTLS = (pthread_getspecific(eh_key) != reinterpret_cast<void *>(0x42));
pthread_setspecific(eh_key, 0);
Home |
Main Index |
Thread Index |
Old Index