From 5cd0e876bdba6f1eaca381a397f97a47c7e16da9 Mon Sep 17 00:00:00 2001 From: Justine Tunney Date: Sun, 26 Jun 2022 04:58:44 -0700 Subject: [PATCH] Scrub double-conversion and add quick wrapper --- libc/intrin/asan.c | 6 + libc/intrin/somanyasan.S | 12 - test/libc/tinymath/strtod_test.c | 14 ++ test/libc/tinymath/test.mk | 3 +- third_party/double-conversion/.gitignore | 31 --- third_party/double-conversion/COPYING | 26 --- third_party/double-conversion/Changelog | 158 ------------- third_party/double-conversion/README.md | 55 ----- third_party/double-conversion/bignum-dtoa.cc | 11 +- third_party/double-conversion/bignum-dtoa.h | 30 +-- third_party/double-conversion/bignum.cc | 12 +- third_party/double-conversion/bignum.h | 30 +-- .../double-conversion/cached-powers.cc | 11 +- third_party/double-conversion/cached-powers.h | 30 +-- third_party/double-conversion/diy-fp.h | 30 +-- .../double-conversion/double-conversion.h | 31 +-- .../double-conversion/double-conversion.mk | 218 +++++++++--------- .../double-conversion/double-to-string.cc | 17 +- .../double-conversion/double-to-string.h | 30 +-- third_party/double-conversion/fast-dtoa.cc | 10 +- third_party/double-conversion/fast-dtoa.h | 30 +-- third_party/double-conversion/fixed-dtoa.cc | 10 +- third_party/double-conversion/fixed-dtoa.h | 30 +-- third_party/double-conversion/ieee.h | 30 +-- .../double-conversion/string-to-double.cc | 17 +- third_party/double-conversion/strtod.cc | 12 +- third_party/double-conversion/strtod.h | 30 +-- third_party/double-conversion/test/cctest.cc | 4 +- third_party/double-conversion/test/cctest.h | 6 +- third_party/double-conversion/test/checks.h | 4 +- .../double-conversion/test/gay-fixed.cc | 1 + .../double-conversion/test/gay-precision.cc | 1 + .../test/gay-shortest-single.cc | 1 + .../double-conversion/test/gay-shortest.cc | 1 + .../test/test-bignum-dtoa.cc | 8 +- .../double-conversion/test/test-bignum.cc | 4 +- .../test/test-conversions.cc | 5 +- .../double-conversion/test/test-diy-fp.cc | 5 +- .../double-conversion/test/test-dtoa.cc | 8 +- .../double-conversion/test/test-fast-dtoa.cc | 11 +- .../double-conversion/test/test-fixed-dtoa.cc | 8 +- .../double-conversion/test/test-ieee.cc | 9 +- .../double-conversion/test/test-strtod.cc | 5 +- third_party/double-conversion/utils.h | 60 +---- third_party/double-conversion/wrapper.cc | 50 ++++ third_party/double-conversion/wrapper.h | 11 + 46 files changed, 322 insertions(+), 804 deletions(-) delete mode 100644 third_party/double-conversion/.gitignore delete mode 100644 third_party/double-conversion/COPYING delete mode 100644 third_party/double-conversion/Changelog delete mode 100644 third_party/double-conversion/README.md create mode 100644 third_party/double-conversion/wrapper.cc create mode 100644 third_party/double-conversion/wrapper.h diff --git a/libc/intrin/asan.c b/libc/intrin/asan.c index 6bd69346d..fef44c54a 100644 --- a/libc/intrin/asan.c +++ b/libc/intrin/asan.c @@ -1277,6 +1277,12 @@ void __sanitizer_annotate_contiguous_container(char *beg, char *end, __asan_poison(new_mid, end - new_mid, kAsanHeapOverrun); } +void __asan_before_dynamic_init(const char *module_name) { +} + +void __asan_after_dynamic_init(void) { +} + void __asan_install_malloc_hooks(void) { HOOK(hook_free, __asan_free); HOOK(hook_malloc, __asan_malloc); diff --git a/libc/intrin/somanyasan.S b/libc/intrin/somanyasan.S index a473f4a8b..a05b12620 100644 --- a/libc/intrin/somanyasan.S +++ b/libc/intrin/somanyasan.S @@ -196,18 +196,6 @@ __asan_version_mismatch_check_v8: pop %rdi .init.end 303,_init_asan -__asan_before_dynamic_init: - push %rbp - mov %rsp,%rbp - ud2 - .endfn __asan_before_dynamic_init,globl - -__asan_after_dynamic_init: - push %rbp - mov %rsp,%rbp - ud2 - .endfn __asan_after_dynamic_init,globl - __asan_load1: push %rbp mov %rsp,%rbp diff --git a/test/libc/tinymath/strtod_test.c b/test/libc/tinymath/strtod_test.c index deebfd39f..cc7a70a96 100644 --- a/test/libc/tinymath/strtod_test.c +++ b/test/libc/tinymath/strtod_test.c @@ -16,11 +16,14 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ +#include "libc/fmt/fmt.h" #include "libc/macros.internal.h" #include "libc/runtime/fenv.h" #include "libc/runtime/gc.internal.h" +#include "libc/testlib/ezbench.h" #include "libc/testlib/testlib.h" #include "libc/x/x.h" +#include "third_party/double-conversion/wrapper.h" #include "third_party/gdtoa/gdtoa.h" #define HEX(d) (union Pun){d}.i @@ -401,3 +404,14 @@ TEST(strtod, testTowardzero) { free(p); } } + +BENCH(strtod, bench) { + char buf[128]; + EZBENCH2("strtod", donothing, strtod("-1.79769313486231e+308", 0)); + EZBENCH2("StringToDouble", donothing, + StringToDouble("-1.79769313486231e+308", 22, 0)); + EZBENCH2("snprintf %g", donothing, + snprintf(buf, 128, "%g", -1.79769313486231e+308)); + EZBENCH2("DoubleToEcmascript", donothing, + DoubleToEcmascript(buf, -1.79769313486231e+308)); +} diff --git a/test/libc/tinymath/test.mk b/test/libc/tinymath/test.mk index 931e7e706..c3da9b72e 100644 --- a/test/libc/tinymath/test.mk +++ b/test/libc/tinymath/test.mk @@ -38,7 +38,8 @@ TEST_LIBC_TINYMATH_DIRECTDEPS = \ LIBC_TINYMATH \ LIBC_UNICODE \ LIBC_X \ - THIRD_PARTY_GDTOA + THIRD_PARTY_GDTOA \ + THIRD_PARTY_DOUBLECONVERSION TEST_LIBC_TINYMATH_DEPS := \ $(call uniq,$(foreach x,$(TEST_LIBC_TINYMATH_DIRECTDEPS),$($(x)))) diff --git a/third_party/double-conversion/.gitignore b/third_party/double-conversion/.gitignore deleted file mode 100644 index e402d0799..000000000 --- a/third_party/double-conversion/.gitignore +++ /dev/null @@ -1,31 +0,0 @@ -.sconsign.dblite -*~ -*.o -*.obj -msvc/Release/ -msvc/Debug/ -*.suo -*.opensdf -*.sdf -*.user -*.a -*.so -*.so.* -*.dylib -/run_tests -Makefile -CMakeLists.txt.user -CMakeCache.txt -CMakeFiles -CMakeScripts -Testing -cmake_install.cmake -install_manifest.txt -compile_commands.json -CTestTestfile.cmake -_deps -*.cmake -*.kdev4 -DartConfiguration.tcl -bazel-* -.cache diff --git a/third_party/double-conversion/COPYING b/third_party/double-conversion/COPYING deleted file mode 100644 index 933718a9e..000000000 --- a/third_party/double-conversion/COPYING +++ /dev/null @@ -1,26 +0,0 @@ -Copyright 2006-2011, the V8 project authors. All rights reserved. -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following - disclaimer in the documentation and/or other materials provided - with the distribution. - * Neither the name of Google Inc. nor the names of its - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/third_party/double-conversion/Changelog b/third_party/double-conversion/Changelog deleted file mode 100644 index 200e98a93..000000000 --- a/third_party/double-conversion/Changelog +++ /dev/null @@ -1,158 +0,0 @@ -2022-01-10: - Fix quiet NANs on MIPS* and PA-RISC architectures. - Update version number. - -2021-12-22: - Add support of Synopsys ARC64 architecture. - Reintroduce macros, if DOUBLE_CONVERSION_NON_PREFIXED_MACROS is set. - -2021-12-04: - Update version number. - -2021-10-04: - Consistently use semicolons after DOUBLE_CONVERSION_ASSERT. - -2021-07-16: - Fix spelling. - -2021-05-19: - Loongarch is a RISC-style command system architecture. - Add support for loongarch architecture. - -2020-02-16: - Add support for quiet and signaling NaNs to ieee header. - -2019-10-31: - Add support for xtensa architecture. - Add support for nios2 architecture. - -2019-10-12: - Really add support for microblaze. A previous commit was lacking - the necessary line. - -2019-09-02: - Add support for e2k architecture. Thanks to Michael Shigorin. - -2019-08-01: - Add min exponent width option in double-to-string conversion. - -2019-06-22: - Remove redundant parenthesis. - -2019-06-11: - Changed all macros to use DOUBLE_CONVERSION_ as prefix. - Renamed ALLOW_CASE_INSENSIBILITY to ALLOW_CASE_INSENSITIVITY, - the old name is still available but officially deprecated. - Created and exposed new intermediate function StrtodTrimmed(). - -2019-05-25: - Fix `0x` for string->double conversion when Hex Floats are allowed. - Avoid integer overflow when exponents for hex floats were too big. - Update version number. - -2019-04-22: - Fixed warning in gcc4.9. Thanks to Scott McCaskill - (https://github.com/usefulcat) for the patch. - -2019-04-16: - Merged changes to install libraries in the correct place when - using 64-bit libraries. - Contributed by Jason Zaman and (independently) - Dan Church (https://github.com/h3xx) - -2019-03-11: - Use relative includes in the library. This shouldn't have any visible effect - for consumers of the library. - - Update version number. - -2019-03-06: - Fix typo in test. - Update version number. - -2019-03-03: - Fix separator characters when they they don't fit into 8 bits. - Update version number. - -2019-02-16: - Check correctly for _MSC_VER. - Patch by Ben Boeckel - -2019-01-17: - Allow the library to be compiled for Emscripten. - Patch by Tim Paine. - -2018-09-15: - Update version numbers. This also updates the shared-library version number. - -2018-09-09: - Fix bug where large hex literals would lose their minus sign. - Added support for separator characters (which adds a new optional - argument). Thus increasing the version number to 3.1.0 - Added support for hexadecimal float literals. - Support for more architectures. - -2017-12-06: - Renamed `DISALLOW_COPY_AND_ASSIGN` and `DISALLOW_IMPLICIT_CONSTRUCTORS` - macros to `DC_DISALLOW_COPY_AND_ASSIGN` and - `DC_DISALLOW_IMPLICIT_CONSTRUCTORS` to make it easier to integrate the - library with other libraries that have similar macros. - -2017-08-05: - Tagged v3.0.0. - Due to the directory rename switching to a new version number. - The API for the library itself hasn't changed. - -2017-03-04: - Avoid negative shift. Fixes #41. - -2016-11-17: - Support RISC-V. - - -2016-09-10: - Add fPIC flag on x86_64 if the compiler supports it. Fixes #34. - -2015 and 2016: - Lots of improvements to the build system. - -2015: - Warning fixes. - -2015-05-19: - Rename 'src' directory to 'double-conversion'. - -2014-03-08: - Update version number for cmake. - Support shared libraries with cmake. - Add build instructions to the README. - -2014-01-12: - Tagged v2.0.1. - Fix compilation for ARMv8 64bit (used wrong define). - Improved SConstruct file. Thanks to Milan Bouchet-Valat and Elan Ruusamäe. - Fixed lots of warnings (especially on Windows). Thanks to Greg Smith. - -2013-11-09: - Tagged v2.0.0. - String-to-Double|Float: ALLOW_LEADING_SPACES and similar flags now include - new-lines, tabs and all Unicode whitespace characters. - -2013-11-09: - Tagged v1.1.2. - Add support for ARM 64 and OsX ppc. - Rewrite tests so they pass under Visual Studio. - Add CMake build system support. - Fix warnings. - -2012-06-10: - Tagged v1.1.1. - Null terminate exponent buffer (only an issue when asserts are enabled). - Support more architectures. - -2012-02-05: - Merged in Single-branch with single-precision support. - Tagged v1.1 (based on b28450f33e1db493948a535d8f84e88fa211bd10). - -2012-02-05: - Tagged v1.0 (based on eda0196e9ac8fcdf59e92cb62885ee0af5391969). diff --git a/third_party/double-conversion/README.md b/third_party/double-conversion/README.md deleted file mode 100644 index e5d9a4e68..000000000 --- a/third_party/double-conversion/README.md +++ /dev/null @@ -1,55 +0,0 @@ -https://github.com/google/double-conversion - -This project (double-conversion) provides binary-decimal and decimal-binary -routines for IEEE doubles. - -The library consists of efficient conversion routines that have been extracted -from the V8 JavaScript engine. The code has been refactored and improved so that -it can be used more easily in other projects. - -There is extensive documentation in `double-conversion/string-to-double.h` and -`double-conversion/double-to-string.h`. Other examples can be found in -`test/cctest/test-conversions.cc`. - - -Building -======== - -This library can be built with [scons][0] or [cmake][1]. -The checked-in Makefile simply forwards to scons, and provides a -shortcut to run all tests: - - make - make test - -Scons ------ - -The easiest way to install this library is to use `scons`. It builds -the static and shared library, and is set up to install those at the -correct locations: - - scons install - -Use the `DESTDIR` option to change the target directory: - - scons DESTDIR=alternative_directory install - -Cmake ------ - -To use cmake run `cmake .` in the root directory. This overwrites the -existing Makefile. - -Use `-DBUILD_SHARED_LIBS=ON` to enable the compilation of shared libraries. -Note that this disables static libraries. There is currently no way to -build both libraries at the same time with cmake. - -Use `-DBUILD_TESTING=ON` to build the test executable. - - cmake . -DBUILD_TESTING=ON - make - test/cctest/cctest - -[0]: http://www.scons.org/ -[1]: https://cmake.org/ diff --git a/third_party/double-conversion/bignum-dtoa.cc b/third_party/double-conversion/bignum-dtoa.cc index 395bebb25..b4731bbaf 100644 --- a/third_party/double-conversion/bignum-dtoa.cc +++ b/third_party/double-conversion/bignum-dtoa.cc @@ -24,13 +24,16 @@ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -#include "third_party/libcxx/cmath" - #include "third_party/double-conversion/bignum-dtoa.h" - #include "third_party/double-conversion/bignum.h" #include "third_party/double-conversion/ieee.h" +#include "third_party/libcxx/cmath" +// clang-format off + +asm(".ident\t\"\\n\\n\ +double-conversion (BSD-3 License)\\n\ +Copyright 2006-2012 the V8 project authors\""); +asm(".include \"libc/disclaimer.inc\""); namespace double_conversion { diff --git a/third_party/double-conversion/bignum-dtoa.h b/third_party/double-conversion/bignum-dtoa.h index 921622fd3..363a07a8c 100644 --- a/third_party/double-conversion/bignum-dtoa.h +++ b/third_party/double-conversion/bignum-dtoa.h @@ -1,34 +1,8 @@ -// Copyright 2010 the V8 project authors. All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following -// disclaimer in the documentation and/or other materials provided -// with the distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - +// -*- c++ -*- #ifndef DOUBLE_CONVERSION_BIGNUM_DTOA_H_ #define DOUBLE_CONVERSION_BIGNUM_DTOA_H_ - #include "third_party/double-conversion/utils.h" +// clang-format off namespace double_conversion { diff --git a/third_party/double-conversion/bignum.cc b/third_party/double-conversion/bignum.cc index 5a30d6e24..fa60c7ecd 100644 --- a/third_party/double-conversion/bignum.cc +++ b/third_party/double-conversion/bignum.cc @@ -24,12 +24,16 @@ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -#include "third_party/libcxx/algorithm" -#include "third_party/libcxx/cstring" - #include "third_party/double-conversion/bignum.h" #include "third_party/double-conversion/utils.h" +#include "third_party/libcxx/algorithm" +#include "third_party/libcxx/cstring" +// clang-format off + +asm(".ident\t\"\\n\\n\ +double-conversion (BSD-3 License)\\n\ +Copyright 2006-2012 the V8 project authors\""); +asm(".include \"libc/disclaimer.inc\""); namespace double_conversion { diff --git a/third_party/double-conversion/bignum.h b/third_party/double-conversion/bignum.h index 8bde27841..6777d912c 100644 --- a/third_party/double-conversion/bignum.h +++ b/third_party/double-conversion/bignum.h @@ -1,34 +1,8 @@ -// Copyright 2010 the V8 project authors. All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following -// disclaimer in the documentation and/or other materials provided -// with the distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - +// -*- c++ -*- #ifndef DOUBLE_CONVERSION_BIGNUM_H_ #define DOUBLE_CONVERSION_BIGNUM_H_ - #include "third_party/double-conversion/utils.h" +// clang-format off namespace double_conversion { diff --git a/third_party/double-conversion/cached-powers.cc b/third_party/double-conversion/cached-powers.cc index 37c96834f..84145f414 100644 --- a/third_party/double-conversion/cached-powers.cc +++ b/third_party/double-conversion/cached-powers.cc @@ -24,14 +24,17 @@ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - +#include "third_party/double-conversion/cached-powers.h" +#include "third_party/double-conversion/utils.h" #include "third_party/libcxx/climits" #include "third_party/libcxx/cmath" #include "third_party/libcxx/cstdarg" +// clang-format off -#include "third_party/double-conversion/utils.h" - -#include "third_party/double-conversion/cached-powers.h" +asm(".ident\t\"\\n\\n\ +double-conversion (BSD-3 License)\\n\ +Copyright 2006-2012 the V8 project authors\""); +asm(".include \"libc/disclaimer.inc\""); namespace double_conversion { diff --git a/third_party/double-conversion/cached-powers.h b/third_party/double-conversion/cached-powers.h index 0f0774e23..301befa40 100644 --- a/third_party/double-conversion/cached-powers.h +++ b/third_party/double-conversion/cached-powers.h @@ -1,34 +1,8 @@ -// Copyright 2010 the V8 project authors. All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following -// disclaimer in the documentation and/or other materials provided -// with the distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - +// -*- c++ -*- #ifndef DOUBLE_CONVERSION_CACHED_POWERS_H_ #define DOUBLE_CONVERSION_CACHED_POWERS_H_ - #include "third_party/double-conversion/diy-fp.h" +// clang-format off namespace double_conversion { diff --git a/third_party/double-conversion/diy-fp.h b/third_party/double-conversion/diy-fp.h index d8b903106..4bb2a39d6 100644 --- a/third_party/double-conversion/diy-fp.h +++ b/third_party/double-conversion/diy-fp.h @@ -1,34 +1,8 @@ -// Copyright 2010 the V8 project authors. All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following -// disclaimer in the documentation and/or other materials provided -// with the distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - +// -*- c++ -*- #ifndef DOUBLE_CONVERSION_DIY_FP_H_ #define DOUBLE_CONVERSION_DIY_FP_H_ - #include "third_party/double-conversion/utils.h" +// clang-format off namespace double_conversion { diff --git a/third_party/double-conversion/double-conversion.h b/third_party/double-conversion/double-conversion.h index 28f44c4f9..fcca7c311 100644 --- a/third_party/double-conversion/double-conversion.h +++ b/third_party/double-conversion/double-conversion.h @@ -1,34 +1,5 @@ -// Copyright 2012 the V8 project authors. All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following -// disclaimer in the documentation and/or other materials provided -// with the distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - #ifndef DOUBLE_CONVERSION_DOUBLE_CONVERSION_H_ #define DOUBLE_CONVERSION_DOUBLE_CONVERSION_H_ - -#include "third_party/double-conversion/string-to-double.h" #include "third_party/double-conversion/double-to-string.h" - +#include "third_party/double-conversion/string-to-double.h" #endif // DOUBLE_CONVERSION_DOUBLE_CONVERSION_H_ diff --git a/third_party/double-conversion/double-conversion.mk b/third_party/double-conversion/double-conversion.mk index 269fafb93..3a75a29eb 100644 --- a/third_party/double-conversion/double-conversion.mk +++ b/third_party/double-conversion/double-conversion.mk @@ -4,152 +4,158 @@ PKGS += THIRD_PARTY_DOUBLECONVERSION THIRD_PARTY_DOUBLECONVERSION_ARTIFACTS += THIRD_PARTY_DOUBLECONVERSION_A -THIRD_PARTY_DOUBLECONVERSION = $(THIRD_PARTY_DOUBLECONVERSION_A_DEPS) \ - $(THIRD_PARTY_DOUBLECONVERSION_A) -THIRD_PARTY_DOUBLECONVERSION_A = o/$(MODE)/third_party/double-conversion/libdouble-conversion.a + +THIRD_PARTY_DOUBLECONVERSION = \ + $(THIRD_PARTY_DOUBLECONVERSION_A_DEPS) \ + $(THIRD_PARTY_DOUBLECONVERSION_A) + +THIRD_PARTY_DOUBLECONVERSION_A = \ + o/$(MODE)/third_party/double-conversion/libdouble-conversion.a THIRD_PARTY_DOUBLECONVERSION_A_FILES := $(wildcard third_party/double-conversion/*) +THIRD_PARTY_DOUBLECONVERSION_A_SRCS_C = $(filter %.c,$(THIRD_PARTY_DOUBLECONVERSION_A_FILES)) THIRD_PARTY_DOUBLECONVERSION_A_SRCS_CC = $(filter %.cc,$(THIRD_PARTY_DOUBLECONVERSION_A_FILES)) THIRD_PARTY_DOUBLECONVERSION_A_HDRS = $(filter %.h,$(THIRD_PARTY_DOUBLECONVERSION_A_FILES)) -THIRD_PARTY_DOUBLECONVERSION_TEST_COMS = \ - o/$(MODE)/third_party/double-conversion/double-conversion-tester.com +THIRD_PARTY_DOUBLECONVERSION_A_SRCS = \ + $(THIRD_PARTY_DOUBLECONVERSION_A_SRCS_C) \ + $(THIRD_PARTY_DOUBLECONVERSION_A_SRCS_CC) -THIRD_PARTY_DOUBLECONVERSION_TEST_BINS = \ - $(THIRD_PARTY_DOUBLECONVERSION_TEST_COMS) \ - $(THIRD_PARTY_DOUBLECONVERSION_TEST_COMS:%=%.dbg) +THIRD_PARTY_DOUBLECONVERSION_TEST_COMS = \ + o/$(MODE)/third_party/double-conversion/double-conversion-tester.com -THIRD_PARTY_DOUBLECONVERSION_TEST_A_SRCS_CC = \ - third_party/double-conversion/test/cctest.cc \ - third_party/double-conversion/test/gay-fixed.cc \ - third_party/double-conversion/test/gay-precision.cc \ - third_party/double-conversion/test/gay-shortest.cc \ - third_party/double-conversion/test/gay-shortest-single.cc \ - third_party/double-conversion/test/test-bignum.cc \ - third_party/double-conversion/test/test-bignum-dtoa.cc \ - third_party/double-conversion/test/test-conversions.cc \ - third_party/double-conversion/test/test-diy-fp.cc \ - third_party/double-conversion/test/test-dtoa.cc \ - third_party/double-conversion/test/test-fast-dtoa.cc \ - third_party/double-conversion/test/test-fixed-dtoa.cc \ - third_party/double-conversion/test/test-ieee.cc \ +THIRD_PARTY_DOUBLECONVERSION_TEST_BINS = \ + $(THIRD_PARTY_DOUBLECONVERSION_TEST_COMS) \ + $(THIRD_PARTY_DOUBLECONVERSION_TEST_COMS:%=%.dbg) + +THIRD_PARTY_DOUBLECONVERSION_TEST_A_SRCS_CC = \ + third_party/double-conversion/test/cctest.cc \ + third_party/double-conversion/test/gay-fixed.cc \ + third_party/double-conversion/test/gay-precision.cc \ + third_party/double-conversion/test/gay-shortest.cc \ + third_party/double-conversion/test/gay-shortest-single.cc \ + third_party/double-conversion/test/test-bignum.cc \ + third_party/double-conversion/test/test-bignum-dtoa.cc \ + third_party/double-conversion/test/test-conversions.cc \ + third_party/double-conversion/test/test-diy-fp.cc \ + third_party/double-conversion/test/test-dtoa.cc \ + third_party/double-conversion/test/test-fast-dtoa.cc \ + third_party/double-conversion/test/test-fixed-dtoa.cc \ + third_party/double-conversion/test/test-ieee.cc \ third_party/double-conversion/test/test-strtod.cc -THIRD_PARTY_DOUBLECONVERSION_TEST_A_HDRS = \ - third_party/double-conversion/test/cctest.h \ - third_party/double-conversion/test/checks.h \ - third_party/double-conversion/test/gay-fixed.h \ - third_party/double-conversion/test/gay-precision.h \ - third_party/double-conversion/test/gay-shortest.h \ +THIRD_PARTY_DOUBLECONVERSION_TEST_A_HDRS = \ + third_party/double-conversion/test/cctest.h \ + third_party/double-conversion/test/checks.h \ + third_party/double-conversion/test/gay-fixed.h \ + third_party/double-conversion/test/gay-precision.h \ + third_party/double-conversion/test/gay-shortest.h \ third_party/double-conversion/test/gay-shortest-single.h -THIRD_PARTY_DOUBLECONVERSION_A_OBJS = \ +THIRD_PARTY_DOUBLECONVERSION_A_OBJS = \ + $(THIRD_PARTY_DOUBLECONVERSION_A_SRCS_C:%.c=o/$(MODE)/%.o) \ $(THIRD_PARTY_DOUBLECONVERSION_A_SRCS_CC:%.cc=o/$(MODE)/%.o) -THIRD_PARTY_DOUBLECONVERSION_A_CHECKS = \ - $(THIRD_PARTY_DOUBLECONVERSION_A).pkg \ +THIRD_PARTY_DOUBLECONVERSION_A_CHECKS = \ + $(THIRD_PARTY_DOUBLECONVERSION_A).pkg \ $(THIRD_PARTY_DOUBLECONVERSION_A_HDRS:%=o/$(MODE)/%.okk) -THIRD_PARTY_DOUBLECONVERSION_TEST_A_OBJS = \ +THIRD_PARTY_DOUBLECONVERSION_TEST_A_OBJS = \ $(THIRD_PARTY_DOUBLECONVERSION_TEST_A_SRCS_CC:%.cc=o/$(MODE)/%.o) -THIRD_PARTY_DOUBLECONVERSION_A_DIRECTDEPS = \ - LIBC_INTRIN \ - LIBC_NEXGEN32E \ - LIBC_MEM \ - LIBC_RUNTIME \ - LIBC_RAND \ - LIBC_STDIO \ - LIBC_FMT \ - LIBC_SYSV \ - LIBC_STR \ - LIBC_STUBS \ - LIBC_UNICODE \ - LIBC_TINYMATH \ - THIRD_PARTY_GDTOA \ +THIRD_PARTY_DOUBLECONVERSION_A_DIRECTDEPS = \ + LIBC_INTRIN \ + LIBC_NEXGEN32E \ + LIBC_MEM \ + LIBC_RUNTIME \ + LIBC_RAND \ + LIBC_STDIO \ + LIBC_FMT \ + LIBC_SYSV \ + LIBC_STR \ + LIBC_STUBS \ + LIBC_UNICODE \ + LIBC_TINYMATH \ + THIRD_PARTY_GDTOA \ THIRD_PARTY_LIBCXX -THIRD_PARTY_DOUBLECONVERSION_A_DEPS := \ +THIRD_PARTY_DOUBLECONVERSION_A_DEPS := \ $(call uniq,$(foreach x,$(THIRD_PARTY_DOUBLECONVERSION_A_DIRECTDEPS),$($(x)))) -$(THIRD_PARTY_DOUBLECONVERSION_A): \ - third_party/double-conversion/ \ - $(THIRD_PARTY_DOUBLECONVERSION_A).pkg \ +$(THIRD_PARTY_DOUBLECONVERSION_A): \ + third_party/double-conversion/ \ + $(THIRD_PARTY_DOUBLECONVERSION_A).pkg \ $(THIRD_PARTY_DOUBLECONVERSION_A_OBJS) -$(THIRD_PARTY_DOUBLECONVERSION_A).pkg: \ - $(THIRD_PARTY_DOUBLECONVERSION_A_OBJS) \ +$(THIRD_PARTY_DOUBLECONVERSION_A).pkg: \ + $(THIRD_PARTY_DOUBLECONVERSION_A_OBJS) \ $(foreach x,$(THIRD_PARTY_DOUBLECONVERSION_A_DIRECTDEPS),$($(x)_A).pkg) -$(THIRD_PARTY_DOUBLECONVERSION_A_OBJS): \ - OVERRIDE_CXXFLAGS += \ - -ffunction-sections \ +$(THIRD_PARTY_DOUBLECONVERSION_A_OBJS): \ + OVERRIDE_CXXFLAGS += \ + -ffunction-sections \ -fdata-sections -$(THIRD_PARTY_DOUBLECONVERSION_TEST_A_OBJS): \ - OVERRIDE_CXXFLAGS += \ - -DSTACK_FRAME_UNLIMITED \ - -ffunction-sections \ - -fdata-sections - -o/$(MODE)/third_party/double-conversion/double-conversion-tester.com.dbg: \ - $(THIRD_PARTY_DOUBLECONVERSION_A_DEPS) \ - $(THIRD_PARTY_DOUBLECONVERSION_A) \ - $(THIRD_PARTY_DOUBLECONVERSION_TEST_A_OBJS) \ - $(CRT) \ +o/$(MODE)/third_party/double-conversion/double-conversion-tester.com.dbg: \ + $(THIRD_PARTY_DOUBLECONVERSION_A_DEPS) \ + $(THIRD_PARTY_DOUBLECONVERSION_A) \ + $(THIRD_PARTY_DOUBLECONVERSION_TEST_A_OBJS) \ + $(CRT) \ $(APE_NO_MODIFY_SELF) @$(APELINK) -THIRD_PARTY_DOUBLECONVERSION_TEST_NAMES = \ - test-strtod \ - test-ieee \ - test-fixed-dtoa \ - test-fast-dtoa \ - test-dtoa \ - test-diy-fp \ - test-conversions \ - test-bignum-dtoa \ +THIRD_PARTY_DOUBLECONVERSION_TEST_NAMES = \ + test-strtod \ + test-ieee \ + test-fixed-dtoa \ + test-fast-dtoa \ + test-dtoa \ + test-diy-fp \ + test-conversions \ + test-bignum-dtoa \ test-bignum -THIRD_PARTY_DOUBLECONVERSION_TEST_RUNS = \ +THIRD_PARTY_DOUBLECONVERSION_TEST_RUNS = \ $(THIRD_PARTY_DOUBLECONVERSION_TEST_NAMES:%=o/$(MODE)/third_party/double-conversion/%.runs) -o/$(MODE)/third_party/double-conversion/test-strtod.runs: \ - o/$(MODE)/third_party/double-conversion/double-conversion-tester.com +# TODO(jart): find some way to run these under runitd + +o/$(MODE)/third_party/double-conversion/test-strtod.runs: \ + o/$(MODE)/third_party/double-conversion/double-conversion-tester.com @$(COMPILE) -ACHECK -tT$@ $< test-strtod - -o/$(MODE)/third_party/double-conversion/test-ieee.runs: \ - o/$(MODE)/third_party/double-conversion/double-conversion-tester.com + +o/$(MODE)/third_party/double-conversion/test-ieee.runs: \ + o/$(MODE)/third_party/double-conversion/double-conversion-tester.com @$(COMPILE) -ACHECK -tT$@ $< test-ieee - -o/$(MODE)/third_party/double-conversion/test-fixed-dtoa.runs: \ - o/$(MODE)/third_party/double-conversion/double-conversion-tester.com + +o/$(MODE)/third_party/double-conversion/test-fixed-dtoa.runs: \ + o/$(MODE)/third_party/double-conversion/double-conversion-tester.com @$(COMPILE) -ACHECK -tT$@ $< test-fixed-dtoa - -o/$(MODE)/third_party/double-conversion/test-fast-dtoa.runs: \ - o/$(MODE)/third_party/double-conversion/double-conversion-tester.com + +o/$(MODE)/third_party/double-conversion/test-fast-dtoa.runs: \ + o/$(MODE)/third_party/double-conversion/double-conversion-tester.com @$(COMPILE) -ACHECK -tT$@ $< test-fast-dtoa - -o/$(MODE)/third_party/double-conversion/test-dtoa.runs: \ - o/$(MODE)/third_party/double-conversion/double-conversion-tester.com + +o/$(MODE)/third_party/double-conversion/test-dtoa.runs: \ + o/$(MODE)/third_party/double-conversion/double-conversion-tester.com @$(COMPILE) -ACHECK -tT$@ $< test-dtoa - -o/$(MODE)/third_party/double-conversion/test-diy-fp.runs: \ - o/$(MODE)/third_party/double-conversion/double-conversion-tester.com + +o/$(MODE)/third_party/double-conversion/test-diy-fp.runs: \ + o/$(MODE)/third_party/double-conversion/double-conversion-tester.com @$(COMPILE) -ACHECK -tT$@ $< test-diy-fp - -o/$(MODE)/third_party/double-conversion/test-conversions.runs: \ - o/$(MODE)/third_party/double-conversion/double-conversion-tester.com + +o/$(MODE)/third_party/double-conversion/test-conversions.runs: \ + o/$(MODE)/third_party/double-conversion/double-conversion-tester.com @$(COMPILE) -ACHECK -tT$@ $< test-conversions - -o/$(MODE)/third_party/double-conversion/test-bignum-dtoa.runs: \ - o/$(MODE)/third_party/double-conversion/double-conversion-tester.com + +o/$(MODE)/third_party/double-conversion/test-bignum-dtoa.runs: \ + o/$(MODE)/third_party/double-conversion/double-conversion-tester.com @$(COMPILE) -ACHECK -tT$@ $< test-bignum-dtoa - -o/$(MODE)/third_party/double-conversion/test-bignum.runs: \ - o/$(MODE)/third_party/double-conversion/double-conversion-tester.com + +o/$(MODE)/third_party/double-conversion/test-bignum.runs: \ + o/$(MODE)/third_party/double-conversion/double-conversion-tester.com @$(COMPILE) -ACHECK -tT$@ $< test-bignum - + THIRD_PARTY_DOUBLECONVERSION_LIBS = $(foreach x,$(THIRD_PARTY_DOUBLECONVERSION_ARTIFACTS),$($(x))) THIRD_PARTY_DOUBLECONVERSION_SRCS = $(foreach x,$(THIRD_PARTY_DOUBLECONVERSION_ARTIFACTS),$($(x)_SRCS)) THIRD_PARTY_DOUBLECONVERSION_HDRS = $(foreach x,$(THIRD_PARTY_DOUBLECONVERSION_ARTIFACTS),$($(x)_HDRS)) @@ -157,6 +163,6 @@ THIRD_PARTY_DOUBLECONVERSION_CHECKS = $(foreach x,$(THIRD_PARTY_DOUBLECONVERSION THIRD_PARTY_DOUBLECONVERSION_OBJS = $(foreach x,$(THIRD_PARTY_DOUBLECONVERSION_ARTIFACTS),$($(x)_OBJS)) .PHONY: o/$(MODE)/third_party/double-conversion -o/$(MODE)/third_party/double-conversion: \ - $(THIRD_PARTY_DOUBLECONVERSION_CHECKS) \ - $(THIRD_PARTY_DOUBLECONVERSION_TEST_RUNS) +o/$(MODE)/third_party/double-conversion: \ + $(THIRD_PARTY_DOUBLECONVERSION_CHECKS) \ + $(THIRD_PARTY_DOUBLECONVERSION_TEST_RUNS) diff --git a/third_party/double-conversion/double-to-string.cc b/third_party/double-conversion/double-to-string.cc index 3296dfc22..88be6c942 100644 --- a/third_party/double-conversion/double-to-string.cc +++ b/third_party/double-conversion/double-to-string.cc @@ -24,18 +24,21 @@ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -#include "third_party/libcxx/algorithm" -#include "third_party/libcxx/climits" -#include "third_party/libcxx/cmath" - -#include "third_party/double-conversion/double-to-string.h" - #include "third_party/double-conversion/bignum-dtoa.h" +#include "third_party/double-conversion/double-to-string.h" #include "third_party/double-conversion/fast-dtoa.h" #include "third_party/double-conversion/fixed-dtoa.h" #include "third_party/double-conversion/ieee.h" #include "third_party/double-conversion/utils.h" +#include "third_party/libcxx/algorithm" +#include "third_party/libcxx/climits" +#include "third_party/libcxx/cmath" +// clang-format off + +asm(".ident\t\"\\n\\n\ +double-conversion (BSD-3 License)\\n\ +Copyright 2006-2012 the V8 project authors\""); +asm(".include \"libc/disclaimer.inc\""); namespace double_conversion { diff --git a/third_party/double-conversion/double-to-string.h b/third_party/double-conversion/double-to-string.h index 36b964330..76607fc9f 100644 --- a/third_party/double-conversion/double-to-string.h +++ b/third_party/double-conversion/double-to-string.h @@ -1,34 +1,8 @@ -// Copyright 2012 the V8 project authors. All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following -// disclaimer in the documentation and/or other materials provided -// with the distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - +// -*- c++ -*- #ifndef DOUBLE_CONVERSION_DOUBLE_TO_STRING_H_ #define DOUBLE_CONVERSION_DOUBLE_TO_STRING_H_ - #include "third_party/double-conversion/utils.h" +// clang-format off namespace double_conversion { diff --git a/third_party/double-conversion/fast-dtoa.cc b/third_party/double-conversion/fast-dtoa.cc index 48d09fd34..bdee254df 100644 --- a/third_party/double-conversion/fast-dtoa.cc +++ b/third_party/double-conversion/fast-dtoa.cc @@ -24,12 +24,16 @@ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -#include "third_party/double-conversion/fast-dtoa.h" - #include "third_party/double-conversion/cached-powers.h" #include "third_party/double-conversion/diy-fp.h" +#include "third_party/double-conversion/fast-dtoa.h" #include "third_party/double-conversion/ieee.h" +// clang-format off + +asm(".ident\t\"\\n\\n\ +double-conversion (BSD-3 License)\\n\ +Copyright 2006-2012 the V8 project authors\""); +asm(".include \"libc/disclaimer.inc\""); namespace double_conversion { diff --git a/third_party/double-conversion/fast-dtoa.h b/third_party/double-conversion/fast-dtoa.h index dd67af671..da649621a 100644 --- a/third_party/double-conversion/fast-dtoa.h +++ b/third_party/double-conversion/fast-dtoa.h @@ -1,34 +1,8 @@ -// Copyright 2010 the V8 project authors. All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following -// disclaimer in the documentation and/or other materials provided -// with the distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - +// -*- c++ -*- #ifndef DOUBLE_CONVERSION_FAST_DTOA_H_ #define DOUBLE_CONVERSION_FAST_DTOA_H_ - #include "third_party/double-conversion/utils.h" +// clang-format off namespace double_conversion { diff --git a/third_party/double-conversion/fixed-dtoa.cc b/third_party/double-conversion/fixed-dtoa.cc index 6f5bcc8c2..8f91cb60c 100644 --- a/third_party/double-conversion/fixed-dtoa.cc +++ b/third_party/double-conversion/fixed-dtoa.cc @@ -24,11 +24,15 @@ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -#include "third_party/libcxx/cmath" - #include "third_party/double-conversion/fixed-dtoa.h" #include "third_party/double-conversion/ieee.h" +#include "third_party/libcxx/cmath" +// clang-format off + +asm(".ident\t\"\\n\\n\ +double-conversion (BSD-3 License)\\n\ +Copyright 2006-2012 the V8 project authors\""); +asm(".include \"libc/disclaimer.inc\""); namespace double_conversion { diff --git a/third_party/double-conversion/fixed-dtoa.h b/third_party/double-conversion/fixed-dtoa.h index a8c4bdc46..10b9659b1 100644 --- a/third_party/double-conversion/fixed-dtoa.h +++ b/third_party/double-conversion/fixed-dtoa.h @@ -1,34 +1,8 @@ -// Copyright 2010 the V8 project authors. All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following -// disclaimer in the documentation and/or other materials provided -// with the distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - +// -*- c++ -*- #ifndef DOUBLE_CONVERSION_FIXED_DTOA_H_ #define DOUBLE_CONVERSION_FIXED_DTOA_H_ - #include "third_party/double-conversion/utils.h" +// clang-format off namespace double_conversion { diff --git a/third_party/double-conversion/ieee.h b/third_party/double-conversion/ieee.h index 1ae935891..49a1595d1 100644 --- a/third_party/double-conversion/ieee.h +++ b/third_party/double-conversion/ieee.h @@ -1,34 +1,8 @@ -// Copyright 2012 the V8 project authors. All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following -// disclaimer in the documentation and/or other materials provided -// with the distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - +// -*- c++ -*- #ifndef DOUBLE_CONVERSION_DOUBLE_H_ #define DOUBLE_CONVERSION_DOUBLE_H_ - #include "third_party/double-conversion/diy-fp.h" +// clang-format off namespace double_conversion { diff --git a/third_party/double-conversion/string-to-double.cc b/third_party/double-conversion/string-to-double.cc index 752cc0cea..d35d9b7f3 100644 --- a/third_party/double-conversion/string-to-double.cc +++ b/third_party/double-conversion/string-to-double.cc @@ -24,16 +24,19 @@ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -#include "third_party/libcxx/climits" -#include "third_party/libcxx/locale" -#include "third_party/libcxx/cmath" - -#include "third_party/double-conversion/string-to-double.h" - #include "third_party/double-conversion/ieee.h" +#include "third_party/double-conversion/string-to-double.h" #include "third_party/double-conversion/strtod.h" #include "third_party/double-conversion/utils.h" +#include "third_party/libcxx/climits" +#include "third_party/libcxx/cmath" +#include "third_party/libcxx/locale" +// clang-format off + +asm(".ident\t\"\\n\\n\ +double-conversion (BSD-3 License)\\n\ +Copyright 2006-2012 the V8 project authors\""); +asm(".include \"libc/disclaimer.inc\""); #ifdef _MSC_VER # if _MSC_VER >= 1900 diff --git a/third_party/double-conversion/strtod.cc b/third_party/double-conversion/strtod.cc index 7f2bd16c6..34a927464 100644 --- a/third_party/double-conversion/strtod.cc +++ b/third_party/double-conversion/strtod.cc @@ -24,14 +24,18 @@ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -#include "third_party/libcxx/climits" -#include "third_party/libcxx/cstdarg" - #include "third_party/double-conversion/bignum.h" #include "third_party/double-conversion/cached-powers.h" #include "third_party/double-conversion/ieee.h" #include "third_party/double-conversion/strtod.h" +#include "third_party/libcxx/climits" +#include "third_party/libcxx/cstdarg" +// clang-format off + +asm(".ident\t\"\\n\\n\ +double-conversion (BSD-3 License)\\n\ +Copyright 2006-2012 the V8 project authors\""); +asm(".include \"libc/disclaimer.inc\""); namespace double_conversion { diff --git a/third_party/double-conversion/strtod.h b/third_party/double-conversion/strtod.h index c8fa2be7e..a1cf6adfb 100644 --- a/third_party/double-conversion/strtod.h +++ b/third_party/double-conversion/strtod.h @@ -1,34 +1,8 @@ -// Copyright 2010 the V8 project authors. All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following -// disclaimer in the documentation and/or other materials provided -// with the distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - +// -*- c++ -*- #ifndef DOUBLE_CONVERSION_STRTOD_H_ #define DOUBLE_CONVERSION_STRTOD_H_ - #include "third_party/double-conversion/utils.h" +// clang-format off namespace double_conversion { diff --git a/third_party/double-conversion/test/cctest.cc b/third_party/double-conversion/test/cctest.cc index d4f78045d..f1b333005 100644 --- a/third_party/double-conversion/test/cctest.cc +++ b/third_party/double-conversion/test/cctest.cc @@ -24,11 +24,11 @@ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -#include "third_party/double-conversion/test/cctest.h" #include "libc/isystem/stdio.h" #include "libc/isystem/stdlib.h" #include "libc/isystem/string.h" +#include "third_party/double-conversion/test/cctest.h" +// clang-format off CcTest* CcTest::last_ = NULL; diff --git a/third_party/double-conversion/test/cctest.h b/third_party/double-conversion/test/cctest.h index 13f4543ef..65dce0c22 100644 --- a/third_party/double-conversion/test/cctest.h +++ b/third_party/double-conversion/test/cctest.h @@ -1,4 +1,4 @@ -// Copyright 2008 the V8 project authors. All rights reserved. +// Copyright 2006-2008 the V8 project authors. All rights reserved. // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: @@ -24,14 +24,12 @@ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - #ifndef CCTEST_H_ #define CCTEST_H_ - #include "libc/isystem/stdio.h" #include "libc/isystem/string.h" - #include "third_party/double-conversion/utils.h" +// clang-format off #ifndef TEST #define TEST(Name) \ diff --git a/third_party/double-conversion/test/checks.h b/third_party/double-conversion/test/checks.h index ca7c5bb61..cd0923de5 100644 --- a/third_party/double-conversion/test/checks.h +++ b/third_party/double-conversion/test/checks.h @@ -24,13 +24,11 @@ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - #ifndef V8_CHECKS_H_ #define V8_CHECKS_H_ - #include "libc/isystem/string.h" - #include "third_party/double-conversion/test/flags.h" +// clang-format off extern "C" void V8_Fatal(const char* file, int line, const char* format, ...); void API_Fatal(const char* location, const char* format, ...); diff --git a/third_party/double-conversion/test/gay-fixed.cc b/third_party/double-conversion/test/gay-fixed.cc index 838be1236..aa9fea7ca 100644 --- a/third_party/double-conversion/test/gay-fixed.cc +++ b/third_party/double-conversion/test/gay-fixed.cc @@ -1,3 +1,4 @@ +// clang-format off // Copyright 2010 the V8 project authors. All rights reserved. // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are diff --git a/third_party/double-conversion/test/gay-precision.cc b/third_party/double-conversion/test/gay-precision.cc index 503773b0a..68714ca4b 100644 --- a/third_party/double-conversion/test/gay-precision.cc +++ b/third_party/double-conversion/test/gay-precision.cc @@ -1,3 +1,4 @@ +// clang-format off // Copyright 2010 the V8 project authors. All rights reserved. // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are diff --git a/third_party/double-conversion/test/gay-shortest-single.cc b/third_party/double-conversion/test/gay-shortest-single.cc index 66e139def..20c570b8a 100644 --- a/third_party/double-conversion/test/gay-shortest-single.cc +++ b/third_party/double-conversion/test/gay-shortest-single.cc @@ -1,3 +1,4 @@ +// clang-format off // Copyright 2011 the V8 project authors. All rights reserved. // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are diff --git a/third_party/double-conversion/test/gay-shortest.cc b/third_party/double-conversion/test/gay-shortest.cc index 81b47ab87..1b018b507 100644 --- a/third_party/double-conversion/test/gay-shortest.cc +++ b/third_party/double-conversion/test/gay-shortest.cc @@ -1,3 +1,4 @@ +// clang-format off // Copyright 2006-2008 the V8 project authors. All rights reserved. // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are diff --git a/third_party/double-conversion/test/test-bignum-dtoa.cc b/third_party/double-conversion/test/test-bignum-dtoa.cc index fa4e64ca7..ce14d0b54 100644 --- a/third_party/double-conversion/test/test-bignum-dtoa.cc +++ b/third_party/double-conversion/test/test-bignum-dtoa.cc @@ -24,18 +24,16 @@ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - #include "libc/isystem/stdlib.h" - #include "third_party/double-conversion/bignum-dtoa.h" - +#include "third_party/double-conversion/ieee.h" #include "third_party/double-conversion/test/cctest.h" #include "third_party/double-conversion/test/gay-fixed.h" #include "third_party/double-conversion/test/gay-precision.h" -#include "third_party/double-conversion/test/gay-shortest.h" #include "third_party/double-conversion/test/gay-shortest-single.h" -#include "third_party/double-conversion/ieee.h" +#include "third_party/double-conversion/test/gay-shortest.h" #include "third_party/double-conversion/utils.h" +// clang-format off using namespace double_conversion; diff --git a/third_party/double-conversion/test/test-bignum.cc b/third_party/double-conversion/test/test-bignum.cc index 02385576f..443d30bb2 100644 --- a/third_party/double-conversion/test/test-bignum.cc +++ b/third_party/double-conversion/test/test-bignum.cc @@ -24,14 +24,12 @@ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - #include "libc/isystem/stdlib.h" #include "libc/isystem/string.h" - - #include "third_party/double-conversion/bignum.h" #include "third_party/double-conversion/test/cctest.h" #include "third_party/double-conversion/utils.h" +// clang-format off using namespace double_conversion; diff --git a/third_party/double-conversion/test/test-conversions.cc b/third_party/double-conversion/test/test-conversions.cc index bd161543a..a4e809ea4 100644 --- a/third_party/double-conversion/test/test-conversions.cc +++ b/third_party/double-conversion/test/test-conversions.cc @@ -24,13 +24,12 @@ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - #include "libc/isystem/string.h" - -#include "third_party/double-conversion/test/cctest.h" #include "third_party/double-conversion/double-conversion.h" #include "third_party/double-conversion/ieee.h" +#include "third_party/double-conversion/test/cctest.h" #include "third_party/double-conversion/utils.h" +// clang-format off // DoubleToString is already tested in test-dtoa.cc. diff --git a/third_party/double-conversion/test/test-diy-fp.cc b/third_party/double-conversion/test/test-diy-fp.cc index c220ef6e9..27e90b094 100644 --- a/third_party/double-conversion/test/test-diy-fp.cc +++ b/third_party/double-conversion/test/test-diy-fp.cc @@ -24,12 +24,11 @@ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - #include "libc/isystem/stdlib.h" - -#include "third_party/double-conversion/test/cctest.h" #include "third_party/double-conversion/diy-fp.h" +#include "third_party/double-conversion/test/cctest.h" #include "third_party/double-conversion/utils.h" +// clang-format off using namespace double_conversion; diff --git a/third_party/double-conversion/test/test-dtoa.cc b/third_party/double-conversion/test/test-dtoa.cc index c5824fdde..613dc3383 100644 --- a/third_party/double-conversion/test/test-dtoa.cc +++ b/third_party/double-conversion/test/test-dtoa.cc @@ -24,17 +24,15 @@ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - #include "libc/isystem/stdlib.h" - #include "third_party/double-conversion/double-conversion.h" - +#include "third_party/double-conversion/ieee.h" #include "third_party/double-conversion/test/cctest.h" #include "third_party/double-conversion/test/gay-fixed.h" #include "third_party/double-conversion/test/gay-precision.h" -#include "third_party/double-conversion/test/gay-shortest.h" #include "third_party/double-conversion/test/gay-shortest-single.h" -#include "third_party/double-conversion/ieee.h" +#include "third_party/double-conversion/test/gay-shortest.h" +// clang-format off using namespace double_conversion; diff --git a/third_party/double-conversion/test/test-fast-dtoa.cc b/third_party/double-conversion/test/test-fast-dtoa.cc index 8b8742b4b..19e17182c 100644 --- a/third_party/double-conversion/test/test-fast-dtoa.cc +++ b/third_party/double-conversion/test/test-fast-dtoa.cc @@ -24,17 +24,16 @@ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - #include "libc/isystem/stdlib.h" - -#include "third_party/double-conversion/test/cctest.h" #include "third_party/double-conversion/diy-fp.h" #include "third_party/double-conversion/fast-dtoa.h" -#include "third_party/double-conversion/test/gay-precision.h" -#include "third_party/double-conversion/test/gay-shortest.h" -#include "third_party/double-conversion/test/gay-shortest-single.h" #include "third_party/double-conversion/ieee.h" +#include "third_party/double-conversion/test/cctest.h" +#include "third_party/double-conversion/test/gay-precision.h" +#include "third_party/double-conversion/test/gay-shortest-single.h" +#include "third_party/double-conversion/test/gay-shortest.h" #include "third_party/double-conversion/utils.h" +// clang-format off using namespace double_conversion; diff --git a/third_party/double-conversion/test/test-fixed-dtoa.cc b/third_party/double-conversion/test/test-fixed-dtoa.cc index b15d2ecf2..785bed87b 100644 --- a/third_party/double-conversion/test/test-fixed-dtoa.cc +++ b/third_party/double-conversion/test/test-fixed-dtoa.cc @@ -24,15 +24,13 @@ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - #include "libc/isystem/stdlib.h" - - -#include "third_party/double-conversion/test/cctest.h" #include "third_party/double-conversion/fixed-dtoa.h" -#include "third_party/double-conversion/test/gay-fixed.h" #include "third_party/double-conversion/ieee.h" +#include "third_party/double-conversion/test/cctest.h" +#include "third_party/double-conversion/test/gay-fixed.h" #include "third_party/double-conversion/utils.h" +// clang-format off using namespace double_conversion; diff --git a/third_party/double-conversion/test/test-ieee.cc b/third_party/double-conversion/test/test-ieee.cc index 9191849be..142915a76 100644 --- a/third_party/double-conversion/test/test-ieee.cc +++ b/third_party/double-conversion/test/test-ieee.cc @@ -24,14 +24,13 @@ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - #include "libc/isystem/stdlib.h" -#include "third_party/libcxx/limits" - -#include "third_party/double-conversion/test/cctest.h" #include "third_party/double-conversion/diy-fp.h" -#include "third_party/double-conversion/utils.h" #include "third_party/double-conversion/ieee.h" +#include "third_party/double-conversion/test/cctest.h" +#include "third_party/double-conversion/utils.h" +#include "third_party/libcxx/limits" +// clang-format off using namespace double_conversion; diff --git a/third_party/double-conversion/test/test-strtod.cc b/third_party/double-conversion/test/test-strtod.cc index 872e8189b..94a92bc83 100644 --- a/third_party/double-conversion/test/test-strtod.cc +++ b/third_party/double-conversion/test/test-strtod.cc @@ -24,15 +24,14 @@ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - #include "libc/isystem/stdlib.h" - #include "third_party/double-conversion/bignum.h" -#include "third_party/double-conversion/test/cctest.h" #include "third_party/double-conversion/diy-fp.h" #include "third_party/double-conversion/ieee.h" #include "third_party/double-conversion/strtod.h" +#include "third_party/double-conversion/test/cctest.h" #include "third_party/double-conversion/utils.h" +// clang-format off using namespace double_conversion; diff --git a/third_party/double-conversion/utils.h b/third_party/double-conversion/utils.h index 741af74e0..85d7c47ca 100644 --- a/third_party/double-conversion/utils.h +++ b/third_party/double-conversion/utils.h @@ -1,40 +1,19 @@ -// Copyright 2010 the V8 project authors. All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following -// disclaimer in the documentation and/or other materials provided -// with the distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - +// -*- c++ -*- #ifndef DOUBLE_CONVERSION_UTILS_H_ #define DOUBLE_CONVERSION_UTILS_H_ +#include "libc/assert.h" +#include "libc/limits.h" +#include "libc/literal.h" +#include "third_party/libcxx/cassert" +#include "third_party/libcxx/cstdlib" +#include "third_party/libcxx/cstring" +// clang-format off + +#define DOUBLE_CONVERSION_UNREACHABLE() unreachable // Use DOUBLE_CONVERSION_NON_PREFIXED_MACROS to get unprefixed macros as was // the case in double-conversion releases prior to 3.1.6 -#include "third_party/libcxx/cstdlib" -#include "third_party/libcxx/cstring" - -#include "third_party/libcxx/cassert" #ifndef DOUBLE_CONVERSION_ASSERT #define DOUBLE_CONVERSION_ASSERT(condition) \ assert(condition) @@ -162,25 +141,6 @@ int main(int argc, char** argv) { #define CORRECT_DOUBLE_OPERATIONS DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS #endif -#if defined(_WIN32) && !defined(__MINGW32__) - -typedef signed char int8_t; -typedef unsigned char uint8_t; -typedef short int16_t; // NOLINT -typedef unsigned short uint16_t; // NOLINT -typedef int int32_t; -typedef unsigned int uint32_t; -typedef __int64 int64_t; -typedef unsigned __int64 uint64_t; -// intptr_t and friends are defined in crtdefs.h through stdio.h. - -#else - -#include "libc/limits.h" -#include "libc/literal.h" - -#endif - typedef uint16_t uc16; // The following macro works on both 32 and 64-bit platforms. diff --git a/third_party/double-conversion/wrapper.cc b/third_party/double-conversion/wrapper.cc new file mode 100644 index 000000000..cad1df20a --- /dev/null +++ b/third_party/double-conversion/wrapper.cc @@ -0,0 +1,50 @@ +/*-*-mode:c++;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8-*-│ +│vi: set net ft=c++ ts=2 sts=2 sw=2 fenc=utf-8 :vi│ +╞══════════════════════════════════════════════════════════════════════════════╡ +│ Copyright 2022 Justine Alexandra Roberts Tunney │ +│ │ +│ Permission to use, copy, modify, and/or distribute this software for │ +│ any purpose with or without fee is hereby granted, provided that the │ +│ above copyright notice and this permission notice appear in all copies. │ +│ │ +│ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │ +│ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │ +│ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │ +│ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │ +│ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │ +│ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │ +│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ +│ PERFORMANCE OF THIS SOFTWARE. │ +╚─────────────────────────────────────────────────────────────────────────────*/ +#include "libc/str/str.h" +#include "third_party/double-conversion/double-conversion.h" +#include "third_party/double-conversion/wrapper.h" + +namespace double_conversion { +extern "C" { + +char* DoubleToEcmascript(char buf[128], double x) { + StringBuilder b(buf, 128); + const DoubleToStringConverter& dc = + DoubleToStringConverter::EcmaScriptConverter(); + dc.ToShortest(x, &b); + return b.Finalize(); +} + +double StringToDouble(const char* s, size_t n, int* out_processed) { + if (n == -1) n = strlen(s); + int flags = StringToDoubleConverter::ALLOW_CASE_INSENSITIVITY | + StringToDoubleConverter::ALLOW_LEADING_SPACES | + StringToDoubleConverter::ALLOW_TRAILING_JUNK | + StringToDoubleConverter::ALLOW_TRAILING_SPACES; + StringToDoubleConverter converter(flags, 0.0, 1.0, "Infinity", "NaN"); + int processed; + double res = converter.StringToDouble(s, n, &processed); + if (out_processed) { + *out_processed = processed; + } + return res; +} + +} // extern "C" +} // namespace double_conversion diff --git a/third_party/double-conversion/wrapper.h b/third_party/double-conversion/wrapper.h new file mode 100644 index 000000000..cbf8f14d2 --- /dev/null +++ b/third_party/double-conversion/wrapper.h @@ -0,0 +1,11 @@ +#ifndef COSMOPOLITAN_THIRD_PARTY_DOUBLE_CONVERSION_WRAPPER_H_ +#define COSMOPOLITAN_THIRD_PARTY_DOUBLE_CONVERSION_WRAPPER_H_ +#if !(__ASSEMBLER__ + __LINKER__ + 0) +COSMOPOLITAN_C_START_ + +char *DoubleToEcmascript(char[128], double); +double StringToDouble(const char *, size_t, int *); + +COSMOPOLITAN_C_END_ +#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */ +#endif /* COSMOPOLITAN_THIRD_PARTY_DOUBLE_CONVERSION_WRAPPER_H_ */