This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
V3 PATCH: Fix PR3988
- To: gcc-patches at gcc dot gnu dot org, libstdc++ at gcc dot gnu dot org
- Subject: V3 PATCH: Fix PR3988
- From: Mark Mitchell <mark at codesourcery dot com>
- Date: Mon, 13 Aug 2001 15:24:52 -0700
- Organization: CodeSourcery, LLC
The new limits stuff was accidentally thinking that the x86 had a long
double type with 128 bits of precision, when really the precision is
80 bits. Here's the fix.
Tested on i686-pc-linux-gnu, installed on the branch and on the
mainline.
--
Mark Mitchell mark@codesourcery.com
CodeSourcery, LLC http://www.codesourcery.com
2001-08-13 Mark Mitchell <mark@codesourcery.com>
* configure.in (LIMITS_INC_SRCDIR): New variable.
* configure.target (LIMITSH): New variable.
* porting.texi: Discuss numeric limits.
* config/cpu/generic/bits/limits.h: New file.
* config/cpu/i386/bits/limits.h: New file.
* include/Makefile.am: Install bits/limits.h.
* include/bits/c++config: Include bits/limits.h.
Index: configure.in
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/configure.in,v
retrieving revision 1.54.2.9
diff -c -p -r1.54.2.9 configure.in
*** configure.in 2001/07/26 07:52:19 1.54.2.9
--- configure.in 2001/08/13 22:17:10
*************** fi
*** 224,231 ****
--- 224,233 ----
# Propagate the target-specific source directories through the build chain.
OS_INC_SRCDIR=$os_include_dir/bits
ATOMICITY_INC_SRCDIR=$ATOMICITYH/bits
+ LIMITS_INC_SRCDIR=$LIMITSH/bits
AC_SUBST(OS_INC_SRCDIR)
AC_SUBST(ATOMICITY_INC_SRCDIR)
+ AC_SUBST(LIMITS_INC_SRCDIR)
# Set up cross-compile flags
AC_SUBST(GLIBCPP_IS_CROSS_COMPILING)
Index: configure.target
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/configure.target,v
retrieving revision 1.14.2.7
diff -c -p -r1.14.2.7 configure.target
*** configure.target 2001/07/26 05:01:52 1.14.2.7
--- configure.target 2001/08/13 22:17:10
*************** case "${target}" in
*** 125,127 ****
--- 125,140 ----
ATOMICITYH=$cpu_include_dir
;;
esac
+
+ # Set LIMITSH to the directory where the configuration-dependent
+ # limits.h can be found.
+ # THIS TABLE IS SORTED. KEEP IT THAT WAY.
+
+ case "${target}" in
+ i?86-*-*)
+ LIMITSH=config/cpu/i386
+ ;;
+ *)
+ LIMITSH=config/cpu/generic
+ ;;
+ esac
Index: porting.texi
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/porting.texi,v
retrieving revision 1.4.4.3
diff -c -p -r1.4.4.3 porting.texi
*** porting.texi 2001/06/12 23:10:00 1.4.4.3
--- porting.texi 2001/08/13 22:17:10
*************** Here are the primary steps required to p
*** 74,79 ****
--- 74,80 ----
* Operating system:: Configuring for your operating system.
* Character types:: Implementing character classification.
* Thread safety:: Implementing atomic operations.
+ * Numeric limits:: Implementing numeric limits.
* Libtool:: Using libtool.
* GNU Free Documentation License:: How you can copy and share this manual.
@end menu
*************** __atomic_add (_Atomic_word* __mem, int _
*** 435,440 ****
--- 436,466 ----
*__mem += __val;
@}
@end example
+
+ @c ---------------------------------------------------------------------
+ @c Numeric limits
+ @c ---------------------------------------------------------------------
+
+ @node Numeric limits
+ @chapter Numeric limits
+
+ The C++ library requires information about the fundamental data types,
+ such as the minimum and maximum representable values of each type.
+ You can define each of these values individually, but it is usually
+ easiest just to indicate how many bits are used in each of the data
+ types and let the library do the rest. For information about the
+ macros to define, see the top of @file{include/bits/std_limits.h}.
+
+ If you need to define any macros, you can do so in
+ @file{os_defines.h}. However, if all operating systems for your CPU
+ are likely to use the same values, you can provide a CPU-specific file
+ instead so that you do not have to provide the same definitions for
+ each operating system. To take that approach, create a new file
+ called @file{limits.h} in your CPU configuration directory (e.g.,
+ @file{config/cpu/i386/bits}) and then modify @file{configure.target}
+ so that @code{LIMITSH} is set to the CPU directory (e.g.,
+ @file{config/cpu/i386}). Note that @code{LIMITSH} should not include
+ the @samp{bits} part of the directory name.
@c ---------------------------------------------------------------------
@c Libtool
Index: config/cpu/generic/bits/limits.h
===================================================================
RCS file: limits.h
diff -N limits.h
*** /dev/null Tue May 5 13:32:27 1998
--- limits.h Mon Aug 13 15:17:10 2001
***************
*** 0 ****
--- 1,40 ----
+ // Copyright (C) 2001 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.
+
+ #ifndef _GLIBCPP_CPU_LIMITS
+ #define _GLIBCPP_CPU_LIMITS 1
+
+ // Nothing is defined in the generic file. In that way, we fall back
+ // on the defaults in std_limits.h.
+
+ // If you need to override these defaults, you can either use a
+ // CPU-specific version (in which case you must modify
+ // configure.target) or you must add the overrides to your
+ // os_defines.h. In general, if all systems for your CPU use the
+ // same values, it is best to use a cpu-specific configuration file.
+
+ #endif
Index: config/cpu/i386/bits/limits.h
===================================================================
RCS file: limits.h
diff -N limits.h
*** /dev/null Tue May 5 13:32:27 1998
--- limits.h Mon Aug 13 15:17:10 2001
***************
*** 0 ****
--- 1,33 ----
+ // Copyright (C) 2001 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.
+
+ #ifndef _GLIBCPP_CPU_LIMITS
+ #define _GLIBCPP_CPU_LIMITS 1
+
+ #define __glibcpp_long_double_bits 80
+
+ #endif
Index: include/Makefile.am
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/Makefile.am,v
retrieving revision 1.1.6.2
diff -c -p -r1.1.6.2 Makefile.am
*** Makefile.am 2001/08/11 18:12:17 1.1.6.2
--- Makefile.am 2001/08/13 22:17:11
*************** target_headers = \
*** 284,290 ****
${target_srcdir}/ctype_inline.h \
${target_srcdir}/ctype_noninline.h \
${target_srcdir}/os_defines.h \
! ${glibcpp_srcdir}/@ATOMICITY_INC_SRCDIR@/atomicity.h
thread_builddir = ./${target_alias}/bits
thread_headers = \
--- 284,291 ----
${target_srcdir}/ctype_inline.h \
${target_srcdir}/ctype_noninline.h \
${target_srcdir}/os_defines.h \
! ${glibcpp_srcdir}/@ATOMICITY_INC_SRCDIR@/atomicity.h \
! ${glibcpp_srcdir}/@LIMITS_INC_SRCDIR@/limits.h
thread_builddir = ./${target_alias}/bits
thread_headers = \
Index: include/bits/c++config
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/bits/c++config,v
retrieving revision 1.8.6.58
diff -c -p -r1.8.6.58 c++config
*** c++config 2001/08/13 07:16:14 1.8.6.58
--- c++config 2001/08/13 22:17:11
***************
*** 32,37 ****
--- 32,39 ----
// Pick up any OS-specific definitions.
#include <bits/os_defines.h>
+ // And any CPU-specific definitions.
+ #include <bits/limits.h>
// The current version of the C++ library in compressed ISO date format.
#define __GLIBCPP__ 20010813