This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH]: libstdc++ QNX >= 6.1 support
- From: jtc at acorntoolworks dot com (J.T. Conklin)
- To: libstdc++ at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: 30 May 2002 16:12:35 -0700
- Subject: [PATCH]: libstdc++ QNX >= 6.1 support
- Reply-to: jtc at acorntoolworks dot com
Enclosed is 99% of what's needed to support libstdc++ on QNX >= 6.1.
There are some conflicts between libsupc++/new_op.cc and the system
headers (conflicts in malloc declarations). And cmath.cc seems to
conflict with --enable-cheaders=c which is required for this target.
I'm confident these nits can be resolved in short order.
QNX significantly changed their C library between version 6.0 and 6.1.
I could change things so the QNX bits are in config/os/qnx/qnx6.1
rather than config/os/qnx (like is done for irix, solaris, etc.),
which would make it easier if someone wants to add support for the
older release.
--jtc
2002-05-30 J.T. Conklin <jtc@acorntoolworks.com>
* configure.target: Set os_include_dir to config/os/qnx under *-qnx*.
* configure.in: Add support for *-qnx*.
* configure: Regenerate.
* config/os/qnx, config/os/qnx/bits: New directories.
* config/os/qnx/bits/ctype_base.h,
config/os/qnx/bits/ctype_inline.h,
config/os/qnx/bits/ctype_noninline.h,
config/os/qnx/bits/os_defines.h: New files.
Index: configure.in
===================================================================
RCS file: /cvsroot/gcc/gcc/libstdc++-v3/configure.in,v
retrieving revision 1.83.2.7
diff -c -r1.83.2.7 configure.in
*** configure.in 23 May 2002 18:51:30 -0000 1.83.2.7
--- configure.in 30 May 2002 22:41:32 -0000
***************
*** 158,163 ****
--- 158,183 ----
GLIBCPP_CHECK_WCHAR_T_SUPPORT
os_include_dir="config/os/mingw32"
;;
+ *-qnx*)
+ SECTION_FLAGS='-ffunction-sections -fdata-sections'
+ AC_SUBST(SECTION_FLAGS)
+ GLIBCPP_CHECK_LINKER_FEATURES
+ GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT
+ GLIBCPP_CHECK_WCHAR_T_SUPPORT
+ os_include_dir="config/os/qnx"
+ AC_DEFINE(HAVE_COSF)
+ AC_DEFINE(HAVE_COSL)
+ AC_DEFINE(HAVE_COSHF)
+ AC_DEFINE(HAVE_COSHL)
+ AC_DEFINE(HAVE_LOGF)
+ AC_DEFINE(HAVE_LOGL)
+ AC_DEFINE(HAVE_LOG10F)
+ AC_DEFINE(HAVE_LOG10L)
+ AC_DEFINE(HAVE_SINF)
+ AC_DEFINE(HAVE_SINL)
+ AC_DEFINE(HAVE_SINHF)
+ AC_DEFINE(HAVE_SINHL)
+ ;;
*)
os_include_dir="config/os/newlib"
AC_DEFINE(HAVE_HYPOT)
Index: configure.target
===================================================================
RCS file: /cvsroot/gcc/gcc/libstdc++-v3/configure.target,v
retrieving revision 1.38.2.2
diff -c -r1.38.2.2 configure.target
*** configure.target 23 Apr 2002 20:32:10 -0000 1.38.2.2
--- configure.target 30 May 2002 22:41:33 -0000
***************
*** 108,113 ****
--- 108,116 ----
hpux*)
os_include_dir="config/os/hpux"
;;
+ qnx*)
+ os_include_dir="config/os/qnx"
+ ;;
*)
os_include_dir="config/os/generic"
;;
# This is a shell archive. Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file". Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
# ctype_base.h
# ctype_inline.h
# ctype_noninline.h
# os_defines.h
#
echo x - ctype_base.h
sed 's/^X//' >ctype_base.h << 'END-of-ctype_base.h'
X// Locale support -*- C++ -*-
X
X// Copyright (C) 2000 Free Software Foundation, Inc.
X//
X// This file is part of the GNU ISO C++ Library. This library is free
X// software; you can redistribute it and/or modify it under the
X// terms of the GNU General Public License as published by the
X// Free Software Foundation; either version 2, or (at your option)
X// any later version.
X
X// This library is distributed in the hope that it will be useful,
X// but WITHOUT ANY WARRANTY; without even the implied warranty of
X// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
X// GNU General Public License for more details.
X
X// You should have received a copy of the GNU General Public License along
X// with this library; see the file COPYING. If not, write to the Free
X// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
X// USA.
X
X// As a special exception, you may use this file as part of a free software
X// library without restriction. Specifically, if other files instantiate
X// templates or use macros or inline functions from this file, or you compile
X// this file and link it with other files to produce an executable, this
X// file does not by itself cause the resulting executable to be covered by
X// the GNU General Public License. This exception does not however
X// invalidate any other reasons why the executable file might be covered by
X// the GNU General Public License.
X
X//
X// ISO C++ 14882: 22.1 Locales
X//
X
X// Information as gleaned from /usr/include/ctype.h.
X
X struct ctype_base
X {
X // Non-standard typedefs.
X typedef const unsigned char* __to_type;
X
X // NB: Offsets into ctype<char>::_M_table force a particular size
X // on the mask type. Because of this, we don't use an enum.
X typedef short mask;
X static const mask upper = _UP;
X static const mask lower = _LO;
X static const mask alpha = _LO | _UP | _XA;
X static const mask digit = _DI;
X static const mask xdigit = _XD;
X static const mask space = _CN | _SP | _XS;
X static const mask print = _DI | _LO | _PU | _SP | _UP | _XA;
X static const mask graph = _DI | _LO | _PU | _UP | _XA;
X static const mask cntrl = _BB;
X static const mask punct = _PU;
X static const mask alnum = _DI | _LO | _UP | _XA;
X };
END-of-ctype_base.h
echo x - ctype_inline.h
sed 's/^X//' >ctype_inline.h << 'END-of-ctype_inline.h'
X// Locale support -*- C++ -*-
X
X// Copyright (C) 2000 Free Software Foundation, Inc.
X//
X// This file is part of the GNU ISO C++ Library. This library is free
X// software; you can redistribute it and/or modify it under the
X// terms of the GNU General Public License as published by the
X// Free Software Foundation; either version 2, or (at your option)
X// any later version.
X
X// This library is distributed in the hope that it will be useful,
X// but WITHOUT ANY WARRANTY; without even the implied warranty of
X// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
X// GNU General Public License for more details.
X
X// You should have received a copy of the GNU General Public License along
X// with this library; see the file COPYING. If not, write to the Free
X// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
X// USA.
X
X// As a special exception, you may use this file as part of a free software
X// library without restriction. Specifically, if other files instantiate
X// templates or use macros or inline functions from this file, or you compile
X// this file and link it with other files to produce an executable, this
X// file does not by itself cause the resulting executable to be covered by
X// the GNU General Public License. This exception does not however
X// invalidate any other reasons why the executable file might be covered by
X// the GNU General Public License.
X
X//
X// ISO C++ 14882: 22.1 Locales
X//
X
X// ctype bits to be inlined go here. Non-inlinable (ie virtual do_*)
X// functions go in ctype.cc
X
X bool
X ctype<char>::
X is(mask __m, char __c) const
X { return _M_table[(unsigned char)(__c)] & __m; }
X
X const char*
X ctype<char>::
X is(const char* __low, const char* __high, mask* __vec) const
X {
X while (__low < __high)
X *__vec++ = _M_table[*__low++];
X return __high;
X }
X
X const char*
X ctype<char>::
X scan_is(mask __m, const char* __low, const char* __high) const
X {
X while (__low < __high && !this->is(__m, *__low))
X ++__low;
X return __low;
X }
X
X const char*
X ctype<char>::
X scan_not(mask __m, const char* __low, const char* __high) const
X {
X while (__low < __high && this->is(__m, *__low) != 0)
X ++__low;
X return __low;
X }
END-of-ctype_inline.h
echo x - ctype_noninline.h
sed 's/^X//' >ctype_noninline.h << 'END-of-ctype_noninline.h'
X// Locale support -*- C++ -*-
X
X// Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
X//
X// This file is part of the GNU ISO C++ Library. This library is free
X// software; you can redistribute it and/or modify it under the
X// terms of the GNU General Public License as published by the
X// Free Software Foundation; either version 2, or (at your option)
X// any later version.
X
X// This library is distributed in the hope that it will be useful,
X// but WITHOUT ANY WARRANTY; without even the implied warranty of
X// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
X// GNU General Public License for more details.
X
X// You should have received a copy of the GNU General Public License along
X// with this library; see the file COPYING. If not, write to the Free
X// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
X// USA.
X
X// As a special exception, you may use this file as part of a free software
X// library without restriction. Specifically, if other files instantiate
X// templates or use macros or inline functions from this file, or you compile
X// this file and link it with other files to produce an executable, this
X// file does not by itself cause the resulting executable to be covered by
X// the GNU General Public License. This exception does not however
X// invalidate any other reasons why the executable file might be covered by
X// the GNU General Public License.
X
X//
X// ISO C++ 14882: 22.1 Locales
X//
X
X// Information as gleaned from /usr/include/ctype.h
X
X const ctype_base::mask*
X ctype<char>::classic_table() throw()
X { return 0; }
X
X ctype<char>::ctype(__c_locale, const mask* __table, bool __del,
X size_t __refs)
X : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del),
X _M_toupper(NULL), _M_tolower(NULL), _M_table(__table ? __table : _Ctype)
X { }
X
X ctype<char>::ctype(const mask* __table, bool __del, size_t __refs)
X : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del),
X _M_toupper(NULL), _M_tolower(NULL), _M_table(__table ? __table : _Ctype)
X { }
X
X char
X ctype<char>::do_toupper(char __c) const
X { return ::toupper((int) __c); }
X
X const char*
X ctype<char>::do_toupper(char* __low, const char* __high) const
X {
X while (__low < __high)
X {
X *__low = ::toupper((int) *__low);
X ++__low;
X }
X return __high;
X }
X
X char
X ctype<char>::do_tolower(char __c) const
X { return ::tolower((int) __c); }
X
X const char*
X ctype<char>::do_tolower(char* __low, const char* __high) const
X {
X while (__low < __high)
X {
X *__low = ::tolower((int) *__low);
X ++__low;
X }
X return __high;
X }
END-of-ctype_noninline.h
echo x - os_defines.h
sed 's/^X//' >os_defines.h << 'END-of-os_defines.h'
X// Specific definitions for NetBSD -*- C++ -*-
X
X// Copyright (C) 2000 Free Software Foundation, Inc.
X//
X// This file is part of the GNU ISO C++ Library. This library is free
X// software; you can redistribute it and/or modify it under the
X// terms of the GNU General Public License as published by the
X// Free Software Foundation; either version 2, or (at your option)
X// any later version.
X
X// This library is distributed in the hope that it will be useful,
X// but WITHOUT ANY WARRANTY; without even the implied warranty of
X// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
X// GNU General Public License for more details.
X
X// You should have received a copy of the GNU General Public License along
X// with this library; see the file COPYING. If not, write to the Free
X// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
X// USA.
X
X// As a special exception, you may use this file as part of a free software
X// library without restriction. Specifically, if other files instantiate
X// templates or use macros or inline functions from this file, or you compile
X// this file and link it with other files to produce an executable, this
X// file does not by itself cause the resulting executable to be covered by
X// the GNU General Public License. This exception does not however
X// invalidate any other reasons why the executable file might be covered by
X// the GNU General Public License.
X
X#ifndef _GLIBCPP_OS_DEFINES
X#define _GLIBCPP_OS_DEFINES 1
X
X// System-specific #define, typedefs, corrections, etc, go here. This
X// file will come before all others.
X
X#endif
END-of-os_defines.h
exit
--
J.T. Conklin