summaryrefslogtreecommitdiff
path: root/gnu/gcc/libstdc++-v3
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2010-05-26 11:23:08 +0000
committerMarc Espie <espie@cvs.openbsd.org>2010-05-26 11:23:08 +0000
commitdd1019fe6097646764d06cab8fcd7aa9aed4abbf (patch)
treeb319dd35476412f2a15eab80c5ada171acaaa5d1 /gnu/gcc/libstdc++-v3
parentd9807ca719bb5ff5661995719eaf1e513437c3c0 (diff)
make gcc4 lib sprintf/strcpy free.
activate proper C99 stuff. fix locale support when there's no locale. work common with kettenis@
Diffstat (limited to 'gnu/gcc/libstdc++-v3')
-rw-r--r--gnu/gcc/libstdc++-v3/config/locale/generic/c_locale.h5
-rw-r--r--gnu/gcc/libstdc++-v3/config/locale/gnu/c_locale.h5
-rw-r--r--gnu/gcc/libstdc++-v3/config/locale/gnu/messages_members.h5
-rw-r--r--gnu/gcc/libstdc++-v3/config/os/bsd/openbsd/ctype_inline.h4
-rw-r--r--gnu/gcc/libstdc++-v3/config/os/bsd/openbsd/os_defines.h2
-rw-r--r--gnu/gcc/libstdc++-v3/include/c_std/std_cwctype.h2
-rw-r--r--gnu/gcc/libstdc++-v3/include/ext/throw_allocator.h6
7 files changed, 16 insertions, 13 deletions
diff --git a/gnu/gcc/libstdc++-v3/config/locale/generic/c_locale.h b/gnu/gcc/libstdc++-v3/config/locale/generic/c_locale.h
index d180c205f1f..c236883c83b 100644
--- a/gnu/gcc/libstdc++-v3/config/locale/generic/c_locale.h
+++ b/gnu/gcc/libstdc++-v3/config/locale/generic/c_locale.h
@@ -68,8 +68,9 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
char* __sav = NULL;
if (std::strcmp(__old, "C"))
{
- __sav = new char[std::strlen(__old) + 1];
- std::strcpy(__sav, __old);
+ size_t __sz = std::strlen(__old) + 1;
+ __sav = new char[__sz];
+ std::memcpy(__sav, __old, __sz);
std::setlocale(LC_NUMERIC, "C");
}
diff --git a/gnu/gcc/libstdc++-v3/config/locale/gnu/c_locale.h b/gnu/gcc/libstdc++-v3/config/locale/gnu/c_locale.h
index f0b2b7dcaa2..b150c605740 100644
--- a/gnu/gcc/libstdc++-v3/config/locale/gnu/c_locale.h
+++ b/gnu/gcc/libstdc++-v3/config/locale/gnu/c_locale.h
@@ -82,8 +82,9 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
__c_locale __old = __gnu_cxx::__uselocale(__cloc);
#else
char* __old = std::setlocale(LC_ALL, NULL);
- char* __sav = new char[std::strlen(__old) + 1];
- std::strcpy(__sav, __old);
+ size_t __sz = std::strlen(__old) + 1;
+ char* __sav = new char[__sz];
+ std::memcpy(__sav, __old, __sz);
std::setlocale(LC_ALL, "C");
#endif
diff --git a/gnu/gcc/libstdc++-v3/config/locale/gnu/messages_members.h b/gnu/gcc/libstdc++-v3/config/locale/gnu/messages_members.h
index 31504e58bdc..dd2436d6b01 100644
--- a/gnu/gcc/libstdc++-v3/config/locale/gnu/messages_members.h
+++ b/gnu/gcc/libstdc++-v3/config/locale/gnu/messages_members.h
@@ -102,8 +102,9 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
{
if (this->_M_name_messages != locale::facet::_S_get_c_name())
delete [] this->_M_name_messages;
- char* __tmp = new char[std::strlen(__s) + 1];
- std::strcpy(__tmp, __s);
+ size_t __sz = std::strlen(__s) + 1;
+ char* __tmp = new char[__sz];
+ std::memcpy(__tmp, __s, __sz);
this->_M_name_messages = __tmp;
if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0)
diff --git a/gnu/gcc/libstdc++-v3/config/os/bsd/openbsd/ctype_inline.h b/gnu/gcc/libstdc++-v3/config/os/bsd/openbsd/ctype_inline.h
index a00104c3c04..f011c510cc1 100644
--- a/gnu/gcc/libstdc++-v3/config/os/bsd/openbsd/ctype_inline.h
+++ b/gnu/gcc/libstdc++-v3/config/os/bsd/openbsd/ctype_inline.h
@@ -44,14 +44,14 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
bool
ctype<char>::
is(mask __m, char __c) const
- { return _M_table[(unsigned char)(__c)] & __m; }
+ { return (_M_table ? _M_table : _ctype_ + 1)[(unsigned char)(__c)] & __m; }
const char*
ctype<char>::
is(const char* __low, const char* __high, mask* __vec) const
{
while (__low < __high)
- *__vec++ = _M_table[*__low++];
+ *__vec++ = (_M_table ? _M_table : _ctype_ + 1)[*__low++];
return __high;
}
diff --git a/gnu/gcc/libstdc++-v3/config/os/bsd/openbsd/os_defines.h b/gnu/gcc/libstdc++-v3/config/os/bsd/openbsd/os_defines.h
index 7f3e7d88c7a..0460690da5c 100644
--- a/gnu/gcc/libstdc++-v3/config/os/bsd/openbsd/os_defines.h
+++ b/gnu/gcc/libstdc++-v3/config/os/bsd/openbsd/os_defines.h
@@ -34,11 +34,13 @@
// System-specific #define, typedefs, corrections, etc, go here. This
// file will come before all others.
+#define _GLIBCXX_USE_C99 1
#define _GLIBCXX_USE_C99_CHECK 1
#define _GLIBCXX_USE_C99_DYNAMIC (!(__ISO_C_VISIBLE >= 1999))
#define _GLIBCXX_USE_C99_LONG_LONG_CHECK 1
#define _GLIBCXX_USE_C99_LONG_LONG_DYNAMIC (_GLIBCXX_USE_C99_DYNAMIC || !defined __LONG_LONG_SUPPORTED)
#define _GLIBCXX_USE_C99_FLOAT_TRANSCENDENTALS_CHECK 1
#define _GLIBCXX_USE_C99_FLOAT_TRANSCENDENTALS_DYNAMIC defined _XOPEN_SOURCE
+typedef __builtin_va_list __gnuc_va_list;
#endif
diff --git a/gnu/gcc/libstdc++-v3/include/c_std/std_cwctype.h b/gnu/gcc/libstdc++-v3/include/c_std/std_cwctype.h
index d128e04ab1f..dd0032f3dd6 100644
--- a/gnu/gcc/libstdc++-v3/include/c_std/std_cwctype.h
+++ b/gnu/gcc/libstdc++-v3/include/c_std/std_cwctype.h
@@ -81,7 +81,6 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
using ::wint_t; // cwchar
-#if !defined(__OpenBSD__)
using ::wctype_t;
using ::wctrans_t;
@@ -105,7 +104,6 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
using ::towupper;
using ::wctrans;
using ::wctype;
-#endif
_GLIBCXX_END_NAMESPACE
diff --git a/gnu/gcc/libstdc++-v3/include/ext/throw_allocator.h b/gnu/gcc/libstdc++-v3/include/ext/throw_allocator.h
index 5886afc7989..53278f87d82 100644
--- a/gnu/gcc/libstdc++-v3/include/ext/throw_allocator.h
+++ b/gnu/gcc/libstdc++-v3/include/ext/throw_allocator.h
@@ -419,15 +419,15 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
char buf[40];
const char tab('\t');
s += "address: ";
- sprintf(buf, "%p", ref.first);
+ snprintf(buf, sizeof buf, "%p", ref.first);
s += buf;
s += tab;
s += "label: ";
- sprintf(buf, "%u", ref.second.first);
+ snprintf(buf, sizeof buf, "%u", ref.second.first);
s += buf;
s += tab;
s += "size: ";
- sprintf(buf, "%u", ref.second.second);
+ snprintf(buf, sizeof buf, "%u", ref.second.second);
s += buf;
s += '\n';
}