Re: ctype support for libstdc++ on VxWorks

2021-05-04 Thread Alexandre Oliva
On May  4, 2021, Jonathan Wakely  wrote:

> s/explicitely/explicitly/

Thanks.  I also adjusted the attribution in that file.  Here's what I'm
checking in.


ctype support for libstdc++ on VxWorks

From: Corentin Gay 

for  libstdc++-v3/ChangeLog

* acinclude.m4: Add VxWorks-specific case for the
configuration of ctypes.
* configure: Regenerate.
* config/locale/vxworks/ctype_members.cc: Add VxWorks-specific
version.
* config/os/vxworks/ctype_base.h: Adjust for VxWorks7+.
* config/os/vxworks/ctype_configure_char.cc: Likewise.
* config/os/vxworks/ctype_inline.h: Likewise.
* testsuite/28_regex/traits/char/isctype.cc: Defines
NEWLINE_IN_CLASS_BLANK if the target is VxWorks.
* testsuite/28_regex/traits/wchar_t/isctype.cc: Likewise.
---
 libstdc++-v3/acinclude.m4  |   18 +
 .../config/locale/vxworks/ctype_members.cc |  292 
 libstdc++-v3/config/os/vxworks/ctype_base.h|   27 ++
 .../config/os/vxworks/ctype_configure_char.cc  |   10 +
 libstdc++-v3/config/os/vxworks/ctype_inline.h  |   39 +++
 libstdc++-v3/configure |   19 +
 .../testsuite/28_regex/traits/char/isctype.cc  |1 
 .../testsuite/28_regex/traits/wchar_t/isctype.cc   |1 
 8 files changed, 406 insertions(+), 1 deletion(-)
 create mode 100644 libstdc++-v3/config/locale/vxworks/ctype_members.cc

diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4
index 94897a654c950..90ecc4a87a253 100644
--- a/libstdc++-v3/acinclude.m4
+++ b/libstdc++-v3/acinclude.m4
@@ -2391,6 +2391,9 @@ AC_DEFUN([GLIBCXX_ENABLE_CLOCALE], [
   darwin*)
enable_clocale_flag=darwin
;;
+  vxworks*)
+   enable_clocale_flag=vxworks
+   ;;
   dragonfly* | freebsd*)
enable_clocale_flag=dragonfly
;;
@@ -2485,7 +2488,22 @@ AC_DEFUN([GLIBCXX_ENABLE_CLOCALE], [
   CTIME_CC=config/locale/generic/time_members.cc
   CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
   ;;
+vxworks)
+  AC_MSG_RESULT(vxworks)
 
+  CLOCALE_H=config/locale/generic/c_locale.h
+  CLOCALE_CC=config/locale/generic/c_locale.cc
+  CCODECVT_CC=config/locale/generic/codecvt_members.cc
+  CCOLLATE_CC=config/locale/generic/collate_members.cc
+  CCTYPE_CC=config/locale/vxworks/ctype_members.cc
+  CMESSAGES_H=config/locale/generic/messages_members.h
+  CMESSAGES_CC=config/locale/generic/messages_members.cc
+  CMONEY_CC=config/locale/generic/monetary_members.cc
+  CNUMERIC_CC=config/locale/generic/numeric_members.cc
+  CTIME_H=config/locale/generic/time_members.h
+  CTIME_CC=config/locale/generic/time_members.cc
+  CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
+  ;;
 dragonfly)
   AC_MSG_RESULT(dragonfly or freebsd)
 
diff --git a/libstdc++-v3/config/locale/vxworks/ctype_members.cc 
b/libstdc++-v3/config/locale/vxworks/ctype_members.cc
new file mode 100644
index 0..f9dd64c73ff78
--- /dev/null
+++ b/libstdc++-v3/config/locale/vxworks/ctype_members.cc
@@ -0,0 +1,292 @@
+// std::ctype implementation details, vxworks specific version -*- C++ -*-
+
+// Copyright (C) 2001-2021 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
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+//
+// ISO C++ 14882: 22.2.1.1.2  ctype virtual functions.
+//
+
+// Originally written by Benjamin Kosnik .
+// Ported to vxworks by Corentin Gay .
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  // NB: The other ctype specializations are in src/locale.cc and
+  // various /config/os/* files.
+  ctype_byname::ctype_byname(const char* __s, size_t __refs)
+  : ctype(0, false, __refs)
+  {
+if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0)
+  {
+   this->_S_destroy_c_locale(this->_M_c_loca

Re: ctype support for libstdc++ on VxWorks

2021-05-04 Thread Jonathan Wakely via Gcc-patches

On 04/05/21 21:53 +0200, François Dumont via Libstdc++ wrote:

On 04/05/21 4:52 am, Alexandre Oliva wrote:

This patch adds ctype and locale support to libstdc++ on vxworks7.
We've been using this for a while internally.  It was tested with
various vx7r2 targets.  Ok to install?


From: Corentin Gay 

+
+// Copyright (C) 2001-2021 Free Software Foundation, Inc.
+//


Just a detail but for a new file this Copyright specification looks wrong


It's derived from an existing file, with a few modifications relevant
to vxworks. As a derived work, I think it should retain the copyright
of the original file.




Re: ctype support for libstdc++ on VxWorks

2021-05-04 Thread François Dumont via Gcc-patches

On 04/05/21 4:52 am, Alexandre Oliva wrote:

This patch adds ctype and locale support to libstdc++ on vxworks7.
We've been using this for a while internally.  It was tested with
various vx7r2 targets.  Ok to install?


From: Corentin Gay 

+
+// Copyright (C) 2001-2021 Free Software Foundation, Inc.
+//


Just a detail but for a new file this Copyright specification looks wrong




Re: ctype support for libstdc++ on VxWorks

2021-05-04 Thread Jonathan Wakely via Gcc-patches

On 03/05/21 23:52 -0300, Alexandre Oliva wrote:


This patch adds ctype and locale support to libstdc++ on vxworks7.
We've been using this for a while internally.  It was tested with
various vx7r2 targets.  Ok to install?





+// VxWorks does not consider spaces to be blank, however, the testsuite
+// and more generally the libstdc++ rely on it, we explicitely handle


s/explicitely/explicitly/


OK with that tweak.



ctype support for libstdc++ on VxWorks

2021-05-03 Thread Alexandre Oliva


This patch adds ctype and locale support to libstdc++ on vxworks7.
We've been using this for a while internally.  It was tested with
various vx7r2 targets.  Ok to install?


From: Corentin Gay 

for  libstdc++-v3/ChangeLog

* acinclude.m4: Add VxWorks-specific case for the
configuration of ctypes.
* configure: Regenerate.
* config/locale/vxworks/ctype_members.cc: Add VxWorks-specific
version.
* config/os/vxworks/ctype_base.h: Adjust for VxWorks7+.
* config/os/vxworks/ctype_configure_char.cc: Likewise.
* config/os/vxworks/ctype_inline.h: Likewise.
* testsuite/28_regex/traits/char/isctype.cc: Defines
NEWLINE_IN_CLASS_BLANK if the target is VxWorks.
* testsuite/28_regex/traits/wchar_t/isctype.cc: Likewise.
---
 libstdc++-v3/acinclude.m4  |   18 +
 .../config/locale/vxworks/ctype_members.cc |  291 
 libstdc++-v3/config/os/vxworks/ctype_base.h|   27 ++
 .../config/os/vxworks/ctype_configure_char.cc  |   10 +
 libstdc++-v3/config/os/vxworks/ctype_inline.h  |   39 +++
 libstdc++-v3/configure |   19 +
 .../testsuite/28_regex/traits/char/isctype.cc  |1 
 .../testsuite/28_regex/traits/wchar_t/isctype.cc   |1 
 8 files changed, 405 insertions(+), 1 deletion(-)
 create mode 100644 libstdc++-v3/config/locale/vxworks/ctype_members.cc

diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4
index 7b78e148fbd38..e5d88daac0aa9 100644
--- a/libstdc++-v3/acinclude.m4
+++ b/libstdc++-v3/acinclude.m4
@@ -2391,6 +2391,9 @@ AC_DEFUN([GLIBCXX_ENABLE_CLOCALE], [
   darwin*)
enable_clocale_flag=darwin
;;
+  vxworks*)
+   enable_clocale_flag=vxworks
+   ;;
   dragonfly* | freebsd*)
enable_clocale_flag=dragonfly
;;
@@ -2485,7 +2488,22 @@ AC_DEFUN([GLIBCXX_ENABLE_CLOCALE], [
   CTIME_CC=config/locale/generic/time_members.cc
   CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
   ;;
+vxworks)
+  AC_MSG_RESULT(vxworks)
 
+  CLOCALE_H=config/locale/generic/c_locale.h
+  CLOCALE_CC=config/locale/generic/c_locale.cc
+  CCODECVT_CC=config/locale/generic/codecvt_members.cc
+  CCOLLATE_CC=config/locale/generic/collate_members.cc
+  CCTYPE_CC=config/locale/vxworks/ctype_members.cc
+  CMESSAGES_H=config/locale/generic/messages_members.h
+  CMESSAGES_CC=config/locale/generic/messages_members.cc
+  CMONEY_CC=config/locale/generic/monetary_members.cc
+  CNUMERIC_CC=config/locale/generic/numeric_members.cc
+  CTIME_H=config/locale/generic/time_members.h
+  CTIME_CC=config/locale/generic/time_members.cc
+  CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
+  ;;
 dragonfly)
   AC_MSG_RESULT(dragonfly or freebsd)
 
diff --git a/libstdc++-v3/config/locale/vxworks/ctype_members.cc 
b/libstdc++-v3/config/locale/vxworks/ctype_members.cc
new file mode 100644
index 0..c5f327969b3f5
--- /dev/null
+++ b/libstdc++-v3/config/locale/vxworks/ctype_members.cc
@@ -0,0 +1,291 @@
+// std::ctype implementation details, vxworks specific version -*- C++ -*-
+
+// Copyright (C) 2001-2021 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
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// .
+
+//
+// ISO C++ 14882: 22.2.1.1.2  ctype virtual functions.
+//
+
+// Written by Benjamin Kosnik 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  // NB: The other ctype specializations are in src/locale.cc and
+  // various /config/os/* files.
+  ctype_byname::ctype_byname(const char* __s, size_t __refs)
+  : ctype(0, false, __refs)
+  {
+if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0)
+  {
+   this->_S_destroy_c_locale(this->_M_c_locale_ctype);
+   this->_S_create_c_locale(this->_M_c_locale_ctype, __s);
+  }
+  }
+
+  ctype_byname::~ctype_byname()
+  { }
+