Go to file
Jonathan Wakely cd0b94e650 Replace std::to_string for integers with optimized version
The std::to_chars functions from C++17 can be used to implement
std::to_string with much better performance than calling snprintf. Only
the __detail::__to_chars_len and __detail::__to_chars_10 functions are
needed for to_string, because it always outputs base 10 representations.

The return type of __detail::__to_chars_10 should not be declared before
C++17, so the function body is extracted into a new function that can be
reused by to_string and __detail::__to_chars_10.

The existing tests for to_chars rely on to_string to check for correct
answers. Now that they use the same code that doesn't actually ensure
correctness, so add new tests for std::to_string that compare against
printf output.

	* include/Makefile.am: Add new <bits/charconv.h> header.
	* include/Makefile.in: Regenerate.
	* include/bits/basic_string.h (to_string(int), to_string(unsigned))
	(to_string(long), to_string(unsigned long), to_string(long long))
	(to_string(unsigned long long)): Rewrite to use __to_chars_10_impl.
	* include/bits/charconv.h: New header.
	(__detail::__to_chars_len): Move here from <charconv>.
	(__detail::__to_chars_10_impl): New function extracted from
	__detail::__to_chars_10.
	* include/std/charconv (__cpp_lib_to_chars): Add, but comment out.
	(__to_chars_unsigned_type): New class template that reuses
	__make_unsigned_selector_base::__select to pick a type.
	(__unsigned_least_t): Redefine as __to_chars_unsigned_type<T>::type.
	(__detail::__to_chars_len): Move to new header.
	(__detail::__to_chars_10): Add inline specifier. Move code doing the
	output to __detail::__to_chars_10_impl and call that.
	* include/std/version (__cpp_lib_to_chars): Add, but comment out.
	* testsuite/21_strings/basic_string/numeric_conversions/char/
	to_string.cc: Fix reference in comment. Remove unused variable.
	* testsuite/21_strings/basic_string/numeric_conversions/char/
	to_string_int.cc: New test.

From-SVN: r272186
2019-06-12 15:52:02 +01:00
INSTALL
config Generalize getconf _NPROCESSORS_ONLN 2019-05-30 09:06:48 +00:00
contrib
fixincludes
gcc Disable hash-table sanitization for mem stats maps. 2019-06-12 13:07:07 +00:00
gnattools
gotools Makefile.am (check-go-tool): Only chmod check-go-dir if it exists. 2019-05-27 19:21:22 +00:00
include Add warn_unused_result attribute for memory-related functions in libiberty. 2019-06-10 07:42:43 +00:00
intl
libada
libatomic
libbacktrace
libcc1
libcpp
libdecnumber
libffi
libgcc * libgcov-merge.c (__gcov_merge_single): Revert previous change. 2019-06-11 09:54:17 +02:00
libgfortran
libgo go/internal/gccgoimporter: ignore unexported and imported names 2019-06-07 00:07:50 +00:00
libgomp re PR target/90811 ([nvptx] ptxas error on OpenMP offloaded code) 2019-06-11 18:40:10 +02:00
libhsail-rt
libiberty cp-demangle.c: Don't define CP_DYNAMIC_ARRAYS if __STDC_NO_VLA__ is non-zero. 2019-05-31 12:25:48 -06:00
libitm
libobjc
liboffloadmic
libphobos
libquadmath
libsanitizer rs6000: Fix sanitizer build (PR90639) 2019-05-27 21:12:19 +02:00
libssp
libstdc++-v3 Replace std::to_string for integers with optimized version 2019-06-12 15:52:02 +01:00
libvtv
lto-plugin
maintainer-scripts
zlib
.dir-locals.el
.gitattributes
.gitignore
ABOUT-NLS
COPYING
COPYING.LIB
COPYING.RUNTIME
COPYING3
COPYING3.LIB
ChangeLog removed extra .com, fixed e-mail. 2019-06-11 20:15:43 +00:00
ChangeLog.jit
ChangeLog.tree-ssa
MAINTAINERS * MAINTAINERS (Write After Approval): Add myself. 2019-06-11 19:31:36 +00:00
Makefile.def Import these changes from the binutils/gdb repository: 2019-06-11 12:05:49 +00:00
Makefile.in Import these changes from the binutils/gdb repository: 2019-06-11 12:05:49 +00:00
Makefile.tpl
README
ar-lib
compile
config-ml.in
config.guess
config.rpath
config.sub
configure Import these changes from the binutils/gdb repository: 2019-06-11 12:05:49 +00:00
configure.ac Import these changes from the binutils/gdb repository: 2019-06-11 12:05:49 +00:00
depcomp
install-sh
libtool-ldflags
libtool.m4
ltgcc.m4
ltmain.sh
ltoptions.m4
ltsugar.m4
ltversion.m4
lt~obsolete.m4
missing
mkdep
mkinstalldirs
move-if-change
multilib.am
symlink-tree
test-driver
ylwrap

README

This directory contains the GNU Compiler Collection (GCC).

The GNU Compiler Collection is free software.  See the files whose
names start with COPYING for copying permission.  The manuals, and
some of the runtime libraries, are under different terms; see the
individual source files for details.

The directory INSTALL contains copies of the installation information
as HTML and plain text.  The source of this information is
gcc/doc/install.texi.  The installation information includes details
of what is included in the GCC sources and what files GCC installs.

See the file gcc/doc/gcc.texi (together with other files that it
includes) for usage and porting information.  An online readable
version of the manual is in the files gcc/doc/gcc.info*.

See http://gcc.gnu.org/bugs/ for how to report bugs usefully.

Copyright years on GCC source files may be listed using range
notation, e.g., 1987-2012, indicating that every year in the range,
inclusive, is a copyrightable year that could otherwise be listed
individually.