From: Louis Dionne Date: Thu, 29 Sep 2022 21:44:39 +0000 (-0400) Subject: [libc++] Disable int128_t and ship filesystem on MSVC by default X-Git-Tag: upstream/17.0.6~5932 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1939eb3dc2330af6fb9609a7c3bd5276e127c9ce;p=platform%2Fupstream%2Fllvm.git [libc++] Disable int128_t and ship filesystem on MSVC by default Back in 2020 [1], we went very close to enabling Filesystem on MSVC by disabling int128_t, but decided to wait because MSVC support for int128_t was supposed to come shortly after. Since it's not there yet, I propose turning off int128_t support by default on MSVC. This will make available by default on MSVC, and most importantly will open the possibility for changing LIBCXX_ENABLE_FILESYSTEM to mean "the system doesn't have support for a filesystem" instead of simply "don't build the std::filesystem library", which is what I'm really after with this change. In a way, this is a resurection of D91139. [1]: https://reviews.llvm.org/D91139#2429595 Differential Revision: https://reviews.llvm.org/D134912 --- diff --git a/libcxx/CMakeLists.txt b/libcxx/CMakeLists.txt index c44d05f..d3b7f6f 100644 --- a/libcxx/CMakeLists.txt +++ b/libcxx/CMakeLists.txt @@ -57,16 +57,7 @@ option(LIBCXX_ENABLE_ASSERTIONS by users in their own code regardless of this option." OFF) option(LIBCXX_ENABLE_SHARED "Build libc++ as a shared library." ON) option(LIBCXX_ENABLE_STATIC "Build libc++ as a static library." ON) -set(ENABLE_FILESYSTEM_DEFAULT ON) -if (WIN32 AND NOT MINGW) - # Filesystem is buildable for windows, but it requires __int128 helper - # functions, that currently are provided by libgcc or compiler_rt builtins. - # These are available in MinGW environments, but not currently in MSVC - # environments. - set(ENABLE_FILESYSTEM_DEFAULT OFF) -endif() -option(LIBCXX_ENABLE_FILESYSTEM "Build filesystem as part of the main libc++ library" - ${ENABLE_FILESYSTEM_DEFAULT}) +option(LIBCXX_ENABLE_FILESYSTEM "Build filesystem as part of the main libc++ library" ON) option(LIBCXX_INCLUDE_TESTS "Build the libc++ tests." ${LLVM_INCLUDE_TESTS}) option(LIBCXX_ENABLE_DEBUG_MODE "Whether to build libc++ with the debug mode enabled. diff --git a/libcxx/include/__config b/libcxx/include/__config index 023fa0c..1fc45b5 100644 --- a/libcxx/include/__config +++ b/libcxx/include/__config @@ -685,7 +685,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD # define _LIBCPP_PREFERRED_OVERLOAD __attribute__((__enable_if__(true, ""))) # endif -# ifndef __SIZEOF_INT128__ +#if !defined(__SIZEOF_INT128__) || defined(_MSC_VER) # define _LIBCPP_HAS_NO_INT128 # endif diff --git a/libcxx/utils/ci/run-buildbot b/libcxx/utils/ci/run-buildbot index fc3d432..411e3f7 100755 --- a/libcxx/utils/ci/run-buildbot +++ b/libcxx/utils/ci/run-buildbot @@ -124,19 +124,10 @@ function generate-cmake() { } function generate-cmake-libcxx-win() { - # TODO: Clang-cl in MSVC configurations don't have access to compiler_rt - # builtins helpers for int128 division. See - # https://reviews.llvm.org/D91139#2429595 for a comment about longterm - # intent for handling the issue. In the meantime, define - # -D_LIBCPP_HAS_NO_INT128 (both when building the library itself and - # when building tests) to allow enabling filesystem for running tests, - # even if it uses a non-permanent ABI. generate-cmake-base \ -DLLVM_ENABLE_RUNTIMES="libcxx" \ -DCMAKE_C_COMPILER=clang-cl \ -DCMAKE_CXX_COMPILER=clang-cl \ - -DLIBCXX_ENABLE_FILESYSTEM=YES \ - -DLIBCXX_EXTRA_SITE_DEFINES="_LIBCPP_HAS_NO_INT128" \ "${@}" }