This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

netbsd/ctype_noninline.h classic_table patch


The NetBSD ctype_noninline.h has two problems:
* Places that return the classic table are defined inconsistently.
* None of them returns the classic table.
This is fixed by the patch below.

This patch is a bit ugly since it depends on a symbol that is private
to the libc.  It is, however, declared in the ctype.h (although protected
by #ifdef _CTYPE_PRIVATE) so I'd say it is at least somewhat public...
This symbol has been exported from NetBSD libc for the last 6 years
(i.e. it exist in all NetBSD versions supported by gcc).

The alternative is to implement this using the same mechanism as in the
generic ctype implementation.  I would prefer to do as the patch for now,
and do the more involved thing the day NetBSD decides to change its libc.

Bootstrapped and tested on i386-unknown-netbsdelf1.6, where it fixes
the failure "FAIL: 22_locale/ctype/cons/char/1.cc execution test".

   /Krister



2003-06-25  Krister Walfridsson  <cato@df.lth.se>

	* config/os/bsd/netbsd/ctype_noninline.h
	(_C_ctype_): Declare.
	(ctype<char>::classic_table): Return _C_ctype_ + 1.
	(ctype<char>::ctype): Use classic_table.



Index: ctype_noninline.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/config/os/bsd/netbsd/ctype_noninline.h,v
retrieving revision 1.1
diff -c -3 -p -r1.1 ctype_noninline.h
*** ctype_noninline.h	24 Jun 2002 05:48:58 -0000	1.1
--- ctype_noninline.h	25 Jun 2003 21:26:10 -0000
***************
*** 1,6 ****
  // Locale support -*- C++ -*-

! // Copyright (C) 2000, 2001, 2002 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
--- 1,6 ----
  // Locale support -*- C++ -*-

! // Copyright (C) 2000, 2001, 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
***************
*** 32,51 ****
  //

  // 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)
    : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del),
!   _M_toupper(NULL), _M_tolower(NULL), _M_table(__table ? __table : _ctype_ + 1)
    { }

    ctype<char>::ctype(const mask* __table, bool __del, size_t __refs)
    : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del),
!   _M_toupper(NULL), _M_tolower(NULL), _M_table(__table ? __table : _ctype_ + 1)
    { }

    char
--- 32,55 ----
  //

  // Information as gleaned from /usr/include/ctype.h
+
+   extern "C" const u_int8_t _C_ctype_[];

    const ctype_base::mask*
    ctype<char>::classic_table() throw()
!   { return _C_ctype_ + 1; }

    ctype<char>::ctype(__c_locale, const mask* __table, bool __del,
  		     size_t __refs)
    : __ctype_abstract_base<char>(__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)
    : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del),
!   _M_toupper(NULL), _M_tolower(NULL),
!   _M_table(__table ? __table : classic_table())
    { }

    char


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]