aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Tobler <andreast@gcc.gnu.org>2015-11-14 22:17:24 +0100
committerAndreas Tobler <andreast@gcc.gnu.org>2015-11-14 22:17:24 +0100
commit301d1d00e6313f78b09bcd1dc18fe9d30e85326b (patch)
treee6096ad12e7ffc9bada269eff97eb55da98962c3
parent38e5f0454c22a422f0aa2e5f2ec2962baa6427ab (diff)
downloadgcc-301d1d00e6313f78b09bcd1dc18fe9d30e85326b.zip
gcc-301d1d00e6313f78b09bcd1dc18fe9d30e85326b.tar.gz
gcc-301d1d00e6313f78b09bcd1dc18fe9d30e85326b.tar.bz2
acinclude.m4 (GLIBCXX_ENABLE_CLOCALE): Change locale implementation from darwin to DragonFly.
2015-11-14 Andreas Tobler <andreast@gcc.gnu.org> * acinclude.m4 (GLIBCXX_ENABLE_CLOCALE): Change locale implementation from darwin to DragonFly. * configure: Regenerate. * config/os/bsd/freebsd/ctype_configure_char.cc: Improve locale support, do it the same as DragonFly. * config/os/bsd/freebsd/os_defines.h: Add fine grained C99 defines. From-SVN: r230383
-rw-r--r--libstdc++-v3/ChangeLog9
-rw-r--r--libstdc++-v3/acinclude.m48
-rw-r--r--libstdc++-v3/config/os/bsd/freebsd/ctype_configure_char.cc68
-rw-r--r--libstdc++-v3/config/os/bsd/freebsd/os_defines.h4
-rwxr-xr-xlibstdc++-v3/configure12
5 files changed, 71 insertions, 30 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 6f5eceb..942e418 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,12 @@
+2015-11-14 Andreas Tobler <andreast@gcc.gnu.org>
+
+ * acinclude.m4 (GLIBCXX_ENABLE_CLOCALE): Change locale implementation
+ from darwin to DragonFly.
+ * configure: Regenerate.
+ * config/os/bsd/freebsd/ctype_configure_char.cc: Improve locale
+ support, do it the same as DragonFly.
+ * config/os/bsd/freebsd/os_defines.h: Add fine grained C99 defines.
+
2015-11-14 Jonathan Wakely <jwakely@redhat.com>
* testsuite/21_strings/basic_string/capacity/char/18654.cc: Use
diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4
index deefa04..e6575ea 100644
--- a/libstdc++-v3/acinclude.m4
+++ b/libstdc++-v3/acinclude.m4
@@ -2236,10 +2236,10 @@ AC_DEFUN([GLIBCXX_ENABLE_CLOCALE], [
linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu)
enable_clocale_flag=gnu
;;
- darwin* | freebsd*)
+ darwin*)
enable_clocale_flag=darwin
;;
- dragonfly*)
+ dragonfly* | freebsd*)
enable_clocale_flag=dragonfly
;;
openbsd*)
@@ -2318,7 +2318,7 @@ AC_DEFUN([GLIBCXX_ENABLE_CLOCALE], [
CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
;;
darwin)
- AC_MSG_RESULT(darwin or freebsd)
+ AC_MSG_RESULT(darwin)
CLOCALE_H=config/locale/generic/c_locale.h
CLOCALE_CC=config/locale/generic/c_locale.cc
@@ -2335,7 +2335,7 @@ AC_DEFUN([GLIBCXX_ENABLE_CLOCALE], [
;;
dragonfly)
- AC_MSG_RESULT(dragonfly)
+ AC_MSG_RESULT(dragonfly or freebsd)
CLOCALE_H=config/locale/dragonfly/c_locale.h
CLOCALE_CC=config/locale/dragonfly/c_locale.cc
diff --git a/libstdc++-v3/config/os/bsd/freebsd/ctype_configure_char.cc b/libstdc++-v3/config/os/bsd/freebsd/ctype_configure_char.cc
index 9a57abe..b1c24a2e 100644
--- a/libstdc++-v3/config/os/bsd/freebsd/ctype_configure_char.cc
+++ b/libstdc++-v3/config/os/bsd/freebsd/ctype_configure_char.cc
@@ -1,6 +1,6 @@
// Locale support -*- C++ -*-
-// Copyright (C) 2011-2015 Free Software Foundation, Inc.
+// Copyright (C) 2014-2015 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
@@ -37,32 +37,60 @@ namespace std _GLIBCXX_VISIBILITY(default)
_GLIBCXX_BEGIN_NAMESPACE_VERSION
// Information as gleaned from /usr/include/ctype.h
-
+
const ctype_base::mask*
ctype<char>::classic_table() throw()
- { return 0; }
-
- ctype<char>::ctype(__c_locale, const mask* __table, bool __del,
- size_t __refs)
- : facet(__refs), _M_del(__table != 0 && __del),
- _M_toupper(NULL), _M_tolower(NULL),
- _M_table(__table ? __table : classic_table())
- {
+ { return NULL; }
+
+ ctype<char>::ctype(__c_locale, const mask* __table, bool __del,
+ size_t __refs)
+ : facet(__refs), _M_c_locale_ctype(_S_get_c_locale()),
+ _M_del(__table != 0 && __del), _M_widen_ok(0), _M_narrow_ok(0)
+ {
+ char* __old = setlocale(LC_CTYPE, NULL);
+ char* __sav = NULL;
+ if (strcmp(__old, "C"))
+ {
+ const size_t __len = strlen(__old) + 1;
+ __sav = new char[__len];
+ memcpy(__sav, __old, __len);
+ setlocale(LC_CTYPE, "C");
+ }
+ _M_toupper = NULL;
+ _M_tolower = NULL;
+ _M_table = __table ? __table : classic_table();
+ if (__sav)
+ {
+ setlocale(LC_CTYPE, __sav);
+ delete [] __sav;
+ }
memset(_M_widen, 0, sizeof(_M_widen));
- _M_widen_ok = 0;
memset(_M_narrow, 0, sizeof(_M_narrow));
- _M_narrow_ok = 0;
}
- ctype<char>::ctype(const mask* __table, bool __del, size_t __refs)
- : facet(__refs), _M_del(__table != 0 && __del),
- _M_toupper(NULL), _M_tolower(NULL),
- _M_table(__table ? __table : classic_table())
- {
+ ctype<char>::ctype(const mask* __table, bool __del, size_t __refs)
+ : facet(__refs), _M_c_locale_ctype(_S_get_c_locale()),
+ _M_del(__table != 0 && __del), _M_widen_ok(0), _M_narrow_ok(0)
+ {
+ char* __old = setlocale(LC_CTYPE, NULL);
+ char* __sav = NULL;
+ if (strcmp(__old, "C"))
+ {
+ const size_t __len = strlen(__old) + 1;
+ __sav = new char[__len];
+ memcpy(__sav, __old, __len);
+ setlocale(LC_CTYPE, "C");
+ }
+ _M_toupper = NULL;
+ _M_tolower = NULL;
+ _M_table = __table ? __table : classic_table();
+ if (__sav)
+ {
+ setlocale(LC_CTYPE, __sav);
+ delete [] __sav;
+ }
memset(_M_widen, 0, sizeof(_M_widen));
- _M_widen_ok = 0;
memset(_M_narrow, 0, sizeof(_M_narrow));
- _M_narrow_ok = 0;
}
char
@@ -84,7 +112,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
ctype<char>::do_tolower(char __c) const
{ return ::tolower((int) __c); }
- const char*
+ const char*
ctype<char>::do_tolower(char* __low, const char* __high) const
{
while (__low < __high)
diff --git a/libstdc++-v3/config/os/bsd/freebsd/os_defines.h b/libstdc++-v3/config/os/bsd/freebsd/os_defines.h
index 8b50e5f..9422d92 100644
--- a/libstdc++-v3/config/os/bsd/freebsd/os_defines.h
+++ b/libstdc++-v3/config/os/bsd/freebsd/os_defines.h
@@ -29,6 +29,10 @@
// System-specific #define, typedefs, corrections, etc, go here. This
// file will come before all others.
+#define _GLIBCXX_USE_C99_STDIO 1
+#define _GLIBCXX_USE_C99_STDLIB 1
+#define _GLIBCXX_USE_C99_WCHAR 1
+
#define _GLIBCXX_USE_C99_CHECK 1
#define _GLIBCXX_USE_C99_DYNAMIC (!(__ISO_C_VISIBLE >= 1999))
#define _GLIBCXX_USE_C99_LONG_LONG_CHECK 1
diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
index 991818b..3e02b9e 100755
--- a/libstdc++-v3/configure
+++ b/libstdc++-v3/configure
@@ -15831,10 +15831,10 @@ fi
linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu)
enable_clocale_flag=gnu
;;
- darwin* | freebsd*)
+ darwin*)
enable_clocale_flag=darwin
;;
- dragonfly*)
+ dragonfly* | freebsd*)
enable_clocale_flag=dragonfly
;;
openbsd*)
@@ -15965,8 +15965,8 @@ $as_echo "generic" >&6; }
CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
;;
darwin)
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: darwin or freebsd" >&5
-$as_echo "darwin or freebsd" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: darwin" >&5
+$as_echo "darwin" >&6; }
CLOCALE_H=config/locale/generic/c_locale.h
CLOCALE_CC=config/locale/generic/c_locale.cc
@@ -15983,8 +15983,8 @@ $as_echo "darwin or freebsd" >&6; }
;;
dragonfly)
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: dragonfly" >&5
-$as_echo "dragonfly" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: dragonfly or freebsd" >&5
+$as_echo "dragonfly or freebsd" >&6; }
CLOCALE_H=config/locale/dragonfly/c_locale.h
CLOCALE_CC=config/locale/dragonfly/c_locale.cc