OSDN Git Service

2003-10-09 Paolo Carlini <pcarlini@unitus.it>
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 9 Oct 2003 19:10:56 +0000 (19:10 +0000)
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 9 Oct 2003 19:10:56 +0000 (19:10 +0000)
PR libstdc++/11844
* config/os/aix/ctype_base.h: Fix 'alnum' and 'graph'
to conform to the requirements of 22.2.1.
* config/os/bsd/freebsd/ctype_base.h: Likewise.
* config/os/djgpp/ctype_base.h: Likewise.
* config/os/generic/ctype_base.h: Likewise.
* config/os/gnu-linux/ctype_base.h: Likewise.
* config/os/hpux/ctype_base.h: Likewise.
* config/os/irix/irix6.5/ctype_base.h: Likewise.
* config/os/solaris/solaris2.6/ctype_base.h: Likewise.
* config/os/solaris/solaris2.7/ctype_base.h: Likewise.
* testsuite/22_locale/ctype/11844.cc: New.

* config/locale/generic/ctype_members.cc (do_is):
Generically, use a bitmasksize of 15 (instead of 10), since
we don't know the numerical encoding of the various categories
in the underlying /usr/include/ctype.h.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@72281 138bc75d-0d04-0410-961f-82ee72b054a4

12 files changed:
libstdc++-v3/ChangeLog
libstdc++-v3/config/locale/generic/ctype_members.cc
libstdc++-v3/config/os/aix/ctype_base.h
libstdc++-v3/config/os/bsd/freebsd/ctype_base.h
libstdc++-v3/config/os/djgpp/ctype_base.h
libstdc++-v3/config/os/generic/ctype_base.h
libstdc++-v3/config/os/gnu-linux/ctype_base.h
libstdc++-v3/config/os/hpux/ctype_base.h
libstdc++-v3/config/os/irix/irix6.5/ctype_base.h
libstdc++-v3/config/os/solaris/solaris2.6/ctype_base.h
libstdc++-v3/config/os/solaris/solaris2.7/ctype_base.h
libstdc++-v3/testsuite/22_locale/ctype/11844.cc [new file with mode: 0644]

index f4a6f5b..c8571c0 100644 (file)
@@ -1,3 +1,23 @@
+2003-10-09  Paolo Carlini  <pcarlini@unitus.it>
+
+       PR libstdc++/11844
+       * config/os/aix/ctype_base.h: Fix 'alnum' and 'graph'
+       to conform to the requirements of 22.2.1.
+       * config/os/bsd/freebsd/ctype_base.h: Likewise.
+       * config/os/djgpp/ctype_base.h: Likewise.
+       * config/os/generic/ctype_base.h: Likewise.
+       * config/os/gnu-linux/ctype_base.h: Likewise.
+       * config/os/hpux/ctype_base.h: Likewise.
+       * config/os/irix/irix6.5/ctype_base.h: Likewise.
+       * config/os/solaris/solaris2.6/ctype_base.h: Likewise.
+       * config/os/solaris/solaris2.7/ctype_base.h: Likewise.
+       * testsuite/22_locale/ctype/11844.cc: New.
+
+       * config/locale/generic/ctype_members.cc (do_is):
+       Generically, use a bitmasksize of 15 (instead of 10), since
+       we don't know the numerical encoding of the various categories
+       in the underlying /usr/include/ctype.h.
+
 2003-10-09  Benjamin Kosnik  <bkoz@redhat.com>
 
        * src/string-inst.cc: Prune.
 2003-10-09  Benjamin Kosnik  <bkoz@redhat.com>
 
        * src/string-inst.cc: Prune.
index 61880e7..9b3bddb 100644 (file)
@@ -128,7 +128,9 @@ namespace std
   do_is(mask __m, char_type __c) const
   { 
     bool __ret = false;
   do_is(mask __m, char_type __c) const
   { 
     bool __ret = false;
-    const size_t __bitmasksize = 10; 
+    // Generically, 15 (instead of 10) since we don't know the numerical
+    // encoding of the various categories in /usr/include/ctype.h.
+    const size_t __bitmasksize = 15; 
     for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
       {
        const mask __bit = static_cast<mask>(1 << __bitcur);
     for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
       {
        const mask __bit = static_cast<mask>(1 << __bitcur);
@@ -144,7 +146,9 @@ namespace std
   {
     for (;__lo < __hi; ++__vec, ++__lo)
       {
   {
     for (;__lo < __hi; ++__vec, ++__lo)
       {
-       const size_t __bitmasksize = 10; 
+       // Generically, 15 (instead of 10) since we don't know the numerical
+       // encoding of the various categories in /usr/include/ctype.h.
+       const size_t __bitmasksize = 15; 
        mask __m = 0;
        for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
          { 
        mask __m = 0;
        for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
          { 
index ed41440..adcd1ce 100644 (file)
@@ -1,6 +1,6 @@
 // Locale support -*- C++ -*-
 
 // Locale support -*- C++ -*-
 
-// Copyright (C) 2000, 1999 Free Software Foundation, Inc.
+// Copyright (C) 1999, 2000, 2003 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
 //
 // 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
@@ -48,8 +48,8 @@
     static const mask xdigit   = _ISXDIGIT;
     static const mask space    = _ISSPACE;
     static const mask print    = _ISPRINT;
     static const mask xdigit   = _ISXDIGIT;
     static const mask space    = _ISSPACE;
     static const mask print    = _ISPRINT;
-    static const mask graph    = _ISGRAPH;
+    static const mask graph    = _ISALPHA | _ISDIGIT | _ISPUNCT;
     static const mask cntrl    = _ISCNTRL;
     static const mask punct    = _ISPUNCT;
     static const mask cntrl    = _ISCNTRL;
     static const mask punct    = _ISPUNCT;
-    static const mask alnum    = _ISALNUM;
+    static const mask alnum    = _ISALPHA | _ISDIGIT;
   };
   };
index 98b6265..f44a7c7 100644 (file)
@@ -1,6 +1,6 @@
 // Locale support -*- C++ -*-
 
 // Locale support -*- C++ -*-
 
-// Copyright (C) 2000 Free Software Foundation, Inc.
+// Copyright (C) 2000, 2003 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
 //
 // 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
@@ -52,7 +52,7 @@
     static const mask xdigit   = _CTYPE_X;
     static const mask space    = _CTYPE_S;
     static const mask print    = _CTYPE_R;
     static const mask xdigit   = _CTYPE_X;
     static const mask space    = _CTYPE_S;
     static const mask print    = _CTYPE_R;
-    static const mask graph    = _CTYPE_G;
+    static const mask graph    = _CTYPE_A | _CTYPE_D | _CTYPE_P;
     static const mask cntrl    = _CTYPE_C;
     static const mask punct    = _CTYPE_P;
     static const mask alnum    = _CTYPE_A | _CTYPE_D;
     static const mask cntrl    = _CTYPE_C;
     static const mask punct    = _CTYPE_P;
     static const mask alnum    = _CTYPE_A | _CTYPE_D;
@@ -65,7 +65,7 @@
     static const mask xdigit   = _X;
     static const mask space    = _S;
     static const mask print    = _R;
     static const mask xdigit   = _X;
     static const mask space    = _S;
     static const mask print    = _R;
-    static const mask graph    = _G;
+    static const mask graph    = _A | _D | _P;
     static const mask cntrl    = _C;
     static const mask punct    = _P;
     static const mask alnum    = _A | _D;
     static const mask cntrl    = _C;
     static const mask punct    = _P;
     static const mask alnum    = _A | _D;
index 018e20e..778847c 100644 (file)
@@ -1,6 +1,6 @@
 // Locale support -*- C++ -*-
 
 // Locale support -*- C++ -*-
 
-// Copyright (C) 2001 Free Software Foundation, Inc.
+// Copyright (C) 2001, 2003 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
 //
 // 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
@@ -49,8 +49,8 @@
     static const mask digit = __dj_ISDIGIT;    // Numeric
     static const mask punct = __dj_ISPUNCT;     // Punctuation
     static const mask xdigit = __dj_ISXDIGIT;   // Hexadecimal numeric
     static const mask digit = __dj_ISDIGIT;    // Numeric
     static const mask punct = __dj_ISPUNCT;     // Punctuation
     static const mask xdigit = __dj_ISXDIGIT;   // Hexadecimal numeric
-    static const mask alnum = __dj_ISALPHA;     // Alphanumeric
-    static const mask graph = __dj_ISGRAPH;    // Graphical
+    static const mask alnum = __dj_ISALPHA | __dj_ISDIGIT;  // Alphanumeric
+    static const mask graph = __dj_ISALPHA | __dj_ISDIGIT | __dj_ISPUNCT;  // Graphical
   };
 
 
   };
 
 
index 564093d..03fccce 100644 (file)
@@ -1,6 +1,6 @@
 // Locale support -*- C++ -*-
 
 // Locale support -*- C++ -*-
 
-// Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.
+// Copyright (C) 1997, 1998, 1999, 2003 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
 //
 // 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
     static const mask xdigit   = 1 << 4;
     static const mask space    = 1 << 5;
     static const mask print    = 1 << 6;
     static const mask xdigit   = 1 << 4;
     static const mask space    = 1 << 5;
     static const mask print    = 1 << 6;
-    static const mask graph    = 1 << 7;
+    static const mask graph    = (1 << 2) | (1 << 3) | (1 << 9);  // alnum|punct
     static const mask cntrl    = 1 << 8;
     static const mask punct    = 1 << 9;
     static const mask cntrl    = 1 << 8;
     static const mask punct    = 1 << 9;
-    static const mask alnum    = 1 << 10;
+    static const mask alnum    = (1 << 2) | (1 << 3);  // alpha|digit
   };
 
 
   };
 
 
index a431f97..fc27a3f 100644 (file)
@@ -1,6 +1,7 @@
 // Locale support -*- C++ -*-
 
 // Locale support -*- C++ -*-
 
-// Copyright (C) 1997, 1998, 1999, 2000, 2002 Free Software Foundation, Inc.
+// Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003
+// 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
 //
 // 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
@@ -48,8 +49,8 @@
     static const mask xdigit   = _ISxdigit;
     static const mask space    = _ISspace;
     static const mask print    = _ISprint;
     static const mask xdigit   = _ISxdigit;
     static const mask space    = _ISspace;
     static const mask print    = _ISprint;
-    static const mask graph    = _ISgraph;
+    static const mask graph    = _ISalpha | _ISdigit | _ISpunct;
     static const mask cntrl    = _IScntrl;
     static const mask punct    = _ISpunct;
     static const mask cntrl    = _IScntrl;
     static const mask punct    = _ISpunct;
-    static const mask alnum    = _ISalnum;
+    static const mask alnum    = _ISalpha | _ISdigit;
   };
   };
index f2f6ad0..53bbe23 100644 (file)
@@ -1,6 +1,6 @@
 // Locale support -*- C++ -*-
 
 // Locale support -*- C++ -*-
 
-// Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+// Copyright (C) 1997, 1998, 1999, 2000, 2003 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
 //
 // 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
@@ -48,8 +48,8 @@
     static const mask xdigit    = _ISXDIGIT;
     static const mask space     = _ISSPACE;
     static const mask print     = _ISPRINT;
     static const mask xdigit    = _ISXDIGIT;
     static const mask space     = _ISSPACE;
     static const mask print     = _ISPRINT;
-    static const mask graph     = _ISGRAPH;
+    static const mask graph     = _ISALPHA | _ISDIGIT | _ISPUNCT;
     static const mask cntrl     = _ISCNTRL;
     static const mask punct     = _ISPUNCT;
     static const mask cntrl     = _ISCNTRL;
     static const mask punct     = _ISPUNCT;
-    static const mask alnum     = _ISALNUM;
+    static const mask alnum     = _ISALPHA | _ISDIGIT;
   };
   };
index 08557d1..d4d2003 100644 (file)
@@ -1,6 +1,6 @@
 // Locale support -*- C++ -*-
 
 // Locale support -*- C++ -*-
 
-// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+// Copyright (C) 1997, 1998, 1999, 2003 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
 //
 // 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
@@ -48,8 +48,8 @@
     static const mask xdigit   = _ISxdigit;
     static const mask space    = _ISspace;
     static const mask print    = _ISprint;
     static const mask xdigit   = _ISxdigit;
     static const mask space    = _ISspace;
     static const mask print    = _ISprint;
-    static const mask graph    = _ISgraph;
+    static const mask graph    = _ISalpha | _ISdigit | _ISpunct;
     static const mask cntrl    = _IScntrl;
     static const mask punct    = _ISpunct;
     static const mask cntrl    = _IScntrl;
     static const mask punct    = _ISpunct;
-    static const mask alnum    = _ISalnum;
+    static const mask alnum    = _ISalpha | _ISdigit;
   };
   };
index 5f8d10a..c1447e6 100644 (file)
@@ -1,6 +1,6 @@
 // Locale support -*- C++ -*-
 
 // Locale support -*- C++ -*-
 
-// Copyright (C) 1997-1999, 2000 Free Software Foundation, Inc.
+// Copyright (C) 1997, 1998, 1999, 2000, 2003 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
 //
 // 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
@@ -49,8 +49,8 @@
     static const mask xdigit   = _ISXDIGIT;
     static const mask space    = _ISSPACE;
     static const mask print    = _ISPRINT;
     static const mask xdigit   = _ISXDIGIT;
     static const mask space    = _ISSPACE;
     static const mask print    = _ISPRINT;
-    static const mask graph    = _ISGRAPH;
+    static const mask graph    = _ISALPHA | _ISDIGIT | _ISPUNCT;
     static const mask cntrl    = _ISCNTRL;
     static const mask punct    = _ISPUNCT;
     static const mask cntrl    = _ISCNTRL;
     static const mask punct    = _ISPUNCT;
-    static const mask alnum    = _ISALNUM;
+    static const mask alnum    = _ISALPHA | _ISDIGIT;
   };
   };
index 9b8bddc..22be358 100644 (file)
@@ -1,6 +1,6 @@
 // Locale support -*- C++ -*-
 
 // Locale support -*- C++ -*-
 
-// Copyright (C) 1997-1999, 2000 Free Software Foundation, Inc.
+// Copyright (C) 1997, 1998, 1999, 2000, 2003 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
 //
 // 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
@@ -50,8 +50,8 @@
     static const mask xdigit   = _ISXDIGIT;
     static const mask space    = _ISSPACE;
     static const mask print    = _ISPRINT;
     static const mask xdigit   = _ISXDIGIT;
     static const mask space    = _ISSPACE;
     static const mask print    = _ISPRINT;
-    static const mask graph    = _ISGRAPH;
+    static const mask graph    = _ISALPHA | _ISDIGIT | _ISPUNCT;
     static const mask cntrl    = _ISCNTRL;
     static const mask punct    = _ISPUNCT;
     static const mask cntrl    = _ISCNTRL;
     static const mask punct    = _ISPUNCT;
-    static const mask alnum    = _ISALNUM;
+    static const mask alnum    = _ISALPHA | _ISDIGIT;
   };
   };
diff --git a/libstdc++-v3/testsuite/22_locale/ctype/11844.cc b/libstdc++-v3/testsuite/22_locale/ctype/11844.cc
new file mode 100644 (file)
index 0000000..894fdfc
--- /dev/null
@@ -0,0 +1,47 @@
+// Copyright (C) 2003 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 2, 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.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// 22.2.1 The ctype category
+
+#include <locale>
+#include <testsuite_hooks.h>
+
+// libstdc++/11844
+void test01()
+{
+  typedef std::ctype_base ctb;
+  bool test __attribute__((unused)) = true;
+  
+  VERIFY( ctb::alnum == (ctb::alpha | ctb::digit) );
+  VERIFY( ctb::graph == (ctb::alnum | ctb::punct) );
+}
+
+int main()
+{
+  test01();
+  return 0;
+}