diff options
author | kan <kan@FreeBSD.org> | 2003-07-11 03:42:04 +0000 |
---|---|---|
committer | kan <kan@FreeBSD.org> | 2003-07-11 03:42:04 +0000 |
commit | c7bbbdd036d3dd7ae253fb13c9994215af06f073 (patch) | |
tree | ce14546aca3a67fa3440aed52f132bafaf68fe70 /contrib/libstdc++/src | |
parent | b2a8872fbe1ec1c49094559ac7b78e6ea4ab7180 (diff) | |
download | FreeBSD-src-c7bbbdd036d3dd7ae253fb13c9994215af06f073.zip FreeBSD-src-c7bbbdd036d3dd7ae253fb13c9994215af06f073.tar.gz |
Gcc 3.3.1-pre 2003-07-11 C++ support bits.
Diffstat (limited to 'contrib/libstdc++/src')
-rw-r--r-- | contrib/libstdc++/src/Makefile.am | 100 | ||||
-rw-r--r-- | contrib/libstdc++/src/Makefile.in | 117 | ||||
-rw-r--r-- | contrib/libstdc++/src/bitset.cc | 11 | ||||
-rw-r--r-- | contrib/libstdc++/src/codecvt.cc | 4 | ||||
-rw-r--r-- | contrib/libstdc++/src/concept-inst.cc | 3 | ||||
-rw-r--r-- | contrib/libstdc++/src/fstream-inst.cc | 2 | ||||
-rw-r--r-- | contrib/libstdc++/src/fstream.cc | 29 | ||||
-rw-r--r-- | contrib/libstdc++/src/globals.cc | 32 | ||||
-rw-r--r-- | contrib/libstdc++/src/io-inst.cc | 2 | ||||
-rw-r--r-- | contrib/libstdc++/src/ios.cc | 27 | ||||
-rw-r--r-- | contrib/libstdc++/src/istream-inst.cc | 2 | ||||
-rw-r--r-- | contrib/libstdc++/src/locale-inst.cc | 130 | ||||
-rw-r--r-- | contrib/libstdc++/src/locale.cc | 56 | ||||
-rw-r--r-- | contrib/libstdc++/src/localename.cc | 59 | ||||
-rw-r--r-- | contrib/libstdc++/src/misc-inst.cc | 24 | ||||
-rw-r--r-- | contrib/libstdc++/src/ostream-inst.cc | 2 | ||||
-rw-r--r-- | contrib/libstdc++/src/sstream-inst.cc | 2 | ||||
-rw-r--r-- | contrib/libstdc++/src/strstream.cc | 4 | ||||
-rw-r--r-- | contrib/libstdc++/src/valarray-inst.cc | 6 |
19 files changed, 474 insertions, 138 deletions
diff --git a/contrib/libstdc++/src/Makefile.am b/contrib/libstdc++/src/Makefile.am index 4592168..304c035 100644 --- a/contrib/libstdc++/src/Makefile.am +++ b/contrib/libstdc++/src/Makefile.am @@ -1,6 +1,6 @@ ## Makefile for the src subdirectory of the GNU C++ Standard library. ## -## Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 +## Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003 ## Free Software Foundation, Inc. ## ## This file is part of the libstdc++ version 3 distribution. @@ -29,19 +29,30 @@ mkinstalldirs = $(SHELL) $(toplevel_srcdir)/mkinstalldirs # Cross compiler support. CXX = @glibcpp_CXX@ +glibcpp_srcdir=@glibcpp_srcdir@ +glibcpp_builddir=@glibcpp_builddir@ toolexecdir = @glibcpp_toolexecdir@ toolexeclibdir = @glibcpp_toolexeclibdir@ toolexeclib_LTLIBRARIES = libstdc++.la +# Symbol versioning for shared libraries. +if GLIBCPP_BUILD_VERSIONED_SHLIB +version_arg = -Wl,--version-script=libstdc++-symbol.ver +libstdc++-symbol.ver: ${glibcpp_srcdir}/@SYMVER_MAP@ + @LN_S@ ${glibcpp_srcdir}/@SYMVER_MAP@ ./libstdc++-symbol.ver || true +else +version_arg = +libstdc++-symbol.ver: +endif + # Compile flags that should be constant throughout the build, both for # SUBDIRS and for libstdc++-v3 in general. OPTIMIZE_CXXFLAGS = @OPTIMIZE_CXXFLAGS@ # These bits are all figured out from configure. Look in acinclude.m4 # or configure.in to see how they are set. See GLIBCPP_EXPORT_FLAGS -# NB: DEBUGFLAGS have to be at the end so that -O2 can be overridden. CONFIG_CXXFLAGS = \ - @EXTRA_CXX_FLAGS@ @SECTION_FLAGS@ @DEBUG_FLAGS@ + @SECTION_FLAGS@ @EXTRA_CXX_FLAGS@ # Warning flags to use. WARN_CXXFLAGS = \ @@ -60,7 +71,8 @@ INCLUDES = \ $(LIBSUPCXX_INCLUDES) $(LIBIO_INCLUDES) $(LIBMATH_INCLUDES) \ $(TOPLEVEL_INCLUDES) -# Source files linked in via configuration magic for a particular target. +# Source files linked in via configuration/make substitution for a +# particular target. target_sources = \ codecvt_members.cc \ collate_members.cc \ @@ -70,12 +82,39 @@ target_sources = \ numeric_members.cc \ time_members.cc -# Source files linked in via configuration magic for a particular -# target, but with ad hoc naming rules. +codecvt_members.cc: ${glibcpp_srcdir}/@CCODECVT_CC@ + @LN_S@ ${glibcpp_srcdir}/@CCODECVT_CC@ . || true + +collate_members.cc: ${glibcpp_srcdir}/@CCOLLATE_CC@ + @LN_S@ ${glibcpp_srcdir}/@CCOLLATE_CC@ . || true + +ctype_members.cc: ${glibcpp_srcdir}/@CCTYPE_CC@ + @LN_S@ ${glibcpp_srcdir}/@CCTYPE_CC@ . || true + +messages_members.cc: ${glibcpp_srcdir}/@CMESSAGES_CC@ + @LN_S@ ${glibcpp_srcdir}/@CMESSAGES_CC@ . || true + +monetary_members.cc: ${glibcpp_srcdir}/@CMONEY_CC@ + @LN_S@ ${glibcpp_srcdir}/@CMONEY_CC@ . || true + +numeric_members.cc: ${glibcpp_srcdir}/@CNUMERIC_CC@ + @LN_S@ ${glibcpp_srcdir}/@CNUMERIC_CC@ . || true + +time_members.cc: ${glibcpp_srcdir}/@CTIME_CC@ + @LN_S@ ${glibcpp_srcdir}/@CTIME_CC@ . || true + +# Source files linked in via configuration/make substitution for a +# particular target, but with ad hoc naming rules. target_sources_extra = \ basic_file.cc \ c++locale.cc +c++locale.cc: ${glibcpp_srcdir}/@CLOCALE_CC@ + @LN_S@ ${glibcpp_srcdir}/@CLOCALE_CC@ ./$@ || true + +basic_file.cc: ${glibcpp_srcdir}/@BASIC_FILE_CC@ + @LN_S@ ${glibcpp_srcdir}/@BASIC_FILE_CC@ ./$@ || true + # Sources present in the src directory. sources = \ bitset.cc \ @@ -114,20 +153,15 @@ VPATH = $(top_srcdir)/src:$(top_srcdir) libstdc___la_SOURCES = $(sources) libstdc___la_LIBADD = \ - ../libmath/libmath.la @libio_la@ \ - ../libsupc++/libsupc++convenience.la + $(top_builddir)/libmath/libmath.la @libio_la@ \ + $(top_builddir)/libsupc++/libsupc++convenience.la -if GLIBCPP_BUILD_VERSIONED_SHLIB -version_arg=-Wl,--version-script=linker.map -else -version_arg= -endif +libstdc___la_DEPENDENCIES = libstdc++-symbol.ver $(libstdc___la_LIBADD) libstdc___la_LDFLAGS = \ -version-info @libtool_VERSION@ ${version_arg} \ -lm @LIBUNWIND_FLAG@ -libstdc___la_DEPENDENCIES = $(libstdc___la_LIBADD) linker.map # Use special rules for the deprecated source files so that they find # deprecated include files. @@ -150,13 +184,13 @@ concept-inst.o: concept-inst.cc # modified in a per-library or per-sub-library way. Need to manually # set this option because CONFIG_CXXFLAGS has to be after # OPTIMIZE_CXXFLAGS on the compile line so that -O2 can be overridden -# as the occasion call for it. (ie, --enable-debug) +# as the occasion call for it. AM_CXXFLAGS = \ -fno-implicit-templates \ $(LIBSUPCXX_CXXFLAGS) \ $(WARN_CXXFLAGS) \ $(OPTIMIZE_CXXFLAGS) \ - $(CONFIG_CXXFLAGS) + $(CONFIG_CXXFLAGS) # libstdc++ libtool notes @@ -188,3 +222,37 @@ LTCXXCOMPILE = $(LIBTOOL) --tag CXX --mode=compile $(CXX) $(INCLUDES) \ # compilation driver. CXXLINK = $(LIBTOOL) --tag CXX --mode=link $(CXX) \ @OPT_LDFLAGS@ @SECTION_LDFLAGS@ $(AM_CXXFLAGS) $(LDFLAGS) -o $@ + + +# Added bits to build debug library. +if GLIBCPP_BUILD_DEBUG +all-local: build_debug +install-data-local: install_debug +else +all-local: +install-data-local: +endif + +debugdir = debug + +# Build parallel set of debug objects here. +stamp-debug: + if test ! -d ${debugdir}; then \ + mkdir -p ${debugdir}; \ + (cd ${debugdir}; \ + sed -e 's/top_builddir = \.\./top_builddir = ..\/../' \ + -e 's/srcdir = \.\./srcdir = ..\/../' \ + -e 's/glibcpp_basedir = \.\./glibcpp_basedir = ..\/../' \ + -e 's/all-local: build_debug/all-local:/' \ + -e 's/install-data-local: install_debug/install-data-local:/' \ + < ../Makefile > Makefile) ; \ + fi; \ + echo `date` > stamp-debug; + +build_debug: stamp-debug + (cd ${debugdir} && $(MAKE) CXXFLAGS='@DEBUG_FLAGS@' all) + +# Install debug library here. +install_debug: + (cd ${debugdir} && $(MAKE) \ + toolexeclibdir=@glibcpp_toolexeclibdir@/debug install) diff --git a/contrib/libstdc++/src/Makefile.in b/contrib/libstdc++/src/Makefile.in index 9e3ff9b..95c1cf8 100644 --- a/contrib/libstdc++/src/Makefile.in +++ b/contrib/libstdc++/src/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am +# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am # Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation @@ -66,15 +66,24 @@ AR = @AR@ AS = @AS@ ATOMICITY_INC_SRCDIR = @ATOMICITY_INC_SRCDIR@ AWK = @AWK@ +BASIC_FILE_CC = @BASIC_FILE_CC@ BASIC_FILE_H = @BASIC_FILE_H@ CC = @CC@ CCODECVT_C = @CCODECVT_C@ +CCODECVT_CC = @CCODECVT_CC@ CCODECVT_H = @CCODECVT_H@ +CCOLLATE_CC = @CCOLLATE_CC@ +CCTYPE_CC = @CCTYPE_CC@ +CLOCALE_CC = @CLOCALE_CC@ CLOCALE_H = @CLOCALE_H@ +CLOCALE_INTERNAL_H = @CLOCALE_INTERNAL_H@ +CMESSAGES_CC = @CMESSAGES_CC@ CMESSAGES_H = @CMESSAGES_H@ +CMONEY_CC = @CMONEY_CC@ +CNUMERIC_CC = @CNUMERIC_CC@ CPP = @CPP@ -CPU_LIMITS_INC_SRCDIR = @CPU_LIMITS_INC_SRCDIR@ CSTDIO_H = @CSTDIO_H@ +CTIME_CC = @CTIME_CC@ CTIME_H = @CTIME_H@ CXXCPP = @CXXCPP@ C_INCLUDE_DIR = @C_INCLUDE_DIR@ @@ -101,6 +110,7 @@ RANLIB = @RANLIB@ SECTION_FLAGS = @SECTION_FLAGS@ SECTION_LDFLAGS = @SECTION_LDFLAGS@ STRIP = @STRIP@ +SYMVER_MAP = @SYMVER_MAP@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WARN_FLAGS = @WARN_FLAGS@ @@ -113,10 +123,8 @@ glibcpp_CXX = @glibcpp_CXX@ glibcpp_MOFILES = @glibcpp_MOFILES@ glibcpp_POFILES = @glibcpp_POFILES@ glibcpp_basedir = @glibcpp_basedir@ -glibcpp_builddir = @glibcpp_builddir@ glibcpp_localedir = @glibcpp_localedir@ glibcpp_prefixdir = @glibcpp_prefixdir@ -glibcpp_srcdir = @glibcpp_srcdir@ glibcpp_thread_h = @glibcpp_thread_h@ glibcpp_toolexecdir = @glibcpp_toolexecdir@ glibcpp_toolexeclibdir = @glibcpp_toolexeclibdir@ @@ -133,9 +141,13 @@ mkinstalldirs = $(SHELL) $(toplevel_srcdir)/mkinstalldirs # Cross compiler support. CXX = @glibcpp_CXX@ +glibcpp_srcdir = @glibcpp_srcdir@ +glibcpp_builddir = @glibcpp_builddir@ toolexecdir = @glibcpp_toolexecdir@ toolexeclibdir = @glibcpp_toolexeclibdir@ toolexeclib_LTLIBRARIES = libstdc++.la +@GLIBCPP_BUILD_VERSIONED_SHLIB_TRUE@version_arg = @GLIBCPP_BUILD_VERSIONED_SHLIB_TRUE@-Wl,--version-script=libstdc++-symbol.ver +@GLIBCPP_BUILD_VERSIONED_SHLIB_FALSE@version_arg = # Compile flags that should be constant throughout the build, both for # SUBDIRS and for libstdc++-v3 in general. @@ -143,9 +155,8 @@ OPTIMIZE_CXXFLAGS = @OPTIMIZE_CXXFLAGS@ # These bits are all figured out from configure. Look in acinclude.m4 # or configure.in to see how they are set. See GLIBCPP_EXPORT_FLAGS -# NB: DEBUGFLAGS have to be at the end so that -O2 can be overridden. CONFIG_CXXFLAGS = \ - @EXTRA_CXX_FLAGS@ @SECTION_FLAGS@ @DEBUG_FLAGS@ + @SECTION_FLAGS@ @EXTRA_CXX_FLAGS@ # Warning flags to use. @@ -167,7 +178,8 @@ INCLUDES = \ $(TOPLEVEL_INCLUDES) -# Source files linked in via configuration magic for a particular target. +# Source files linked in via configuration/make substitution for a +# particular target. target_sources = \ codecvt_members.cc \ collate_members.cc \ @@ -178,8 +190,8 @@ target_sources = \ time_members.cc -# Source files linked in via configuration magic for a particular -# target, but with ad hoc naming rules. +# Source files linked in via configuration/make substitution for a +# particular target, but with ad hoc naming rules. target_sources_extra = \ basic_file.cc \ c++locale.cc @@ -224,19 +236,17 @@ VPATH = $(top_srcdir)/src:$(top_srcdir) libstdc___la_SOURCES = $(sources) libstdc___la_LIBADD = \ - ../libmath/libmath.la @libio_la@ \ - ../libsupc++/libsupc++convenience.la + $(top_builddir)/libmath/libmath.la @libio_la@ \ + $(top_builddir)/libsupc++/libsupc++convenience.la -@GLIBCPP_BUILD_VERSIONED_SHLIB_TRUE@version_arg = @GLIBCPP_BUILD_VERSIONED_SHLIB_TRUE@-Wl,--version-script=linker.map -@GLIBCPP_BUILD_VERSIONED_SHLIB_FALSE@version_arg = + +libstdc___la_DEPENDENCIES = libstdc++-symbol.ver $(libstdc___la_LIBADD) libstdc___la_LDFLAGS = \ -version-info @libtool_VERSION@ ${version_arg} \ -lm @LIBUNWIND_FLAG@ -libstdc___la_DEPENDENCIES = $(libstdc___la_LIBADD) linker.map - # Use special rules for the deprecated source files so that they find # deprecated include files. GLIBCPP_INCLUDE_DIR = @glibcpp_builddir@/include @@ -245,13 +255,13 @@ GLIBCPP_INCLUDE_DIR = @glibcpp_builddir@/include # modified in a per-library or per-sub-library way. Need to manually # set this option because CONFIG_CXXFLAGS has to be after # OPTIMIZE_CXXFLAGS on the compile line so that -O2 can be overridden -# as the occasion call for it. (ie, --enable-debug) +# as the occasion call for it. AM_CXXFLAGS = \ -fno-implicit-templates \ $(LIBSUPCXX_CXXFLAGS) \ $(WARN_CXXFLAGS) \ $(OPTIMIZE_CXXFLAGS) \ - $(CONFIG_CXXFLAGS) + $(CONFIG_CXXFLAGS) # libstdc++ libtool notes @@ -285,6 +295,8 @@ LTCXXCOMPILE = $(LIBTOOL) --tag CXX --mode=compile $(CXX) $(INCLUDES) \ CXXLINK = $(LIBTOOL) --tag CXX --mode=link $(CXX) \ @OPT_LDFLAGS@ @SECTION_LDFLAGS@ $(AM_CXXFLAGS) $(LDFLAGS) -o $@ + +debugdir = debug CONFIG_HEADER = ../config.h CONFIG_CLEAN_FILES = LTLIBRARIES = $(toolexeclib_LTLIBRARIES) @@ -462,7 +474,7 @@ install-info: install-info-am install-exec-am: install-toolexeclibLTLIBRARIES install-exec: install-exec-am -install-data-am: +install-data-am: install-data-local install-data: install-data-am install-am: all-am @@ -470,7 +482,7 @@ install-am: all-am install: install-am uninstall-am: uninstall-toolexeclibLTLIBRARIES uninstall: uninstall-am -all-am: Makefile $(LTLIBRARIES) +all-am: Makefile $(LTLIBRARIES) all-local all-redirect: all-am install-strip: $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install @@ -523,11 +535,42 @@ maintainer-clean-compile mostlyclean-libtool distclean-libtool \ clean-libtool maintainer-clean-libtool tags mostlyclean-tags \ distclean-tags clean-tags maintainer-clean-tags distdir info-am info \ dvi-am dvi check check-am installcheck-am installcheck install-info-am \ -install-info install-exec-am install-exec install-data-am install-data \ -install-am install uninstall-am uninstall all-redirect all-am all \ -installdirs mostlyclean-generic distclean-generic clean-generic \ -maintainer-clean-generic clean mostlyclean distclean maintainer-clean +install-info install-exec-am install-exec install-data-local \ +install-data-am install-data install-am install uninstall-am uninstall \ +all-local all-redirect all-am all installdirs mostlyclean-generic \ +distclean-generic clean-generic maintainer-clean-generic clean \ +mostlyclean distclean maintainer-clean + +@GLIBCPP_BUILD_VERSIONED_SHLIB_TRUE@libstdc++-symbol.ver: ${glibcpp_srcdir}/@SYMVER_MAP@ +@GLIBCPP_BUILD_VERSIONED_SHLIB_TRUE@ @LN_S@ ${glibcpp_srcdir}/@SYMVER_MAP@ ./libstdc++-symbol.ver || true +@GLIBCPP_BUILD_VERSIONED_SHLIB_FALSE@libstdc++-symbol.ver: +codecvt_members.cc: ${glibcpp_srcdir}/@CCODECVT_CC@ + @LN_S@ ${glibcpp_srcdir}/@CCODECVT_CC@ . || true + +collate_members.cc: ${glibcpp_srcdir}/@CCOLLATE_CC@ + @LN_S@ ${glibcpp_srcdir}/@CCOLLATE_CC@ . || true + +ctype_members.cc: ${glibcpp_srcdir}/@CCTYPE_CC@ + @LN_S@ ${glibcpp_srcdir}/@CCTYPE_CC@ . || true + +messages_members.cc: ${glibcpp_srcdir}/@CMESSAGES_CC@ + @LN_S@ ${glibcpp_srcdir}/@CMESSAGES_CC@ . || true + +monetary_members.cc: ${glibcpp_srcdir}/@CMONEY_CC@ + @LN_S@ ${glibcpp_srcdir}/@CMONEY_CC@ . || true + +numeric_members.cc: ${glibcpp_srcdir}/@CNUMERIC_CC@ + @LN_S@ ${glibcpp_srcdir}/@CNUMERIC_CC@ . || true + +time_members.cc: ${glibcpp_srcdir}/@CTIME_CC@ + @LN_S@ ${glibcpp_srcdir}/@CTIME_CC@ . || true + +c++locale.cc: ${glibcpp_srcdir}/@CLOCALE_CC@ + @LN_S@ ${glibcpp_srcdir}/@CLOCALE_CC@ ./$@ || true + +basic_file.cc: ${glibcpp_srcdir}/@BASIC_FILE_CC@ + @LN_S@ ${glibcpp_srcdir}/@BASIC_FILE_CC@ ./$@ || true strstream.lo: strstream.cc $(LTCXXCOMPILE) -I$(GLIBCPP_INCLUDE_DIR)/backward -Wno-deprecated -c $< strstream.o: strstream.cc @@ -541,6 +584,34 @@ concept-inst.lo: concept-inst.cc concept-inst.o: concept-inst.cc $(CXXCOMPILE) -D_GLIBCPP_CONCEPT_CHECKS -fimplicit-templates -c $< +# Added bits to build debug library. +@GLIBCPP_BUILD_DEBUG_TRUE@all-local: build_debug +@GLIBCPP_BUILD_DEBUG_TRUE@install-data-local: install_debug +@GLIBCPP_BUILD_DEBUG_FALSE@all-local: +@GLIBCPP_BUILD_DEBUG_FALSE@install-data-local: + +# Build parallel set of debug objects here. +stamp-debug: + if test ! -d ${debugdir}; then \ + mkdir -p ${debugdir}; \ + (cd ${debugdir}; \ + sed -e 's/top_builddir = \.\./top_builddir = ..\/../' \ + -e 's/srcdir = \.\./srcdir = ..\/../' \ + -e 's/glibcpp_basedir = \.\./glibcpp_basedir = ..\/../' \ + -e 's/all-local: build_debug/all-local:/' \ + -e 's/install-data-local: install_debug/install-data-local:/' \ + < ../Makefile > Makefile) ; \ + fi; \ + echo `date` > stamp-debug; + +build_debug: stamp-debug + (cd ${debugdir} && $(MAKE) CXXFLAGS='@DEBUG_FLAGS@' all) + +# Install debug library here. +install_debug: + (cd ${debugdir} && $(MAKE) \ + toolexeclibdir=@glibcpp_toolexeclibdir@/debug install) + # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: diff --git a/contrib/libstdc++/src/bitset.cc b/contrib/libstdc++/src/bitset.cc index 7103854..4849a6a 100644 --- a/contrib/libstdc++/src/bitset.cc +++ b/contrib/libstdc++/src/bitset.cc @@ -38,7 +38,7 @@ * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. - */ + */ #include <bitset> @@ -68,7 +68,7 @@ std::_Base_bitset<1>::_M_do_find_first(std::size_t __not_found) const } std::size_t -std::_Base_bitset<1>::_M_do_find_next(std::size_t __prev, +std::_Base_bitset<1>::_M_do_find_next(std::size_t __prev, std::size_t __not_found) const { // make bound inclusive @@ -103,8 +103,9 @@ std::_Base_bitset<1>::_M_do_find_next(std::size_t __prev, } // end _M_do_find_next -// Lookup tables for find and count operations. -unsigned char std::_S_bit_count[256] = +// Lookup tables for find and count operations. In _S_bit_count, the value +// *at* an index is the number of bits set *in* that index. +unsigned char std::_S_bit_count[256] = { 0, /* 0 */ 1, /* 1 */ 1, /* 2 */ 2, /* 3 */ 1, /* 4 */ 2, /* 5 */ 2, /* 6 */ 3, /* 7 */ 1, /* 8 */ 2, /* 9 */ @@ -160,7 +161,7 @@ unsigned char std::_S_bit_count[256] = 8 /* 255 */ }; // end _S_bit_count -unsigned char std::_S_first_one[256] = +unsigned char std::_S_first_one[256] = { 0, /* 0 */ 0, /* 1 */ 1, /* 2 */ 0, /* 3 */ 2, /* 4 */ 0, /* 5 */ 1, /* 6 */ 0, /* 7 */ 3, /* 8 */ 0, /* 9 */ diff --git a/contrib/libstdc++/src/codecvt.cc b/contrib/libstdc++/src/codecvt.cc index c536979..bc5508a 100644 --- a/contrib/libstdc++/src/codecvt.cc +++ b/contrib/libstdc++/src/codecvt.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2000, 2002 Free Software Foundation, Inc. +// Copyright (C) 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 @@ -82,7 +82,7 @@ namespace std const extern_type*, const extern_type*& __from_next, intern_type* __to, intern_type*, intern_type*& __to_next) const - { + { // _GLIBCPP_RESOLVE_LIB_DEFECTS // According to the resolution of DR19, "If returns noconv [...] // there are no changes to the values in [to, to_limit)." diff --git a/contrib/libstdc++/src/concept-inst.cc b/contrib/libstdc++/src/concept-inst.cc index d0129e5..e173549 100644 --- a/contrib/libstdc++/src/concept-inst.cc +++ b/contrib/libstdc++/src/concept-inst.cc @@ -1,6 +1,6 @@ // Concept checking instantiations -*- C++ -*- -// Copyright (C) 2001, 2002 Free Software Foundation +// Copyright (C) 2001, 2002, 2003 Free Software Foundation // // 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 @@ -39,6 +39,7 @@ #ifdef _GLIBCPP_CONCEPT_CHECKS #include <memory> +#include <iterator> #include <ostream> #define _Instantiate(...) template void __function_requires< __VA_ARGS__ > () diff --git a/contrib/libstdc++/src/fstream-inst.cc b/contrib/libstdc++/src/fstream-inst.cc index 34f3819..8b866c0 100644 --- a/contrib/libstdc++/src/fstream-inst.cc +++ b/contrib/libstdc++/src/fstream-inst.cc @@ -59,4 +59,4 @@ namespace std #ifdef _GLIBCPP_USE_WCHAR_T template class basic_fstream<wchar_t>; #endif -} //std +} // namespace std diff --git a/contrib/libstdc++/src/fstream.cc b/contrib/libstdc++/src/fstream.cc index be71133..2a099d6 100644 --- a/contrib/libstdc++/src/fstream.cc +++ b/contrib/libstdc++/src/fstream.cc @@ -1,6 +1,6 @@ // File based streams -*- C++ -*- -// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 +// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003 // Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free @@ -50,10 +50,14 @@ namespace std // normal buffers and jet outta here before expensive // fileops happen... if (_M_pback_init) + _M_pback_destroy(); + + if (_M_in_cur && _M_in_cur < _M_in_end) { - _M_pback_destroy(); - if (_M_in_cur < _M_in_end) - return traits_type::to_int_type(*_M_in_cur); + __ret = traits_type::to_int_type(*_M_in_cur); + if (__bump) + _M_in_cur_move(1); + return __ret; } // Sync internal and external buffers. @@ -115,10 +119,14 @@ namespace std // normal buffers and jet outta here before expensive // fileops happen... if (_M_pback_init) + _M_pback_destroy(); + + if (_M_in_cur && _M_in_cur < _M_in_end) { - _M_pback_destroy(); - if (_M_in_cur < _M_in_end) - return traits_type::to_int_type(*_M_in_cur); + __ret = traits_type::to_int_type(*_M_in_cur); + if (__bump) + _M_in_cur_move(1); + return __ret; } // Sync internal and external buffers. @@ -154,9 +162,10 @@ namespace std const char* __eend; char_type* __iend; - __res_type __r = __cvt.in(_M_state_cur, __buf, - __buf + __elen, __eend, _M_in_beg, - _M_in_beg + _M_buf_size, __iend); + codecvt_base::result __r; + __r = __cvt.in(_M_state_cur, __buf, + __buf + __elen, __eend, _M_in_beg, + _M_in_beg + _M_buf_size, __iend); if (__r == codecvt_base::ok) __ilen = __iend - _M_in_beg; else diff --git a/contrib/libstdc++/src/globals.cc b/contrib/libstdc++/src/globals.cc index c6ff69c..efbfdbe 100644 --- a/contrib/libstdc++/src/globals.cc +++ b/contrib/libstdc++/src/globals.cc @@ -47,7 +47,7 @@ namespace __gnu_cxx { using namespace std; - + typedef char fake_facet_name[sizeof(char*)] __attribute__ ((aligned(__alignof__(char*)))); fake_facet_name facet_name[6 + _GLIBCPP_NUM_CATEGORIES]; @@ -84,6 +84,11 @@ namespace __gnu_cxx fake_facet_vec facet_vec[_GLIBCPP_NUM_FACETS]; _GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx9facet_vecE, _ZSt9facet_vec, GLIBCPP_3.2) + // To support combined facets and caches in facet array + typedef char fake_facet_cache_vec[sizeof(locale::facet*)] + __attribute__ ((aligned(__alignof__(locale::facet*)))); + fake_facet_cache_vec facet_cache_vec[2 * _GLIBCPP_NUM_FACETS]; + typedef char fake_ctype_c[sizeof(std::ctype<char>)] __attribute__ ((aligned(__alignof__(std::ctype<char>)))); fake_ctype_c ctype_c; @@ -224,6 +229,17 @@ namespace __gnu_cxx _GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx10messages_wE, _ZSt10messages_w, GLIBCPP_3.2) #endif + // Storage for static C locale caches + typedef char fake_locale_cache_np_c[sizeof(std::__locale_cache<numpunct<char> >)] + __attribute__ ((aligned(__alignof__(std::__locale_cache<numpunct<char> >)))); + fake_locale_cache_np_c locale_cache_np_c; + +#ifdef _GLIBCPP_USE_WCHAR_T + typedef char fake_locale_cache_np_w[sizeof(std::__locale_cache<numpunct<wchar_t> >)] + __attribute__ ((aligned(__alignof__(std::__locale_cache<numpunct<wchar_t> >)))); + fake_locale_cache_np_w locale_cache_np_w; +#endif + typedef char fake_filebuf[sizeof(stdio_filebuf<char>)] __attribute__ ((aligned(__alignof__(stdio_filebuf<char>)))); fake_filebuf buf_cout; @@ -243,10 +259,7 @@ namespace __gnu_cxx _GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx8buf_wcinE, _ZSt8buf_wcin, GLIBCPP_3.2) _GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx9buf_wcerrE, _ZSt9buf_wcerr, GLIBCPP_3.2) #endif -} // namespace __gnu_cxx -namespace std -{ // Globals for once-only runtime initialization of mutex objects. This // allows static initialization of these objects on systems that need a // function call to initialize a mutex. For example, see stl_threads.h. @@ -270,6 +283,17 @@ namespace std { __GTHREAD_MUTEX_INIT_FUNCTION (_GLIBCPP_mutex_address); } #endif + // GLIBCXX_ABI. + struct __compat + { + static const char _S_atoms[]; + }; + const char __compat::_S_atoms[] = "0123456789eEabcdfABCDF"; + _GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx8__compat8_S_atomsE, _ZNSt10__num_base8_S_atomsE, GLIBCPP_3.2) +} // namespace __gnu_cxx + +namespace std +{ // Standard stream objects. typedef char fake_istream[sizeof(istream)] __attribute__ ((aligned(__alignof__(istream)))); diff --git a/contrib/libstdc++/src/io-inst.cc b/contrib/libstdc++/src/io-inst.cc index f5773c9..31f53b4 100644 --- a/contrib/libstdc++/src/io-inst.cc +++ b/contrib/libstdc++/src/io-inst.cc @@ -57,4 +57,4 @@ namespace std #ifdef _GLIBCPP_USE_WCHAR_T template class basic_iostream<wchar_t>; #endif -} //std +} // namespace std diff --git a/contrib/libstdc++/src/ios.cc b/contrib/libstdc++/src/ios.cc index 9f4c718..00dbe12 100644 --- a/contrib/libstdc++/src/ios.cc +++ b/contrib/libstdc++/src/ios.cc @@ -159,11 +159,12 @@ namespace std void ios_base::Init::_S_ios_create(bool __sync) { - int __out_size = __sync ? 0 : static_cast<int>(BUFSIZ); + size_t __out_size = __sync ? 0 : static_cast<size_t>(BUFSIZ); #ifdef _GLIBCPP_HAVE_ISATTY - int __in_size = (__sync || isatty (0)) ? 1 : static_cast<int>(BUFSIZ); + size_t __in_size = + (__sync || isatty (0)) ? 1 : static_cast<size_t>(BUFSIZ); #else - int __in_size = 1; + size_t __in_size = 1; #endif // NB: The file globals.cc creates the four standard files @@ -172,10 +173,15 @@ namespace std new (&buf_cout) stdio_filebuf<char>(stdout, ios_base::out, __out_size); new (&buf_cin) stdio_filebuf<char>(stdin, ios_base::in, __in_size); new (&buf_cerr) stdio_filebuf<char>(stderr, ios_base::out, __out_size); + new (&cout) ostream(&buf_cout); new (&cin) istream(&buf_cin); new (&cerr) ostream(&buf_cerr); new (&clog) ostream(&buf_cerr); + cout.init(&buf_cout); + cin.init(&buf_cin); + cerr.init(&buf_cerr); + clog.init(&buf_cerr); cin.tie(&cout); cerr.flags(ios_base::unitbuf); @@ -187,6 +193,10 @@ namespace std new (&wcin) wistream(&buf_wcin); new (&wcerr) wostream(&buf_wcerr); new (&wclog) wostream(&buf_wcerr); + wcout.init(&buf_wcout); + wcin.init(&buf_wcin); + wcerr.init(&buf_wcerr); + wclog.init(&buf_wcerr); wcin.tie(&wcout); wcerr.flags(ios_base::unitbuf); #endif @@ -252,8 +262,6 @@ namespace std { words = new _Words[newsize]; } catch (...) { - delete [] _M_word; - _M_word = 0; _M_streambuf_state |= badbit; if (_M_streambuf_state & _M_exception) __throw_ios_failure("ios_base::_M_grow_words failure"); @@ -270,6 +278,8 @@ namespace std else { _M_streambuf_state |= badbit; + if (_M_streambuf_state & _M_exception) + __throw_ios_failure("ios_base::_M_grow_words failure"); return _M_word_zero; } } @@ -286,8 +296,6 @@ namespace std _M_precision = 6; _M_width = 0; _M_flags = skipws | dec; - _M_callbacks = 0; - _M_word_size = 0; _M_ios_locale = locale(); } @@ -301,7 +309,8 @@ namespace std return __old; } - ios_base::ios_base() : _M_callbacks(0), _M_word(0) + ios_base::ios_base() : _M_callbacks(0), _M_word_size(_S_local_word_size), + _M_word(_M_local_word) { // Do nothing: basic_ios::init() does it. // NB: _M_callbacks and _M_word must be zero for non-initialized @@ -313,7 +322,7 @@ namespace std { _M_call_callbacks(erase_event); _M_dispose_callbacks(); - if (_M_word && _M_word != _M_local_word) + if (_M_word != _M_local_word) { delete [] _M_word; _M_word = 0; diff --git a/contrib/libstdc++/src/istream-inst.cc b/contrib/libstdc++/src/istream-inst.cc index 6112509..f2c72fd 100644 --- a/contrib/libstdc++/src/istream-inst.cc +++ b/contrib/libstdc++/src/istream-inst.cc @@ -67,4 +67,4 @@ namespace std template wistream& operator>>(wistream&, _Setprecision); template wistream& operator>>(wistream&, _Setw); #endif -} //std +} // namespace std diff --git a/contrib/libstdc++/src/locale-inst.cc b/contrib/libstdc++/src/locale-inst.cc index 8f2c863..8da410f 100644 --- a/contrib/libstdc++/src/locale-inst.cc +++ b/contrib/libstdc++/src/locale-inst.cc @@ -1,6 +1,6 @@ // Locale support -*- C++ -*- -// Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc. +// Copyright (C) 1999, 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 @@ -34,7 +34,6 @@ #include <cstdlib> #include <clocale> #include <cstring> -#include <cassert> #include <locale> namespace std @@ -46,6 +45,7 @@ namespace std template class moneypunct_byname<char, true>; template class money_get<char, istreambuf_iterator<char> >; template class money_put<char, ostreambuf_iterator<char> >; + template class __locale_cache<numpunct<char> >; #ifdef _GLIBCPP_USE_WCHAR_T template class moneypunct<wchar_t, false>; @@ -54,6 +54,7 @@ namespace std template class moneypunct_byname<wchar_t, true>; template class money_get<wchar_t, istreambuf_iterator<wchar_t> >; template class money_put<wchar_t, ostreambuf_iterator<wchar_t> >; + template class __locale_cache<numpunct<wchar_t> >; #endif // numpunct, numpunct_byname, num_get, and num_put @@ -64,26 +65,26 @@ namespace std template ostreambuf_iterator<char> num_put<char, ostreambuf_iterator<char> >:: - _M_convert_int(ostreambuf_iterator<char>, ios_base&, char, char, char, + _M_convert_int(ostreambuf_iterator<char>, ios_base&, char, long) const; template ostreambuf_iterator<char> num_put<char, ostreambuf_iterator<char> >:: - _M_convert_int(ostreambuf_iterator<char>, ios_base&, char, char, char, + _M_convert_int(ostreambuf_iterator<char>, ios_base&, char, unsigned long) const; #ifdef _GLIBCPP_USE_LONG_LONG template ostreambuf_iterator<char> num_put<char, ostreambuf_iterator<char> >:: - _M_convert_int(ostreambuf_iterator<char>, ios_base&, char, char, char, + _M_convert_int(ostreambuf_iterator<char>, ios_base&, char, long long) const; template ostreambuf_iterator<char> num_put<char, ostreambuf_iterator<char> >:: - _M_convert_int(ostreambuf_iterator<char>, ios_base&, char, char, char, + _M_convert_int(ostreambuf_iterator<char>, ios_base&, char, unsigned long long) const; #endif @@ -97,8 +98,8 @@ namespace std ostreambuf_iterator<char> num_put<char, ostreambuf_iterator<char> >:: _M_convert_float(ostreambuf_iterator<char>, ios_base&, char, char, - long double) const; - + long double) const; + #ifdef _GLIBCPP_USE_WCHAR_T template class numpunct<wchar_t>; template class numpunct_byname<wchar_t>; @@ -108,27 +109,27 @@ namespace std template ostreambuf_iterator<wchar_t> num_put<wchar_t, ostreambuf_iterator<wchar_t> >:: - _M_convert_int(ostreambuf_iterator<wchar_t>, ios_base&, wchar_t, char, - char, long) const; + _M_convert_int(ostreambuf_iterator<wchar_t>, ios_base&, wchar_t, + long) const; template ostreambuf_iterator<wchar_t> num_put<wchar_t, ostreambuf_iterator<wchar_t> >:: - _M_convert_int(ostreambuf_iterator<wchar_t>, ios_base&, wchar_t, char, - char, unsigned long) const; + _M_convert_int(ostreambuf_iterator<wchar_t>, ios_base&, wchar_t, + unsigned long) const; #ifdef _GLIBCPP_USE_LONG_LONG template ostreambuf_iterator<wchar_t> num_put<wchar_t, ostreambuf_iterator<wchar_t> >:: - _M_convert_int(ostreambuf_iterator<wchar_t>, ios_base&, wchar_t, char, - char, long long) const; + _M_convert_int(ostreambuf_iterator<wchar_t>, ios_base&, wchar_t, + long long) const; template ostreambuf_iterator<wchar_t> num_put<wchar_t, ostreambuf_iterator<wchar_t> >:: - _M_convert_int(ostreambuf_iterator<wchar_t>, ios_base&, wchar_t, char, - char, unsigned long long) const; + _M_convert_int(ostreambuf_iterator<wchar_t>, ios_base&, wchar_t, + unsigned long long) const; #endif template @@ -144,6 +145,64 @@ namespace std long double) const; #endif +#if 1 + // XXX GLIBCXX_ABI Deprecated, compatibility only. + template + ostreambuf_iterator<char> + num_put<char, ostreambuf_iterator<char> >:: + _M_convert_int(ostreambuf_iterator<char>, ios_base&, char, char, char, + long) const; + + template + ostreambuf_iterator<char> + num_put<char, ostreambuf_iterator<char> >:: + _M_convert_int(ostreambuf_iterator<char>, ios_base&, char, char, char, + unsigned long) const; + +#ifdef _GLIBCPP_USE_LONG_LONG + template + ostreambuf_iterator<char> + num_put<char, ostreambuf_iterator<char> >:: + _M_convert_int(ostreambuf_iterator<char>, ios_base&, char, char, char, + long long) const; + + template + ostreambuf_iterator<char> + num_put<char, ostreambuf_iterator<char> >:: + _M_convert_int(ostreambuf_iterator<char>, ios_base&, char, char, char, + unsigned long long) const; +#endif + +#ifdef _GLIBCPP_USE_WCHAR_T + template + ostreambuf_iterator<wchar_t> + num_put<wchar_t, ostreambuf_iterator<wchar_t> >:: + _M_convert_int(ostreambuf_iterator<wchar_t>, ios_base&, wchar_t, char, + char, long) const; + + template + ostreambuf_iterator<wchar_t> + num_put<wchar_t, ostreambuf_iterator<wchar_t> >:: + _M_convert_int(ostreambuf_iterator<wchar_t>, ios_base&, wchar_t, char, + char, unsigned long) const; + +#ifdef _GLIBCPP_USE_LONG_LONG + template + ostreambuf_iterator<wchar_t> + num_put<wchar_t, ostreambuf_iterator<wchar_t> >:: + _M_convert_int(ostreambuf_iterator<wchar_t>, ios_base&, wchar_t, char, + char, long long) const; + + template + ostreambuf_iterator<wchar_t> + num_put<wchar_t, ostreambuf_iterator<wchar_t> >:: + _M_convert_int(ostreambuf_iterator<wchar_t>, ios_base&, wchar_t, char, + char, unsigned long long) const; +#endif +#endif + +#endif + // time_get and time_put template class __timepunct<char>; template class time_put<char, ostreambuf_iterator<char> >; @@ -406,6 +465,17 @@ namespace std has_facet<messages<wchar_t> >(const locale&); #endif + // __use_cache + template + const __locale_cache<numpunct<char> >& + __use_cache<numpunct<char> >(const locale& __loc); + +#ifdef _GLIBCPP_USE_WCHAR_T + template + const __locale_cache<numpunct<wchar_t> >& + __use_cache<numpunct<wchar_t> >(const locale& __loc); +#endif + // locale template char* @@ -451,6 +521,7 @@ namespace std __convert_from_v(char*, const int, const char*, unsigned long, const __c_locale&, int); +#ifdef _GLIBCPP_USE_LONG_LONG template int __convert_from_v(char*, const int, const char*, long long, @@ -460,4 +531,31 @@ namespace std int __convert_from_v(char*, const int, const char*, unsigned long long, const __c_locale&, int); +#endif + + template + int + __int_to_char(char*, const int, unsigned long, const char*, + ios_base::fmtflags, bool); + +#ifdef _GLIBCPP_USE_WCHAR_T + template + int + __int_to_char(wchar_t*, const int, unsigned long, const wchar_t*, + ios_base::fmtflags, bool); +#endif + +#ifdef _GLIBCPP_USE_LONG_LONG + template + int + __int_to_char(char*, const int, unsigned long long, const char*, + ios_base::fmtflags, bool); + +#ifdef _GLIBCPP_USE_WCHAR_T + template + int + __int_to_char(wchar_t*, const int, unsigned long long, const wchar_t*, + ios_base::fmtflags, bool); +#endif +#endif } // namespace std diff --git a/contrib/libstdc++/src/locale.cc b/contrib/libstdc++/src/locale.cc index f16ca0d..17ccdc2 100644 --- a/contrib/libstdc++/src/locale.cc +++ b/contrib/libstdc++/src/locale.cc @@ -28,7 +28,6 @@ #include <clocale> #include <cstring> -#include <cassert> #include <cctype> #include <cwctype> // For towupper, etc. #include <locale> @@ -208,9 +207,8 @@ namespace std // different from LANG. size_t __i = 0; if (strcmp(__res, "C") == 0) - for (__i = 0; - __i < _S_categories_size + _S_extra_categories_size; - ++__i) + for (; __i < _S_categories_size + + _S_extra_categories_size; ++__i) { __env = getenv(_S_categories[__i]); if (__env && strcmp(__env, "") != 0 @@ -219,9 +217,8 @@ namespace std break; } else - for (__i = 0; - __i < _S_categories_size + _S_extra_categories_size; - ++__i) + for (; __i < _S_categories_size + + _S_extra_categories_size; ++__i) { __env = getenv(_S_categories[__i]); if (__env && strcmp(__env, "") != 0 @@ -237,14 +234,14 @@ namespace std for (size_t __j = 0; __j < __i; ++__j) { __str += _S_categories[__j]; - __str += "="; + __str += '='; __str += __res; - __str += ";"; + __str += ';'; } __str += _S_categories[__i]; - __str += "="; + __str += '='; __str += __env; - __str += ";"; + __str += ';'; __i++; for (; __i < _S_categories_size + _S_extra_categories_size; ++__i) @@ -266,9 +263,9 @@ namespace std else { __str += _S_categories[__i]; - __str += "="; + __str += '='; __str += __env; - __str += ";"; + __str += ';'; } } __str.erase(__str.end() - 1); @@ -349,15 +346,15 @@ namespace std else { __ret += _S_categories[0]; - __ret += "="; + __ret += '='; __ret += _M_impl->_M_names[0]; for (size_t __i = 1; __i < _S_categories_size + _S_extra_categories_size; ++__i) { - __ret += ";"; + __ret += ';'; __ret += _S_categories[__i]; - __ret += "="; + __ret += '='; __ret += _M_impl->_M_names[__i]; } } @@ -504,13 +501,16 @@ namespace std const money_base::pattern money_base::_S_default_pattern = { {symbol, sign, none, value} }; - const char __num_base::_S_atoms[] = "0123456789eEabcdfABCDF"; + const char* __num_base::_S_atoms_in = "0123456789eEabcdfABCDF"; + const char* __num_base::_S_atoms_out ="-+xX0123456789abcdef0123456789ABCDEF"; - bool - __num_base::_S_format_float(const ios_base& __io, char* __fptr, char __mod, - streamsize __prec) + // _GLIBCPP_RESOLVE_LIB_DEFECTS + // According to the resolution of DR 231, about 22.2.2.2.2, p11, + // "str.precision() is specified in the conversion specification". + void + __num_base::_S_format_float(const ios_base& __io, char* __fptr, + char __mod, streamsize/* unused post DR 231 */) { - bool __incl_prec = false; ios_base::fmtflags __flags = __io.flags(); *__fptr++ = '%'; // [22.2.2.2.2] Table 60 @@ -518,13 +518,12 @@ namespace std *__fptr++ = '+'; if (__flags & ios_base::showpoint) *__fptr++ = '#'; - // As per [22.2.2.2.2.11] - if (__flags & ios_base::fixed || __prec > 0) - { - *__fptr++ = '.'; - *__fptr++ = '*'; - __incl_prec = true; - } + + // As per DR 231: _always_, not only when + // __flags & ios_base::fixed || __prec > 0 + *__fptr++ = '.'; + *__fptr++ = '*'; + if (__mod) *__fptr++ = __mod; ios_base::fmtflags __fltfield = __flags & ios_base::floatfield; @@ -536,7 +535,6 @@ namespace std else *__fptr++ = (__flags & ios_base::uppercase) ? 'G' : 'g'; *__fptr = '\0'; - return __incl_prec; } void diff --git a/contrib/libstdc++/src/localename.cc b/contrib/libstdc++/src/localename.cc index e9debef..ec35fdb 100644 --- a/contrib/libstdc++/src/localename.cc +++ b/contrib/libstdc++/src/localename.cc @@ -1,4 +1,4 @@ -// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 +// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003 // Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free @@ -35,7 +35,8 @@ namespace __gnu_cxx using namespace std; // Defined in globals.cc. - extern locale::facet** facet_vec; + extern locale::facet* facet_vec[_GLIBCPP_NUM_FACETS]; + extern locale::facet* facet_cache_vec[2 * _GLIBCPP_NUM_FACETS]; extern char* facet_name[6 + _GLIBCPP_NUM_CATEGORIES]; extern std::ctype<char> ctype_c; @@ -68,6 +69,11 @@ namespace __gnu_cxx extern time_put<wchar_t> time_put_w; extern std::messages<wchar_t> messages_w; #endif + + extern std::__locale_cache<numpunct<char> > locale_cache_np_c; +#ifdef _GLIBCPP_USE_WCHAR_T + extern std::__locale_cache<numpunct<wchar_t> > locale_cache_np_w; +#endif } // namespace __gnu_cxx namespace std @@ -77,9 +83,13 @@ namespace std locale::_Impl:: ~_Impl() throw() { + // Clean up facets, then caches. No cache refcounts for now. for (size_t __i = 0; __i < _M_facets_size; ++__i) if (_M_facets[__i]) _M_facets[__i]->_M_remove_reference(); + for (size_t __i = _M_facets_size; __i < 2*_M_facets_size; ++__i) + if (_M_facets[__i]) + delete (__locale_cache_base*)_M_facets[__i]; delete [] _M_facets; for (size_t __i = 0; @@ -94,8 +104,9 @@ namespace std { try { - _M_facets = new facet*[_M_facets_size]; - for (size_t __i = 0; __i < _M_facets_size; ++__i) + // Space for facets and matching caches + _M_facets = new facet*[2*_M_facets_size]; + for (size_t __i = 0; __i < 2*_M_facets_size; ++__i) _M_facets[__i] = 0; } catch(...) @@ -129,9 +140,10 @@ namespace std locale::facet::_S_create_c_locale(__cloc, __s); try - { - _M_facets = new facet*[_M_facets_size]; - for (size_t __i = 0; __i < _M_facets_size; ++__i) + { + // Space for facets and matching caches + _M_facets = new facet*[2*_M_facets_size]; + for (size_t __i = 0; __i < 2*_M_facets_size; ++__i) _M_facets[__i] = 0; } catch(...) @@ -167,7 +179,7 @@ namespace std _M_names[__i] = __new; } } - + // Construct all standard facets and add them to _M_facets. _M_init_facet(new std::ctype<char>(__cloc, 0, false)); _M_init_facet(new codecvt<char, char, mbstate_t>); @@ -214,8 +226,9 @@ namespace std locale::facet::_S_create_c_locale(locale::facet::_S_c_locale, locale::facet::_S_c_name); - _M_facets = new(&facet_vec) facet*[_M_facets_size]; - for (size_t __i = 0; __i < _M_facets_size; ++__i) + // Space for facets and matching caches + _M_facets = new(&facet_cache_vec) facet*[2*_M_facets_size]; + for (size_t __i = 0; __i < 2*_M_facets_size; ++__i) _M_facets[__i] = 0; // Name all the categories. @@ -263,6 +276,25 @@ namespace std _M_init_facet(new (&time_put_w) time_put<wchar_t>(1)); _M_init_facet(new (&messages_w) std::messages<wchar_t>(1)); #endif + + // Initialize the static locale caches for C locale. + + locale ltmp(this); // Doesn't bump refcount + _M_add_reference(); // Bump so destructor doesn't trash us + + // These need to be built in static allocated memory. There must + // be a better way to do this! + __locale_cache<numpunct<char> >* __lc = + new (&locale_cache_np_c) __locale_cache<numpunct<char> >(ltmp, true); + _M_facets[numpunct<char>::id._M_id() + _M_facets_size] = + reinterpret_cast<locale::facet*>(__lc); + +#ifdef _GLIBCPP_USE_WCHAR_T + __locale_cache<numpunct<wchar_t> >* __wlc = + new (&locale_cache_np_w) __locale_cache<numpunct<wchar_t> >(ltmp, true); + _M_facets[numpunct<wchar_t>::id._M_id() + _M_facets_size] = + reinterpret_cast<locale::facet*>(__wlc); +#endif } void @@ -322,11 +354,16 @@ namespace std facet** __old = _M_facets; facet** __new; const size_t __new_size = __index + 4; - __new = new facet*[__new_size]; + __new = new facet*[2 * __new_size]; for (size_t __i = 0; __i < _M_facets_size; ++__i) __new[__i] = _M_facets[__i]; for (size_t __i2 = _M_facets_size; __i2 < __new_size; ++__i2) __new[__i2] = 0; + // Also copy caches and clear extra space + for (size_t __i = 0; __i < _M_facets_size; ++__i) + __new[__i + __new_size] = _M_facets[__i + _M_facets_size]; + for (size_t __i2 = _M_facets_size; __i2 < __new_size; ++__i2) + __new[__i2 + __new_size] = 0; _M_facets_size = __new_size; _M_facets = __new; diff --git a/contrib/libstdc++/src/misc-inst.cc b/contrib/libstdc++/src/misc-inst.cc index f4f2ab1..61cb1b3 100644 --- a/contrib/libstdc++/src/misc-inst.cc +++ b/contrib/libstdc++/src/misc-inst.cc @@ -37,6 +37,7 @@ #include <ostream> #include <algorithm> #include <vector> +#include <bits/atomicity.h> namespace std { @@ -67,6 +68,9 @@ namespace std basic_istream<wchar_t>& getline(basic_istream<wchar_t>&, wstring&); #endif +#ifdef _GLIBCPP_INST_ATOMICITY_LOCK + template volatile int __Atomicity_lock<0>::_S_atomicity_lock; +#endif #if 1 // XXX @@ -82,4 +86,22 @@ namespace std (vector<string>::const_iterator, vector<string>::const_iterator, string*, __false_type); #endif -} //std +} // namespace std + +#ifdef _GLIBCPP_NEED_GENERIC_MUTEX +namespace __gnu_cxx +{ +#ifdef __GTHREAD_MUTEX_INIT + __gthread_mutex_t _Atomic_add_mutex = __GTHREAD_MUTEX_INIT; +#else + // generic atomicity.h without static initialization + __gthread_mutex_t _Atomic_add_mutex; + __gthread_once_t _Atomic_add_mutex_once = __GTHREAD_ONCE_INIT; + void __gthread_atomic_add_mutex_once() + { + __GTHREAD_MUTEX_INIT_FUNCTION (&_Atomic_add_mutex); + } +#endif +} // namespace __gnu_cxx +#endif // _GLIBCPP_NEED_GLOBAL_MUTEX + diff --git a/contrib/libstdc++/src/ostream-inst.cc b/contrib/libstdc++/src/ostream-inst.cc index e43b0c7..b834640 100644 --- a/contrib/libstdc++/src/ostream-inst.cc +++ b/contrib/libstdc++/src/ostream-inst.cc @@ -73,4 +73,4 @@ namespace std template wostream& operator<<(wostream&, _Setprecision); template wostream& operator<<(wostream&, _Setw); #endif -} //std +} // namespace std diff --git a/contrib/libstdc++/src/sstream-inst.cc b/contrib/libstdc++/src/sstream-inst.cc index e341f5f..6c0272b 100644 --- a/contrib/libstdc++/src/sstream-inst.cc +++ b/contrib/libstdc++/src/sstream-inst.cc @@ -59,4 +59,4 @@ namespace std #ifdef _GLIBCPP_USE_WCHAR_T template class basic_stringstream<wchar_t>; #endif -} //std +} // namespace std diff --git a/contrib/libstdc++/src/strstream.cc b/contrib/libstdc++/src/strstream.cc index 4d58565..00f5b73 100644 --- a/contrib/libstdc++/src/strstream.cc +++ b/contrib/libstdc++/src/strstream.cc @@ -1,6 +1,6 @@ // strstream definitions -*- C++ -*- -// Copyright (C) 2001, 2002 Free Software Foundation +// Copyright (C) 2001, 2002, 2003 Free Software Foundation // // 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 @@ -148,7 +148,7 @@ namespace std if (pptr() == epptr() && _M_dynamic && !_M_frozen && !_M_constant) { ptrdiff_t old_size = epptr() - pbase(); - ptrdiff_t new_size = max(2 * old_size, ptrdiff_t(1)); + ptrdiff_t new_size = max(ptrdiff_t(2 * old_size), ptrdiff_t(1)); char* buf = _M_alloc(new_size); if (buf) diff --git a/contrib/libstdc++/src/valarray-inst.cc b/contrib/libstdc++/src/valarray-inst.cc index b56a911..a45a616 100644 --- a/contrib/libstdc++/src/valarray-inst.cc +++ b/contrib/libstdc++/src/valarray-inst.cc @@ -35,7 +35,7 @@ namespace std { - // Some explicit instanciations. + // Some explicit instantiations. template void __valarray_fill(size_t* __restrict__, size_t, const size_t&); @@ -112,7 +112,5 @@ namespace std const valarray<size_t>& __s) : _M_count(1), _M_start(__o), _M_size(__l), _M_stride(__s), _M_index(__l.size() == 0 ? 0 : __valarray_product(__l)) - { __gslice_to_index(__o, __l, __s, _M_index); } - + { __gslice_to_index(__o, __l, __s, _M_index); } } // namespace std - |