// REQUIRES: verify-support
-// MODULES_DEFINES: _LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE
-// MODULES_DEFINES: _LIBCPP_DISABLE_DEPRECATION_WARNINGS
-#define _LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE
-#define _LIBCPP_DISABLE_DEPRECATION_WARNINGS
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
#include <algorithm>
#include <vector>
// UNSUPPORTED: c++98, c++03, c++11
// REQUIRES: verify-support
-// MODULES_DEFINES: _LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE
-#define _LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE
#include <algorithm>
#include <cstddef>
// Test that including <atomic> fails to compile when _LIBCPP_HAS_NO_THREADS
// is defined.
-// MODULES_DEFINES: _LIBCPP_HAS_NO_THREADS
-#ifndef _LIBCPP_HAS_NO_THREADS
-#define _LIBCPP_HAS_NO_THREADS
-#endif
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_HAS_NO_THREADS
#include <atomic>
// UNSUPPORTED: c++98, c++03
// UNSUPPORTED: windows
-// MODULES_DEFINES: _LIBCPP_DEBUG=1
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
// Can't test the system lib because this test enables debug mode
// UNSUPPORTED: with_system_cxx_lib
// test array<T, 0>::front() raises a debug error.
-#define _LIBCPP_DEBUG 1
#include <array>
#include "test_macros.h"
#include "debug_mode_helper.h"
// UNSUPPORTED: c++98, c++03
// UNSUPPORTED: windows
-// MODULES_DEFINES: _LIBCPP_DEBUG=1
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
// Can't test the system lib because this test enables debug mode
// UNSUPPORTED: with_system_cxx_lib
// test array<T, 0>::front() raises a debug error.
-#define _LIBCPP_DEBUG 1
#include <array>
#include "test_macros.h"
#include "debug_mode_helper.h"
// UNSUPPORTED: c++98, c++03
// UNSUPPORTED: windows
-// MODULES_DEFINES: _LIBCPP_DEBUG=1
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
// Can't test the system lib because this test enables debug mode
// UNSUPPORTED: with_system_cxx_lib
// test array<T, 0>::operator[] raises a debug error.
-#define _LIBCPP_DEBUG 1
#include <array>
#include "test_macros.h"
#include "debug_mode_helper.h"
// deque()
// deque::iterator()
-// MODULES_DEFINES: _LIBCPP_ABI_INCOMPLETE_TYPES_IN_DEQUE
-#define _LIBCPP_ABI_INCOMPLETE_TYPES_IN_DEQUE
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ABI_INCOMPLETE_TYPES_IN_DEQUE
+
#include <deque>
#include <cassert>
// UNSUPPORTED: c++98, c++03, c++11, c++14
// UNSUPPORTED: windows
// UNSUPPORTED: libcpp-no-if-constexpr
-// MODULES_DEFINES: _LIBCPP_DEBUG=1
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
// Can't test the system lib because this test enables debug mode
// UNSUPPORTED: with_system_cxx_lib
// test container debugging
-#define _LIBCPP_DEBUG 1
-
#include <map>
#include <set>
#include <utility>
// UNSUPPORTED: c++98, c++03, c++11, c++14
// UNSUPPORTED: windows
// UNSUPPORTED: libcpp-has-no-threads
-// MODULES_DEFINES: _LIBCPP_DEBUG=1
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
// Can't test the system lib because this test enables debug mode
// UNSUPPORTED: with_system_cxx_lib
// test multihtreaded container debugging
-#define _LIBCPP_DEBUG 1
-
#include <cassert>
#include <cstddef>
#include <deque>
// UNSUPPORTED: c++98, c++03, c++11, c++14
// UNSUPPORTED: windows
// UNSUPPORTED: libcpp-no-if-constexpr
-// MODULES_DEFINES: _LIBCPP_DEBUG=1
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
// Can't test the system lib because this test enables debug mode
// UNSUPPORTED: with_system_cxx_lib
// test container debugging
-#define _LIBCPP_DEBUG 1
-
#include <forward_list>
#include <list>
#include <vector>
// UNSUPPORTED: c++98, c++03, c++11, c++14
// UNSUPPORTED: windows
// UNSUPPORTED: libcpp-no-if-constexpr
-// MODULES_DEFINES: _LIBCPP_DEBUG=1
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
// Can't test the system lib because this test enables debug mode
// UNSUPPORTED: with_system_cxx_lib
// test container debugging
-#define _LIBCPP_DEBUG 1
#include <string>
#include <vector>
// UNSUPPORTED: c++98, c++03, c++11, c++14
// UNSUPPORTED: windows
// UNSUPPORTED: libcpp-no-if-constexpr
-// MODULES_DEFINES: _LIBCPP_DEBUG=1
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
// Can't test the system lib because this test enables debug mode
// UNSUPPORTED: with_system_cxx_lib
// test container debugging
-#define _LIBCPP_DEBUG 1
#include <unordered_map>
#include <unordered_set>
#include <utility>
// UNSUPPORTED: c++98, c++03, c++11, c++14
// UNSUPPORTED: windows
// UNSUPPORTED: libcpp-no-if-constexpr
-// MODULES_DEFINES: _LIBCPP_DEBUG=1
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
// Can't test the system lib because this test enables debug mode
// UNSUPPORTED: with_system_cxx_lib
// test container debugging
-#define _LIBCPP_DEBUG 1
#include <string_view>
#include "test_macros.h"
//
//===----------------------------------------------------------------------===//
-// MODULES_DEFINES: _LIBCPP_DEBUG=0
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=0
// Can't test the system lib because this test enables debug mode
// UNSUPPORTED: with_system_cxx_lib
// Test that the default debug handler aborts the program.
-#define _LIBCPP_DEBUG 0
-
#include <csignal>
#include <cstdlib>
#include <__debug>
// Can't test the system lib because this test enables debug mode
// UNSUPPORTED: with_system_cxx_lib
-// MODULES_DEFINES: _LIBCPP_DEBUG=1
-
-#define _LIBCPP_DEBUG 1
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
#include <__debug>
#include "test_macros.h"
//
//===----------------------------------------------------------------------===//
-// MODULES_DEFINES: _LIBCPP_DEBUG=1
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
// Can't test the system lib because this test enables debug mode
// UNSUPPORTED: with_system_cxx_lib
-#define _LIBCPP_DEBUG 1
-
#include <cstdlib>
#include <string>
#include <type_traits>
// However, for backwards compatibility, if _LIBCPP_NO_REMOVE_AUTOPTR
// is defined before including <memory>, then auto_ptr will be restored.
-// MODULES_DEFINES: _LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR
-// MODULES_DEFINES: _LIBCPP_DISABLE_DEPRECATION_WARNINGS
-#define _LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR
-#define _LIBCPP_DISABLE_DEPRECATION_WARNINGS
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
#include <memory>
#include <type_traits>
// UNSUPPORTED: c++98, c++03
// REQUIRES: verify-support
-// MODULES_DEFINES: _LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR
-#define _LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR
#include <memory>
#include "test_macros.h"
// However, for backwards compatibility, if _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS
// is defined before including <memory>, then removed members will be restored.
-// MODULES_DEFINES: _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS
-// MODULES_DEFINES: _LIBCPP_DISABLE_DEPRECATION_WARNINGS
-#define _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS
-#define _LIBCPP_DISABLE_DEPRECATION_WARNINGS
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
#include <memory>
#include <cassert>
// UNSUPPORTED: c++98, c++03, c++11, c++14
// REQUIRES: verify-support
-// MODULES_DEFINES: _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS
-#define _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS
#include <memory>
#include "test_macros.h"
// However, for backwards compatibility, if _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS
// is defined before including <memory>, then removed members will be restored.
-// MODULES_DEFINES: _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS
-// MODULES_DEFINES: _LIBCPP_DISABLE_DEPRECATION_WARNINGS
-#define _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS
-#define _LIBCPP_DISABLE_DEPRECATION_WARNINGS
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
#include <memory>
#include <cassert>
// allocator:
// T* allocate(size_t n, const void* hint);
-// MODULES_DEFINES: _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS
-// MODULES_DEFINES: _LIBCPP_DISABLE_DEPRECATION_WARNINGS
-#define _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS
-#define _LIBCPP_DISABLE_DEPRECATION_WARNINGS
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
#include <memory>
#include <cassert>
// UNSUPPORTED: c++98, c++03, c++11, c++14
// REQUIRES: verify-support
-// MODULES_DEFINES: _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS
-#define _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS
#include <memory>
#include "test_macros.h"
// However, for backwards compatibility, if _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS
// is defined before including <memory>, then removed members will be restored.
-// MODULES_DEFINES: _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS
-// MODULES_DEFINES: _LIBCPP_DISABLE_DEPRECATION_WARNINGS
-#define _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS
-#define _LIBCPP_DISABLE_DEPRECATION_WARNINGS
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
#include <memory>
#include <cassert>
// However, for backwards compatibility, if _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS
// is defined before including <memory>, then removed members will be restored.
-// MODULES_DEFINES: _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS
-// MODULES_DEFINES: _LIBCPP_DISABLE_DEPRECATION_WARNINGS
-#define _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS
-#define _LIBCPP_DISABLE_DEPRECATION_WARNINGS
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
#include <memory>
#include <limits>
// ...
// };
-// MODULES_DEFINES: _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS
-// MODULES_DEFINES: _LIBCPP_DISABLE_DEPRECATION_WARNINGS
-#define _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS
-#define _LIBCPP_DISABLE_DEPRECATION_WARNINGS
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
#include <memory>
#include <type_traits>
// so the rebind<int> check below fails.
// UNSUPPORTED: clang-6
-// MODULES_DEFINES: _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS
-#define _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS
#include <memory>
#include "test_macros.h"
// template <class _Up> struct rebind {typedef allocator<_Up> other;};
// };
-// MODULES_DEFINES: _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS
-// MODULES_DEFINES: _LIBCPP_DISABLE_DEPRECATION_WARNINGS
-#define _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS
-#define _LIBCPP_DISABLE_DEPRECATION_WARNINGS
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
#include <memory>
#include <type_traits>
// UNSUPPORTED: c++98, c++03, c++11, c++14
// REQUIRES: verify-support
-// MODULES_DEFINES: _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS
-#define _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS
#include <memory>
#include "test_macros.h"
// UNSUPPORTED: c++98, c++03
// REQUIRES: verify-support
-// MODULES_DEFINES: _LIBCPP_ENABLE_CXX17_REMOVED_BINDERS
-#define _LIBCPP_ENABLE_CXX17_REMOVED_BINDERS
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS
#include <functional>
#include <cassert>
// However, for backwards compatibility, if _LIBCPP_ENABLE_CXX17_REMOVED_BINDERS
// is defined before including <functional>, then they will be restored.
-// MODULES_DEFINES: _LIBCPP_ENABLE_CXX17_REMOVED_BINDERS
-// MODULES_DEFINES: _LIBCPP_DISABLE_DEPRECATION_WARNINGS
-#define _LIBCPP_ENABLE_CXX17_REMOVED_BINDERS
-#define _LIBCPP_DISABLE_DEPRECATION_WARNINGS
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
#include <functional>
#include <cassert>
// Test that defining _LIBCPP_ENABLE_CXX17_REMOVED_FEATURES correctly defines
// _LIBCPP_ENABLE_CXX17_REMOVED_FOO for each individual component macro.
-// MODULES_DEFINES: _LIBCPP_ENABLE_CXX17_REMOVED_FEATURES
-#define _LIBCPP_ENABLE_CXX17_REMOVED_FEATURES
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES
+
#include <__config>
#include "test_macros.h"
// test get_unexpected
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS
-// MODULES_DEFINES: _LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS
-#define _LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS
#include <exception>
#include <cassert>
#include <cstdlib>
// test set_unexpected
-// MODULES_DEFINES: _LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS
-#define _LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS
+
#include <exception>
#include <cassert>
#include <cstdlib>
// test unexpected
-// MODULES_DEFINES: _LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS
-#define _LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS
+
#include <exception>
#include <cstdlib>
#include <cassert>
// REQUIRES: verify-support
-// MODULES_DEFINES: _LIBCPP_ENABLE_NODISCARD
-#define _LIBCPP_ENABLE_NODISCARD
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_NODISCARD
#include <__config>
// Test that _LIBCPP_DISABLE_NODISCARD_EXT only disables _LIBCPP_NODISCARD_EXT
// and not _LIBCPP_NODISCARD_AFTER_CXX17.
-// MODULES_DEFINES: _LIBCPP_ENABLE_NODISCARD
-// MODULES_DEFINES: _LIBCPP_DISABLE_NODISCARD_AFTER_CXX17
-#define _LIBCPP_ENABLE_NODISCARD
-#define _LIBCPP_DISABLE_NODISCARD_AFTER_CXX17
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_NODISCARD
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_NODISCARD_AFTER_CXX17
#include <__config>
// UNSUPPORTED: gcc-5, gcc-6
-// MODULES_DEFINES: _LIBCPP_ENABLE_NODISCARD
-// MODULES_DEFINES: _LIBCPP_DISABLE_NODISCARD_EXT
-#define _LIBCPP_ENABLE_NODISCARD
-#define _LIBCPP_DISABLE_NODISCARD_EXT
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_NODISCARD
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_NODISCARD_EXT
#include <__config>
// Test that _LIBCPP_NODISCARD_AFTER_CXX17 is disabled whenever
// _LIBCPP_DISABLE_NODISCARD_AFTER_CXX17 is defined by the user.
-// MODULES_DEFINES: _LIBCPP_DISABLE_NODISCARD_AFTER_CXX17
-#define _LIBCPP_DISABLE_NODISCARD_AFTER_CXX17
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_NODISCARD_AFTER_CXX17
+
#include <__config>
#include "test_macros.h"
// be tested here and in nodiscard_extensions.pass.cpp. They should also
// be listed in `UsingLibcxx.rst` in the documentation for the extension.
-// MODULES_DEFINES: _LIBCPP_ENABLE_NODISCARD
-#define _LIBCPP_ENABLE_NODISCARD
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_NODISCARD
#include <algorithm>
#include <functional>
//
//===----------------------------------------------------------------------===//
+// We're building as C, so this test doesn't work when building with modules.
+// UNSUPPORTED: -fmodules
+
// Test that the C wrapper headers can be included when compiling them as C.
// NOTE: It's not common or recommended to have libc++ in the header search
// UNSUPPORTED: c++98, c++03
// UNSUPPORTED: windows
-// MODULES_DEFINES: _LIBCPP_DEBUG=0
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=0
// This test requires debug mode, which the library on macOS doesn't have.
// UNSUPPORTED: with_system_cxx_lib=macosx
// class path
-#define _LIBCPP_DEBUG 0
#include "filesystem_include.h"
#include <iterator>
#include <type_traits>
//===----------------------------------------------------------------------===//
// Can't test the system lib because this test enables debug mode
-// MODULES_DEFINES: _LIBCPP_DEBUG=1
// UNSUPPORTED: c++98, c++03
// UNSUPPORTED: windows
// UNSUPPORTED: with_system_cxx_lib
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=0
// <list>
// Call advance(non-bidi iterator, -1)
-#define _LIBCPP_DEBUG 0
-
#include <iterator>
#include "test_macros.h"
#include "debug_mode_helper.h"
//===----------------------------------------------------------------------===//
// Can't test the system lib because this test enables debug mode
-// MODULES_DEFINES: _LIBCPP_DEBUG=1
// UNSUPPORTED: c++98, c++03
// UNSUPPORTED: windows
// UNSUPPORTED: with_system_cxx_lib
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=0
// <list>
// Call next(non-bidi iterator, -1)
-#define _LIBCPP_DEBUG 0
-
#include <iterator>
#include "test_macros.h"
#include "debug_mode_helper.h"
//===----------------------------------------------------------------------===//
// Can't test the system lib because this test enables debug mode
-// MODULES_DEFINES: _LIBCPP_DEBUG=1
// UNSUPPORTED: with_system_cxx_lib
// UNSUPPORTED: c++98, c++03
// UNSUPPORTED: windows
// UNSUPPORTED: with_system_cxx_lib
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=0
// <list>
// Call prev(forward_iterator, -1)
-#define _LIBCPP_DEBUG 0
-
#include <iterator>
#include "test_macros.h"
#include "debug_mode_helper.h"
// When exceptions are disabled, all iterators should get this "fast path"
//
-// MODULES_DEFINES: _LIBCPP_NO_EXCEPTIONS
-#define _LIBCPP_NO_EXCEPTIONS
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_NO_EXCEPTIONS
#include <iterator>
#include <cassert>
// UNSUPPORTED: libcpp-has-no-threads
// UNSUPPORTED: c++98, c++03
-// MODULES_DEFINES: _LIBCPP_DEBUG=0
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=0
// This test requires debug mode, which the library on macOS doesn't have.
// UNSUPPORTED: with_system_cxx_lib=macosx
// void set_exception(exception_ptr p);
// Test that a null exception_ptr is diagnosed.
-#define _LIBCPP_DEBUG 0
-
#include <future>
#include <exception>
#include <cstdlib>
// UNSUPPORTED: libcpp-has-no-threads
// UNSUPPORTED: c++98, c++03
-// MODULES_DEFINES: _LIBCPP_DEBUG=0
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=0
// This test requires debug mode, which the library on macOS doesn't have.
// UNSUPPORTED: with_system_cxx_lib=macosx
// void set_exception_on_thread_exit(exception_ptr p);
// Test that a null exception_ptr is diagnosed.
-#define _LIBCPP_DEBUG 0
#include <future>
#include <exception>
#include <cstdlib>
// Test that we properly apply [[nodiscard]] to lock_guard's constructors,
// which is a libc++ extension.
-// MODULES_DEFINES: _LIBCPP_ENABLE_NODISCARD
-#define _LIBCPP_ENABLE_NODISCARD
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_NODISCARD
+
#include <mutex>
int main(int, char**) {
// <mutex>
-// MODULES_DEFINES: _LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS
-#define _LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS
#include <mutex>
// <mutex>
-// MODULES_DEFINES: _LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS
-#define _LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS
#include <mutex>
// <mutex>
-// MODULES_DEFINES: _LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS
-#define _LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS
#include <mutex>
// <mutex>
-// MODULES_DEFINES: _LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS
-#define _LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS
#include <mutex>
// The pointer_safety interface is no longer provided in C++03 in the new ABI.
// XFAIL: c++98, c++03
-// MODULES_DEFINES: _LIBCPP_ABI_POINTER_SAFETY_ENUM_TYPE
-#define _LIBCPP_ABI_POINTER_SAFETY_ENUM_TYPE
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ABI_POINTER_SAFETY_ENUM_TYPE
+
#include <memory>
#include <cassert>
// UNSUPPORTED: c++98, c++03
-// MODULES_DEFINES: _LIBCPP_ENABLE_TUPLE_IMPLICIT_REDUCED_ARITY_EXTENSION
-#define _LIBCPP_ENABLE_TUPLE_IMPLICIT_REDUCED_ARITY_EXTENSION
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_TUPLE_IMPLICIT_REDUCED_ARITY_EXTENSION
+
#include <tuple>
#include <cassert>
#include <type_traits>
// typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
// };
-// MODULES_DEFINES: _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS
-// MODULES_DEFINES: _LIBCPP_DISABLE_DEPRECATION_WARNINGS
-#define _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS
-#define _LIBCPP_DISABLE_DEPRECATION_WARNINGS
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
#include <deque>
#include <iterator>
// typedef typename allocator_type::pointer pointer;
// typedef typename allocator_type::const_pointer const_pointer;
-// MODULES_DEFINES: _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS
-// MODULES_DEFINES: _LIBCPP_DISABLE_DEPRECATION_WARNINGS
-#define _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS
-#define _LIBCPP_DISABLE_DEPRECATION_WARNINGS
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
#include <list>
#include <type_traits>
// typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
// };
-// MODULES_DEFINES: _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS
-// MODULES_DEFINES: _LIBCPP_DISABLE_DEPRECATION_WARNINGS
-#define _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS
-#define _LIBCPP_DISABLE_DEPRECATION_WARNINGS
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
#include <vector>
#include <iterator>
// UNSUPPORTED: clang-4.0
// UNSUPPORTED: c++98, c++03
// REQUIRES: verify-support
-
-// MODULES_DEFINES: _LIBCPP_ENABLE_CXX17_REMOVED_BINDERS
-#define _LIBCPP_ENABLE_CXX17_REMOVED_BINDERS
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS
#include <functional>
// UNSUPPORTED: clang-4.0
// UNSUPPORTED: c++98, c++03
// REQUIRES: verify-support
-
-// MODULES_DEFINES: _LIBCPP_ENABLE_CXX17_REMOVED_BINDERS
-#define _LIBCPP_ENABLE_CXX17_REMOVED_BINDERS
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS
#include <functional>
// UNSUPPORTED: clang-4.0
// UNSUPPORTED: c++98, c++03
// REQUIRES: verify-support
-
-// MODULES_DEFINES: _LIBCPP_ENABLE_CXX17_REMOVED_BINDERS
-#define _LIBCPP_ENABLE_CXX17_REMOVED_BINDERS
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS
#include <functional>
// UNSUPPORTED: clang-4.0
// UNSUPPORTED: c++98, c++03
// REQUIRES: verify-support
-
-// MODULES_DEFINES: _LIBCPP_ENABLE_CXX17_REMOVED_BINDERS
-#define _LIBCPP_ENABLE_CXX17_REMOVED_BINDERS
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS
#include <functional>
// binary_negate
-// MODULES_DEFINES: _LIBCPP_DISABLE_DEPRECATION_WARNINGS
-#define _LIBCPP_DISABLE_DEPRECATION_WARNINGS
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
#include <functional>
#include <type_traits>
// not1
-// MODULES_DEFINES: _LIBCPP_DISABLE_DEPRECATION_WARNINGS
-#define _LIBCPP_DISABLE_DEPRECATION_WARNINGS
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
#include <functional>
#include <cassert>
// not2
-// MODULES_DEFINES: _LIBCPP_DISABLE_DEPRECATION_WARNINGS
-#define _LIBCPP_DISABLE_DEPRECATION_WARNINGS
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
#include <functional>
#include <cassert>
// unary_negate
-// MODULES_DEFINES: _LIBCPP_DISABLE_DEPRECATION_WARNINGS
-#define _LIBCPP_DISABLE_DEPRECATION_WARNINGS
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
#include <functional>
#include <type_traits>
// template <class T, class... Args>
// struct is_constructible;
-// MODULES_DEFINES: _LIBCPP_TESTING_FALLBACK_IS_CONSTRUCTIBLE
-#define _LIBCPP_TESTING_FALLBACK_IS_CONSTRUCTIBLE
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_TESTING_FALLBACK_IS_CONSTRUCTIBLE
+
#include <type_traits>
#include "test_macros.h"
sub.append(('%{cxx}', '{} {}'.format(tool_env, pipes.quote(self.cxx.path))))
sub.append(('%{libcxx_src_root}', self.libcxx_src_root))
# Configure flags substitutions
- sub.append(('%{flags}', ' '.join(map(pipes.quote, self.cxx.flags))))
+ flags = self.cxx.flags + (self.cxx.modules_flags if self.cxx.use_modules else [])
+ sub.append(('%{flags}', ' '.join(map(pipes.quote, flags))))
sub.append(('%{compile_flags}', ' '.join(map(pipes.quote, self.cxx.compile_flags))))
sub.append(('%{link_flags}', ' '.join(map(pipes.quote, self.cxx.link_flags))))
sub.append(('%{link_libcxxabi}', pipes.quote(self.cxx.link_libcxxabi_flag)))
@staticmethod
def _make_custom_parsers(test):
return [
- IntegratedTestKeywordParser('MODULES_DEFINES:', ParserKind.LIST,
- initial_value=[]),
IntegratedTestKeywordParser('FILE_DEPENDENCIES:', ParserKind.LIST,
initial_value=test.file_dependencies),
IntegratedTestKeywordParser('ADDITIONAL_COMPILE_FLAGS:', ParserKind.LIST,
if is_fail_test:
test_cxx.useCCache(False)
test_cxx.useWarnings(False)
- extra_modules_defines = self._get_parser('MODULES_DEFINES:',
- parsers).getValue()
if '-fmodules' in test.config.available_features:
- test_cxx.compile_flags += [('-D%s' % mdef.strip()) for
- mdef in extra_modules_defines]
test_cxx.addWarningFlagIfSupported('-Wno-macro-redefined')
# FIXME: libc++ debug tests #define _LIBCPP_ASSERT to override it
# If we see this we need to build the test against uniquely built
past, so we favour having tests mark themselves as unsupported explicitly.
This test format still needs work in the following areas:
- - It doesn't support the MODULES_DEFINES from the old test format, but
- that can be achieved easily with ADDITIONAL_COMPILE_FLAGS.
- It is unknown how well it works on Windows yet.
"""
def getTestsInDirectory(self, testSuite, pathInSuite, litConfig, localConfig):
compilerSupportsVerify = result.code != lit.Test.FAIL
return compilerSupportsVerify and testContainsTags
+ def _disableWithModules(self, test, litConfig):
+ with open(test.getSourcePath(), 'rb') as f:
+ contents = f.read()
+ return b'#define _LIBCPP_ASSERT' in contents
+
def execute(self, test, litConfig):
self._checkSubstitutions(test.config.substitutions)
VERIFY_FLAGS = '-Xclang -verify -Xclang -verify-ignore-unexpected=note -ferror-limit=0'
filename = test.path_in_suite[-1]
+
+ # TODO(ldionne): We currently disable tests that re-define _LIBCPP_ASSERT
+ # when we run with modules enabled. Instead, we should
+ # split the part that does a death test outside of the
+ # test, and only disable that part when modules are
+ # enabled.
+ if '-fmodules' in test.config.available_features and self._disableWithModules(test, litConfig):
+ return lit.Test.Result(lit.Test.UNSUPPORTED, 'Test {} is unsupported when modules are enabled')
+
if filename.endswith('.sh.cpp') or filename.endswith('.sh.s'):
steps = [ ] # The steps are already in the script
return self._executeShTest(test, litConfig, steps)