[libcxx-commits] [libcxx] r356633 - Allow disabling of filesystem library.

Eric Fiselier via libcxx-commits libcxx-commits at lists.llvm.org
Wed Mar 20 17:04:33 PDT 2019


Author: ericwf
Date: Wed Mar 20 17:04:31 2019
New Revision: 356633

URL: http://llvm.org/viewvc/llvm-project?rev=356633&view=rev
Log:
Allow disabling of filesystem library.

Summary: Filesystem doesn't work on Windows, so we need a mechanism to turn it off for the time being.

Reviewers: ldionne, serge-sans-paille, EricWF

Reviewed By: EricWF

Subscribers: mstorsjo, mgorny, christof, jdoerfert, libcxx-commits

Differential Revision: https://reviews.llvm.org/D59619

Modified:
    libcxx/trunk/CMakeLists.txt
    libcxx/trunk/docs/BuildingLibcxx.rst
    libcxx/trunk/lib/CMakeLists.txt
    libcxx/trunk/test/CMakeLists.txt
    libcxx/trunk/test/libcxx/input.output/filesystems/lit.local.cfg
    libcxx/trunk/test/lit.site.cfg.in
    libcxx/trunk/test/std/input.output/filesystems/lit.local.cfg
    libcxx/trunk/utils/libcxx/test/config.py

Modified: libcxx/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/CMakeLists.txt?rev=356633&r1=356632&r2=356633&view=diff
==============================================================================
--- libcxx/trunk/CMakeLists.txt (original)
+++ libcxx/trunk/CMakeLists.txt Wed Mar 20 17:04:31 2019
@@ -73,6 +73,12 @@ option(LIBCXX_ENABLE_ASSERTIONS "Enable
 option(LIBCXX_ENABLE_SHARED "Build libc++ as a shared library." ON)
 option(LIBCXX_ENABLE_STATIC "Build libc++ as a static library." ON)
 option(LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY "Build libc++experimental.a" ON)
+set(ENABLE_FILESYSTEM_DEFAULT ON)
+if (WIN32)
+  set(ENABLE_FILESYSTEM_DEFAULT OFF)
+endif()
+option(LIBCXX_ENABLE_FILESYSTEM "Build filesystem as part of the main libc++ library"
+    ${ENABLE_FILESYSTEM_DEFAULT})
 option(LIBCXX_INCLUDE_TESTS "Build the libc++ tests." ${LLVM_INCLUDE_TESTS})
 
 # Benchmark options -----------------------------------------------------------

Modified: libcxx/trunk/docs/BuildingLibcxx.rst
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/docs/BuildingLibcxx.rst?rev=356633&r1=356632&r2=356633&view=diff
==============================================================================
--- libcxx/trunk/docs/BuildingLibcxx.rst (original)
+++ libcxx/trunk/docs/BuildingLibcxx.rst Wed Mar 20 17:04:31 2019
@@ -206,6 +206,13 @@ libc++ specific options
   libraries that may be used in with other shared libraries that use different
   C++ library. We want to avoid avoid exporting any libc++ symbols in that case.
 
+.. option:: LIBCXX_ENABLE_FILESYSTEM:BOOL
+
+   **Default**: ``ON`` except on Windows.
+
+   This option can be used to enable or disable the filesystem components on
+   platforms that may not support them. For example on Windows.
+
 .. _libc++experimental options:
 
 libc++experimental Specific Options

Modified: libcxx/trunk/lib/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/lib/CMakeLists.txt?rev=356633&r1=356632&r2=356633&view=diff
==============================================================================
--- libcxx/trunk/lib/CMakeLists.txt (original)
+++ libcxx/trunk/lib/CMakeLists.txt Wed Mar 20 17:04:31 2019
@@ -3,8 +3,6 @@ set(LIBCXX_LIB_CMAKEFILES_DIR "${CMAKE_C
 # Get sources
 # FIXME: Don't use glob here
 file(GLOB LIBCXX_SOURCES ../src/*.cpp)
-list(APPEND LIBCXX_SOURCES ../src/filesystem/operations.cpp
-                           ../src/filesystem/directory_iterator.cpp)
 if(WIN32)
   file(GLOB LIBCXX_WIN32_SOURCES ../src/support/win32/*.cpp)
   list(APPEND LIBCXX_SOURCES ${LIBCXX_WIN32_SOURCES})
@@ -13,12 +11,16 @@ elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "
   list(APPEND LIBCXX_SOURCES ${LIBCXX_SOLARIS_SOURCES})
 endif()
 
-# Filesystem uses __int128_t, which requires a definition of __muloi4 when
-# compiled with UBSAN. This definition is not provided by libgcc_s, but is
-# provided by compiler-rt. So we need to disable it to avoid having multiple
-# definitions. See filesystem/int128_builtins.cpp.
-if (NOT LIBCXX_USE_COMPILER_RT)
-  list(APPEND LIBCXX_SOURCES ../src/filesystem/int128_builtins.cpp)
+if (LIBCXX_ENABLE_FILESYSTEM)
+  list(APPEND LIBCXX_SOURCES ../src/filesystem/operations.cpp
+                             ../src/filesystem/directory_iterator.cpp)
+  # Filesystem uses __int128_t, which requires a definition of __muloi4 when
+  # compiled with UBSAN. This definition is not provided by libgcc_s, but is
+  # provided by compiler-rt. So we need to disable it to avoid having multiple
+  # definitions. See filesystem/int128_builtins.cpp.
+  if (NOT LIBCXX_USE_COMPILER_RT)
+    list(APPEND LIBCXX_SOURCES ../src/filesystem/int128_builtins.cpp)
+  endif()
 endif()
 
 # Add all the headers to the project for IDEs.

Modified: libcxx/trunk/test/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/CMakeLists.txt?rev=356633&r1=356632&r2=356633&view=diff
==============================================================================
--- libcxx/trunk/test/CMakeLists.txt (original)
+++ libcxx/trunk/test/CMakeLists.txt Wed Mar 20 17:04:31 2019
@@ -30,6 +30,7 @@ pythonize_bool(LIBCXX_ENABLE_EXCEPTIONS)
 pythonize_bool(LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY)
 pythonize_bool(LIBCXX_ENABLE_RTTI)
 pythonize_bool(LIBCXX_ENABLE_SHARED)
+pythonize_bool(LIBCXX_ENABLE_FILESYSTEM)
 pythonize_bool(LIBCXX_BUILD_32_BITS)
 pythonize_bool(LIBCXX_GENERATE_COVERAGE)
 pythonize_bool(LIBCXXABI_ENABLE_SHARED)

Modified: libcxx/trunk/test/libcxx/input.output/filesystems/lit.local.cfg
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/input.output/filesystems/lit.local.cfg?rev=356633&r1=356632&r2=356633&view=diff
==============================================================================
--- libcxx/trunk/test/libcxx/input.output/filesystems/lit.local.cfg (original)
+++ libcxx/trunk/test/libcxx/input.output/filesystems/lit.local.cfg Wed Mar 20 17:04:31 2019
@@ -1,3 +1,5 @@
 # Disable all of the filesystem tests if the dylib under test doesn't support them.
 if 'dylib-has-no-filesystem' in config.available_features:
   config.unsupported = True
+if 'c++filesystem-disabled' in config.available_features:
+  config.unsupported = True

Modified: libcxx/trunk/test/lit.site.cfg.in
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/lit.site.cfg.in?rev=356633&r1=356632&r2=356633&view=diff
==============================================================================
--- libcxx/trunk/test/lit.site.cfg.in (original)
+++ libcxx/trunk/test/lit.site.cfg.in Wed Mar 20 17:04:31 2019
@@ -6,6 +6,7 @@ config.libcxx_obj_root          = "@LIBC
 config.cxx_library_root         = "@LIBCXX_LIBRARY_DIR@"
 config.enable_exceptions        = @LIBCXX_ENABLE_EXCEPTIONS@
 config.enable_experimental      = @LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY@
+config.enable_filesystem        = @LIBCXX_ENABLE_FILESYSTEM@
 config.enable_rtti              = @LIBCXX_ENABLE_RTTI@
 config.enable_shared            = @LIBCXX_ENABLE_SHARED@
 config.enable_32bit             = @LIBCXX_BUILD_32_BITS@

Modified: libcxx/trunk/test/std/input.output/filesystems/lit.local.cfg
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/filesystems/lit.local.cfg?rev=356633&r1=356632&r2=356633&view=diff
==============================================================================
--- libcxx/trunk/test/std/input.output/filesystems/lit.local.cfg (original)
+++ libcxx/trunk/test/std/input.output/filesystems/lit.local.cfg Wed Mar 20 17:04:31 2019
@@ -1,3 +1,6 @@
 # Disable all of the filesystem tests if the dylib under test doesn't support them.
 if 'dylib-has-no-filesystem' in config.available_features:
   config.unsupported = True
+if 'c++filesystem-disabled' in config.available_features:
+  config.unsupported = True
+

Modified: libcxx/trunk/utils/libcxx/test/config.py
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/utils/libcxx/test/config.py?rev=356633&r1=356632&r2=356633&view=diff
==============================================================================
--- libcxx/trunk/utils/libcxx/test/config.py (original)
+++ libcxx/trunk/utils/libcxx/test/config.py Wed Mar 20 17:04:31 2019
@@ -435,6 +435,9 @@ class Configuration(object):
         if self.long_tests:
             self.config.available_features.add('long_tests')
 
+        if not self.get_lit_bool('enable_filesystem', default=True):
+            self.config.available_features.add('c++filesystem-disabled')
+
         # Run a compile test for the -fsized-deallocation flag. This is needed
         # in test/std/language.support/support.dynamic/new.delete
         if self.cxx.hasCompileFlag('-fsized-deallocation'):




More information about the libcxx-commits mailing list