jroelofs updated this revision to Diff 31878.
jroelofs added a comment.

fix typo


http://reviews.llvm.org/D11963

Files:
  CMakeLists.txt
  include/CMakeLists.txt
  include/__config
  test/libcxx/test/config.py
  test/std/atomics/libcpp-has-no-threads.pass.cpp
  test/std/utilities/date.time/tested_elsewhere.pass.cpp

Index: test/std/utilities/date.time/tested_elsewhere.pass.cpp
===================================================================
--- test/std/utilities/date.time/tested_elsewhere.pass.cpp
+++ test/std/utilities/date.time/tested_elsewhere.pass.cpp
@@ -30,9 +30,11 @@
     static_assert((std::is_same<decltype(std::difftime(t,t)), double>::value), "");
     static_assert((std::is_same<decltype(std::mktime(&tm)), std::time_t>::value), "");
     static_assert((std::is_same<decltype(std::time(&t)), std::time_t>::value), "");
+#ifndef _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS
     static_assert((std::is_same<decltype(std::asctime(&tm)), char*>::value), "");
     static_assert((std::is_same<decltype(std::ctime(&t)), char*>::value), "");
     static_assert((std::is_same<decltype(std::gmtime(&t)), std::tm*>::value), "");
     static_assert((std::is_same<decltype(std::localtime(&t)), std::tm*>::value), "");
+#endif
     static_assert((std::is_same<decltype(std::strftime(str,s,"",&tm)), std::size_t>::value), "");
 }
Index: test/std/atomics/libcpp-has-no-threads.pass.cpp
===================================================================
--- test/std/atomics/libcpp-has-no-threads.pass.cpp
+++ test/std/atomics/libcpp-has-no-threads.pass.cpp
@@ -8,6 +8,8 @@
 //===----------------------------------------------------------------------===//
 // XFAIL: libcpp-has-no-threads
 
+#include <__config_site>
+
 #ifdef _LIBCPP_HAS_NO_THREADS
 #error This should be XFAIL'd for the purpose of detecting that the LIT feature\
  'libcpp-has-no-threads' is available iff _LIBCPP_HAS_NO_THREADS is defined
Index: test/libcxx/test/config.py
===================================================================
--- test/libcxx/test/config.py
+++ test/libcxx/test/config.py
@@ -392,7 +392,7 @@
         self.cxx.compile_flags += ['-I' + support_path]
         self.cxx.compile_flags += ['-include', os.path.join(support_path, 'nasty_macros.hpp')]
         libcxx_headers = self.get_lit_conf(
-            'libcxx_headers', os.path.join(self.libcxx_src_root, 'include'))
+            'libcxx_headers', os.path.join(self.cxx_library_root, '..', 'include', 'c++', 'v1'))
         if not os.path.isdir(libcxx_headers):
             self.lit_config.fatal("libcxx_headers='%s' is not a directory."
                                   % libcxx_headers)
@@ -416,36 +416,28 @@
         if not enable_global_filesystem_namespace:
             self.config.available_features.add(
                 'libcpp-has-no-global-filesystem-namespace')
-            self.cxx.compile_flags += [
-                '-D_LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE']
 
     def configure_compile_flags_no_stdin(self):
         enable_stdin = self.get_lit_bool('enable_stdin', True)
         if not enable_stdin:
             self.config.available_features.add('libcpp-has-no-stdin')
-            self.cxx.compile_flags += ['-D_LIBCPP_HAS_NO_STDIN']
 
     def configure_compile_flags_no_stdout(self):
         enable_stdout = self.get_lit_bool('enable_stdout', True)
         if not enable_stdout:
             self.config.available_features.add('libcpp-has-no-stdout')
-            self.cxx.compile_flags += ['-D_LIBCPP_HAS_NO_STDOUT']
 
     def configure_compile_flags_no_threads(self):
-        self.cxx.compile_flags += ['-D_LIBCPP_HAS_NO_THREADS']
         self.config.available_features.add('libcpp-has-no-threads')
 
     def configure_compile_flags_no_thread_unsafe_c_functions(self):
         enable_thread_unsafe_c_functions = self.get_lit_bool(
             'enable_thread_unsafe_c_functions', True)
         if not enable_thread_unsafe_c_functions:
-            self.cxx.compile_flags += [
-                '-D_LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS']
             self.config.available_features.add(
                 'libcpp-has-no-thread-unsafe-c-functions')
 
     def configure_compile_flags_no_monotonic_clock(self):
-        self.cxx.compile_flags += ['-D_LIBCPP_HAS_NO_MONOTONIC_CLOCK']
         self.config.available_features.add('libcpp-has-no-monotonic-clock')
 
     def configure_link_flags(self):
Index: include/__config
===================================================================
--- include/__config
+++ include/__config
@@ -15,6 +15,8 @@
 #pragma GCC system_header
 #endif
 
+#include <__config_site>
+
 #ifdef __GNUC__
 #define _GNUC_VER (__GNUC__ * 100 + __GNUC_MINOR__)
 #else
Index: include/CMakeLists.txt
===================================================================
--- include/CMakeLists.txt
+++ include/CMakeLists.txt
@@ -5,6 +5,7 @@
   PATTERN "*"
   PATTERN "CMakeLists.txt" EXCLUDE
   PATTERN ".svn" EXCLUDE
+  PATTERN "__config_site.in" EXCLUDE
   ${LIBCXX_SUPPORT_HEADER_PATTERN}
   )
 
Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -84,7 +84,7 @@
 option(LIBCXX_ENABLE_THREAD_UNSAFE_C_FUNCTIONS "Build libc++ with support for thread-unsafe C functions" ON)
 option(LIBCXX_ENABLE_MONOTONIC_CLOCK
   "Build libc++ with support for a monotonic clock.
-   This option may only be used when LIBCXX_ENABLE_THREADS=OFF." ON)
+   This option may only be set to OFF when LIBCXX_ENABLE_THREADS=OFF." ON)
 
 # Misc options ----------------------------------------------------------------
 option(LIBCXX_ENABLE_PEDANTIC "Compile with pedantic enabled." ON)
@@ -239,16 +239,8 @@
 
 # Feature flags ===============================================================
 define_if(MSVC -D_CRT_SECURE_NO_WARNINGS)
-define_if_not(LIBCXX_ENABLE_GLOBAL_FILESYSTEM_NAMESPACE -D_LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE)
-define_if_not(LIBCXX_ENABLE_STDIN -D_LIBCPP_HAS_NO_STDIN)
-define_if_not(LIBCXX_ENABLE_STDOUT -D_LIBCPP_HAS_NO_STDOUT)
-define_if_not(LIBCXX_ENABLE_THREADS -D_LIBCPP_HAS_NO_THREADS)
-define_if_not(LIBCXX_ENABLE_MONOTONIC_CLOCK -D_LIBCPP_HAS_NO_MONOTONIC_CLOCK)
-define_if_not(LIBCXX_ENABLE_THREAD_UNSAFE_C_FUNCTIONS -D_LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS)
 
-
-# Sanitizer flags
-
+# Sanitizer flags ==============================================================
 # Configure for sanitizers. If LIBCXX_BUILT_STANDALONE then we have to do
 # the flag translation ourselves. Othewise LLVM's CMakeList.txt will handle it.
 if (LIBCXX_BUILT_STANDALONE)
@@ -282,10 +274,42 @@
     message(WARNING "LLVM_USE_SANITIZER is not supported on this platform.")
   endif()
 endif()
+
+
+# Configuration file flags =====================================================
+if (NOT LIBCXX_ENABLE_GLOBAL_FILESYSTEM_NAMESPACE)
+  set(_LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE TRUE)
+endif()
+if (NOT LIBCXX_ENABLE_STDIN)
+  set(_LIBCPP_HAS_NO_STDIN TRUE)
+endif()
+if (NOT LIBCXX_ENABLE_STDOUT)
+  set(_LIBCPP_HAS_NO_STDOUT TRUE)
+endif()
+if (NOT LIBCXX_ENABLE_THREADS)
+  set(_LIBCPP_HAS_NO_THREADS TRUE)
+endif()
+if (NOT LIBCXX_ENABLE_MONOTONIC_CLOCK)
+  set(_LIBCPP_HAS_NO_MONOTONIC_CLOCK TRUE)
+endif()
+if (NOT LIBCXX_ENABLE_THREAD_UNSAFE_C_FUNCTIONS)
+  set(_LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS TRUE)
+endif()
+
 #===============================================================================
+# Setup configuration file
+#===============================================================================
+
+configure_file(
+  include/__config_site.in
+  ${CMAKE_BINARY_DIR}/include/c++/v1/__config_site
+  @ONLY)
+
+#===============================================================================
 # Setup Source Code And Tests
 #===============================================================================
-include_directories(include)
+include_directories(include
+                    "${CMAKE_BINARY_DIR}/include/c++/v1")
 add_subdirectory(include)
 add_subdirectory(lib)
 if (LIBCXX_INCLUDE_TESTS)
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to