summaryrefslogtreecommitdiffstats
path: root/libstdc++-v3
diff options
context:
space:
mode:
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2006-01-18 11:22:10 +0000
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2006-01-18 11:22:10 +0000
commitc98ffa6dcde2172b9df8fca62162e71bc6c22371 (patch)
treef5eeca6e0ce57ed0dbc5bf6b1f539db803ed664c /libstdc++-v3
parent10c77d2b4d6c2244dd7fba02f80733c03c6c4b20 (diff)
downloadppe42-gcc-c98ffa6dcde2172b9df8fca62162e71bc6c22371.tar.gz
ppe42-gcc-c98ffa6dcde2172b9df8fca62162e71bc6c22371.zip
2006-01-18 Perry Smith <pedz@easesoftware.net>
PR libstdc++/25823 PR libstdc++/25824 * libsupc++/eh_alloc.cc: Fix return type of memset declaration. * libsupc++/eh_globals.cc: If !_GLIBCXX_HOSTED declare malloc and free. 2006-01-18 Paolo Carlini <pcarlini@suse.de> * include/ext/pb_assoc/detail/value_type_adapter/ value_type_adapter.hpp: Include <tr1/type_traits>. * include/ext/pb_assoc/detail/value_type_adapter/ it_value_type_traits.hpp (it_value_type_traits_<>::value_type_holder): Use tr1::aligned_storage and tr1::alignment_of. (it_value_type_traits_<>::buf_t): Remove. (it_value_type_traits_<>::make_valid, recast): Adjust. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@109883 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3')
-rw-r--r--libstdc++-v3/ChangeLog17
-rw-r--r--libstdc++-v3/include/ext/pb_assoc/detail/value_type_adapter/it_value_type_traits.hpp36
-rw-r--r--libstdc++-v3/include/ext/pb_assoc/detail/value_type_adapter/value_type_adapter.hpp3
-rw-r--r--libstdc++-v3/libsupc++/eh_alloc.cc5
-rw-r--r--libstdc++-v3/libsupc++/eh_globals.cc17
5 files changed, 51 insertions, 27 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 43cb2b73640..fdc3375003c 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,20 @@
+2006-01-18 Perry Smith <pedz@easesoftware.net>
+
+ PR libstdc++/25823
+ PR libstdc++/25824
+ * libsupc++/eh_alloc.cc: Fix return type of memset declaration.
+ * libsupc++/eh_globals.cc: If !_GLIBCXX_HOSTED declare malloc and free.
+
+2006-01-18 Paolo Carlini <pcarlini@suse.de>
+
+ * include/ext/pb_assoc/detail/value_type_adapter/
+ value_type_adapter.hpp: Include <tr1/type_traits>.
+ * include/ext/pb_assoc/detail/value_type_adapter/
+ it_value_type_traits.hpp (it_value_type_traits_<>::value_type_holder):
+ Use tr1::aligned_storage and tr1::alignment_of.
+ (it_value_type_traits_<>::buf_t): Remove.
+ (it_value_type_traits_<>::make_valid, recast): Adjust.
+
2006-01-16 Benjamin Kosnik <bkoz@redhat.com>
PR libstdc++/25797
diff --git a/libstdc++-v3/include/ext/pb_assoc/detail/value_type_adapter/it_value_type_traits.hpp b/libstdc++-v3/include/ext/pb_assoc/detail/value_type_adapter/it_value_type_traits.hpp
index c8b09d35154..4be113d8ecd 100644
--- a/libstdc++-v3/include/ext/pb_assoc/detail/value_type_adapter/it_value_type_traits.hpp
+++ b/libstdc++-v3/include/ext/pb_assoc/detail/value_type_adapter/it_value_type_traits.hpp
@@ -1,6 +1,6 @@
// -*- C++ -*-
-// Copyright (C) 2005 Free Software Foundation, Inc.
+// Copyright (C) 2005, 2006 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -94,16 +94,13 @@ struct it_value_type_traits_
value_type>::other::const_pointer
const_pointer;
- typedef
- typename Allocator_::template rebind<
- int* >::other::value_type
- buf_t;
-
struct value_type_holder
{
- buf_t m_a_key_buf[sizeof(key_ref_pair) / sizeof(buf_t) + 1];
+ typename std::tr1::aligned_storage<sizeof(key_ref_pair),
+ std::tr1::alignment_of<key_ref_pair>::value>::type m_a_key_buf;
- buf_t m_a_value_buf[sizeof(value_type) / sizeof(buf_t) + 1];
+ typename std::tr1::aligned_storage<sizeof(value_type),
+ std::tr1::alignment_of<value_type>::value>::type m_a_value_buf;
};
typedef
@@ -114,7 +111,7 @@ struct it_value_type_traits_
inline static pointer
recast(value_type_hoder_valerence r_holder)
{
- return reinterpret_cast<pointer>(r_holder.m_a_value_buf);
+ return reinterpret_cast<pointer>(&r_holder.m_a_value_buf);
}
inline static void
@@ -125,7 +122,7 @@ struct it_value_type_traits_
void* >::other::value_type
void_pointer;
- void_pointer p_target = r_holder.m_a_key_buf;
+ void_pointer p_target = &r_holder.m_a_key_buf;
new (p_target) key_ref_pair(r_bk, r_val.first);
@@ -135,9 +132,9 @@ struct it_value_type_traits_
key_ref_pair_pointer;
key_ref_pair_pointer p_key =
- reinterpret_cast<key_ref_pair_pointer>(r_holder.m_a_key_buf);
+ reinterpret_cast<key_ref_pair_pointer>(&r_holder.m_a_key_buf);
- p_target = r_holder.m_a_value_buf;
+ p_target = &r_holder.m_a_value_buf;
new (p_target) value_type(*p_key, r_val.second);
}
@@ -185,16 +182,13 @@ struct it_value_type_traits_<
value_type>::other::const_pointer
const_pointer;
- typedef
- typename Allocator_::template rebind<
- int* >::other::value_type
- buf_t;
-
struct value_type_holder
{
- buf_t m_a_key_buf[sizeof(key_ref_pair) / sizeof(buf_t) + 1];
+ typename std::tr1::aligned_storage<sizeof(key_ref_pair),
+ std::tr1::alignment_of<key_ref_pair>::value>::type m_a_key_buf;
- buf_t m_a_value_buf[sizeof(value_type) / sizeof(buf_t) + 1];
+ typename std::tr1::aligned_storage<sizeof(value_type),
+ std::tr1::alignment_of<value_type>::value>::type m_a_value_buf;
};
typedef
@@ -205,7 +199,7 @@ struct it_value_type_traits_<
inline static pointer
recast(value_type_hoder_valerence r_holder)
{
- return reinterpret_cast<pointer>(r_holder.m_a_value_buf);
+ return reinterpret_cast<pointer>(&r_holder.m_a_value_buf);
}
inline static void
@@ -216,7 +210,7 @@ struct it_value_type_traits_<
void* >::other::value_type
void_pointer;
- void_pointer p_target = r_holder.m_a_value_buf;
+ void_pointer p_target = &r_holder.m_a_value_buf;
new (p_target) key_ref_pair(r_bk, r_val.first);
}
diff --git a/libstdc++-v3/include/ext/pb_assoc/detail/value_type_adapter/value_type_adapter.hpp b/libstdc++-v3/include/ext/pb_assoc/detail/value_type_adapter/value_type_adapter.hpp
index 343d8610402..9f2dfb2fb6a 100644
--- a/libstdc++-v3/include/ext/pb_assoc/detail/value_type_adapter/value_type_adapter.hpp
+++ b/libstdc++-v3/include/ext/pb_assoc/detail/value_type_adapter/value_type_adapter.hpp
@@ -1,6 +1,6 @@
// -*- C++ -*-
-// Copyright (C) 2005 Free Software Foundation, Inc.
+// Copyright (C) 2005, 2006 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -51,6 +51,7 @@
#include <ext/pb_assoc/detail/type_utils.hpp>
#include <utility>
#include <algorithm>
+#include <tr1/type_traits> // for aligned_storage/alignment_of
namespace pb_assoc
{
diff --git a/libstdc++-v3/libsupc++/eh_alloc.cc b/libstdc++-v3/libsupc++/eh_alloc.cc
index b9097812a75..9a922af9c2a 100644
--- a/libstdc++-v3/libsupc++/eh_alloc.cc
+++ b/libstdc++-v3/libsupc++/eh_alloc.cc
@@ -1,5 +1,6 @@
// -*- C++ -*- Allocate exception objects.
-// Copyright (C) 2001, 2004, 2005 Free Software Foundation, Inc.
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006
+// Free Software Foundation, Inc.
//
// This file is part of GCC.
//
@@ -49,7 +50,7 @@ using std::memcpy;
// -- but for now, we assume that they are.
extern "C" void *malloc (std::size_t);
extern "C" void free(void *);
-extern "C" int memset (void *, int, std::size_t);
+extern "C" void *memset (void *, int, std::size_t);
#endif
using namespace __cxxabiv1;
diff --git a/libstdc++-v3/libsupc++/eh_globals.cc b/libstdc++-v3/libsupc++/eh_globals.cc
index 9b7e916716d..5f44e13a7a1 100644
--- a/libstdc++-v3/libsupc++/eh_globals.cc
+++ b/libstdc++-v3/libsupc++/eh_globals.cc
@@ -1,5 +1,6 @@
// -*- C++ -*- Manage the thread-local exception globals.
-// Copyright (C) 2001, 2004, 2005 Free Software Foundation, Inc.
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006
+// Free Software Foundation, Inc.
//
// This file is part of GCC.
//
@@ -34,6 +35,16 @@
#include "unwind-cxx.h"
#include "bits/gthr.h"
+#if _GLIBCXX_HOSTED
+using std::free;
+using std::malloc;
+#else
+// In a freestanding environment, these functions may not be
+// available -- but for now, we assume that they are.
+extern "C" void *malloc (std::size_t);
+extern "C" void free(void *);
+#endif
+
using namespace __cxxabiv1;
#if _GLIBCXX_HAVE_TLS
@@ -81,7 +92,7 @@ eh_globals_dtor(void* ptr)
_Unwind_DeleteException(&exn->unwindHeader);
exn = next;
}
- std::free(ptr);
+ free(ptr);
}
}
@@ -125,7 +136,7 @@ __cxxabiv1::__cxa_get_globals() throw()
g = static_cast<__cxa_eh_globals*>(__gthread_getspecific(init._M_key));
if (!g)
{
- void* v = std::malloc(sizeof(__cxa_eh_globals));
+ void* v = malloc(sizeof(__cxa_eh_globals));
if (v == 0 || __gthread_setspecific(init._M_key, v) != 0)
std::terminate();
g = static_cast<__cxa_eh_globals*>(v);
OpenPOWER on IntegriCloud