* [patch] update locale support fro FreeBSD
@ 2015-11-12 22:32 Andreas Tobler
2015-11-13 15:29 ` Jonathan Wakely
0 siblings, 1 reply; 4+ messages in thread
From: Andreas Tobler @ 2015-11-12 22:32 UTC (permalink / raw)
To: GCC Patches, libstdc++
[-- Attachment #1: Type: text/plain, Size: 701 bytes --]
All,
with the work from Jennifer Yao and John Marino we can now update the
locale support on FreeBSD to the level of DragonFly.
Results of this work can be found on the results list.
Here my small addendum to make it work on FreeBSD.
Is this ok for trunk? (Given that the work from Jennifer and John are
committed before stage3?)
TIA,
Andreas
2015-11-12 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.
[-- Attachment #2: libstdc++-locales-fbsd-20151112-1.diff --]
[-- Type: text/plain, Size: 4603 bytes --]
Index: acinclude.m4
===================================================================
--- acinclude.m4 (revision 230195)
+++ acinclude.m4 (working copy)
@@ -2032,10 +2032,10 @@
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*)
@@ -2114,7 +2114,7 @@
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
@@ -2131,7 +2131,7 @@
;;
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
Index: config/os/bsd/freebsd/ctype_configure_char.cc
===================================================================
--- config/os/bsd/freebsd/ctype_configure_char.cc (revision 230195)
+++ config/os/bsd/freebsd/ctype_configure_char.cc (working copy)
@@ -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 @@
_GLIBCXX_BEGIN_NAMESPACE_VERSION
// Information as gleaned from /usr/include/ctype.h
-
+
const ctype_base::mask*
ctype<char>::classic_table() throw()
- { return 0; }
+ { return NULL; }
- 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())
- {
+ 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 @@
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)
Index: config/os/bsd/freebsd/os_defines.h
===================================================================
--- config/os/bsd/freebsd/os_defines.h (revision 230195)
+++ config/os/bsd/freebsd/os_defines.h (working copy)
@@ -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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [patch] update locale support fro FreeBSD
2015-11-12 22:32 [patch] update locale support fro FreeBSD Andreas Tobler
@ 2015-11-13 15:29 ` Jonathan Wakely
2015-11-14 13:43 ` Jonathan Wakely
0 siblings, 1 reply; 4+ messages in thread
From: Jonathan Wakely @ 2015-11-13 15:29 UTC (permalink / raw)
To: Andreas Tobler; +Cc: GCC Patches, libstdc++
On 12/11/15 23:32 +0100, Andreas Tobler wrote:
>All,
>
>with the work from Jennifer Yao and John Marino we can now update the
>locale support on FreeBSD to the level of DragonFly.
>
>Results of this work can be found on the results list.
>
>Here my small addendum to make it work on FreeBSD.
>
>Is this ok for trunk? (Given that the work from Jennifer and John are
>committed before stage3?)
Those patches are now in.
I'm OK with this change for gcc6. It is an ABI change for FreeBSD, as
it changes the std::locale definitions, but as the target maintainer
you can decide if that's OK.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [patch] update locale support fro FreeBSD
2015-11-13 15:29 ` Jonathan Wakely
@ 2015-11-14 13:43 ` Jonathan Wakely
2015-11-14 21:18 ` Andreas Tobler
0 siblings, 1 reply; 4+ messages in thread
From: Jonathan Wakely @ 2015-11-14 13:43 UTC (permalink / raw)
To: Andreas Tobler; +Cc: GCC Patches, libstdc++
On 13/11/15 15:28 +0000, Jonathan Wakely wrote:
>On 12/11/15 23:32 +0100, Andreas Tobler wrote:
>>All,
>>
>>with the work from Jennifer Yao and John Marino we can now update
>>the locale support on FreeBSD to the level of DragonFly.
>>
>>Results of this work can be found on the results list.
>>
>>Here my small addendum to make it work on FreeBSD.
>>
>>Is this ok for trunk? (Given that the work from Jennifer and John
>>are committed before stage3?)
>
>Those patches are now in.
>
>I'm OK with this change for gcc6. It is an ABI change for FreeBSD, as
>it changes the std::locale definitions, but as the target maintainer
>you can decide if that's OK.
My mistake, this doesn't make any incompatible change at all, so is a
no-brainer IMHO. (I thought there was a change to where something got
deallocated, but that's only a local variable in the constructor).
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [patch] update locale support fro FreeBSD
2015-11-14 13:43 ` Jonathan Wakely
@ 2015-11-14 21:18 ` Andreas Tobler
0 siblings, 0 replies; 4+ messages in thread
From: Andreas Tobler @ 2015-11-14 21:18 UTC (permalink / raw)
To: Jonathan Wakely; +Cc: GCC Patches, libstdc++
On 14.11.15 14:43, Jonathan Wakely wrote:
> On 13/11/15 15:28 +0000, Jonathan Wakely wrote:
>> On 12/11/15 23:32 +0100, Andreas Tobler wrote:
>>> All,
>>>
>>> with the work from Jennifer Yao and John Marino we can now update
>>> the locale support on FreeBSD to the level of DragonFly.
>>>
>>> Results of this work can be found on the results list.
>>>
>>> Here my small addendum to make it work on FreeBSD.
>>>
>>> Is this ok for trunk? (Given that the work from Jennifer and John
>>> are committed before stage3?)
>>
>> Those patches are now in.
>>
>> I'm OK with this change for gcc6. It is an ABI change for FreeBSD, as
>> it changes the std::locale definitions, but as the target maintainer
>> you can decide if that's OK.
>
>
> My mistake, this doesn't make any incompatible change at all, so is a
> no-brainer IMHO. (I thought there was a change to where something got
> deallocated, but that's only a local variable in the constructor).
Thank you very much!
Committed: r230383
Andreas
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-11-14 21:18 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-12 22:32 [patch] update locale support fro FreeBSD Andreas Tobler
2015-11-13 15:29 ` Jonathan Wakely
2015-11-14 13:43 ` Jonathan Wakely
2015-11-14 21:18 ` Andreas Tobler
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).