[libcxx-commits] [libcxx] f8b6529 - [libc++] Translate MODULES_DEFINES annotations to ADDITIONAL_COMPILE_FLAGS
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Apr 7 11:41:01 PDT 2020
Author: Louis Dionne
Date: 2020-04-07T14:40:49-04:00
New Revision: f8b6529218f22ea112aabebe13d58cfef6a9c09a
URL: https://github.com/llvm/llvm-project/commit/f8b6529218f22ea112aabebe13d58cfef6a9c09a
DIFF: https://github.com/llvm/llvm-project/commit/f8b6529218f22ea112aabebe13d58cfef6a9c09a.diff
LOG: [libc++] Translate MODULES_DEFINES annotations to ADDITIONAL_COMPILE_FLAGS
This allows both the old and the new testing formats to handle these
tests with modules enabled.
We also include the modules flags in the %{flags} substitution, which
means that .sh.cpp tests in the old format and all tests in the new
format will use modules flags when enabled.
Added:
Modified:
libcxx/test/libcxx/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.cxx1z.pass.cpp
libcxx/test/libcxx/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.depr_in_cxx14.fail.cpp
libcxx/test/libcxx/atomics/libcpp-has-no-threads.fail.cpp
libcxx/test/libcxx/containers/sequences/array/array.zero/db_back.pass.cpp
libcxx/test/libcxx/containers/sequences/array/array.zero/db_front.pass.cpp
libcxx/test/libcxx/containers/sequences/array/array.zero/db_indexing.pass.cpp
libcxx/test/libcxx/containers/sequences/deque/incomplete.pass.cpp
libcxx/test/libcxx/debug/containers/db_associative_container_tests.pass.cpp
libcxx/test/libcxx/debug/containers/db_sequence_container_iterators.multithread.pass.cpp
libcxx/test/libcxx/debug/containers/db_sequence_container_iterators.pass.cpp
libcxx/test/libcxx/debug/containers/db_string.pass.cpp
libcxx/test/libcxx/debug/containers/db_unord_container_tests.pass.cpp
libcxx/test/libcxx/debug/db_string_view.pass.cpp
libcxx/test/libcxx/debug/debug_abort.pass.cpp
libcxx/test/libcxx/debug/debug_helper_test.pass.cpp
libcxx/test/libcxx/debug/debug_register.pass.cpp
libcxx/test/libcxx/depr/depr.auto.ptr/auto.ptr/auto_ptr.cxx1z.pass.cpp
libcxx/test/libcxx/depr/depr.auto.ptr/auto.ptr/auto_ptr.depr_in_cxx11.fail.cpp
libcxx/test/libcxx/depr/depr.default.allocator/allocator.members/address.cxx2a.pass.cpp
libcxx/test/libcxx/depr/depr.default.allocator/allocator.members/address.depr_in_cxx17.fail.cpp
libcxx/test/libcxx/depr/depr.default.allocator/allocator.members/allocate.cxx2a.fail.cpp
libcxx/test/libcxx/depr/depr.default.allocator/allocator.members/allocate.cxx2a.pass.cpp
libcxx/test/libcxx/depr/depr.default.allocator/allocator.members/allocate.depr_in_cxx17.fail.cpp
libcxx/test/libcxx/depr/depr.default.allocator/allocator.members/construct.cxx2a.pass.cpp
libcxx/test/libcxx/depr/depr.default.allocator/allocator.members/max_size.cxx2a.pass.cpp
libcxx/test/libcxx/depr/depr.default.allocator/allocator_types.cxx2a.pass.cpp
libcxx/test/libcxx/depr/depr.default.allocator/allocator_types.depr_in_cxx17.fail.cpp
libcxx/test/libcxx/depr/depr.default.allocator/allocator_void.cxx2a.pass.cpp
libcxx/test/libcxx/depr/depr.default.allocator/allocator_void.depr_in_cxx17.fail.cpp
libcxx/test/libcxx/depr/depr.function.objects/adaptors.depr_in_cxx11.fail.cpp
libcxx/test/libcxx/depr/depr.function.objects/depr.adaptors.cxx1z.pass.cpp
libcxx/test/libcxx/depr/enable_removed_cpp17_features.pass.cpp
libcxx/test/libcxx/depr/exception.unexpected/get_unexpected.pass.cpp
libcxx/test/libcxx/depr/exception.unexpected/set_unexpected.pass.cpp
libcxx/test/libcxx/depr/exception.unexpected/unexpected.pass.cpp
libcxx/test/libcxx/diagnostics/enable_nodiscard.fail.cpp
libcxx/test/libcxx/diagnostics/enable_nodiscard_disable_after_cxx17.fail.cpp
libcxx/test/libcxx/diagnostics/enable_nodiscard_disable_nodiscard_ext.fail.cpp
libcxx/test/libcxx/diagnostics/nodiscard_aftercxx17.pass.cpp
libcxx/test/libcxx/diagnostics/nodiscard_extensions.fail.cpp
libcxx/test/libcxx/include_as_c.sh.cpp
libcxx/test/libcxx/input.output/filesystems/class.path/path.itr/iterator_db.pass.cpp
libcxx/test/libcxx/iterators/advance.debug1.pass.cpp
libcxx/test/libcxx/iterators/next.debug1.pass.cpp
libcxx/test/libcxx/iterators/prev.debug1.pass.cpp
libcxx/test/libcxx/strings/iterators.noexcept.pass.cpp
libcxx/test/libcxx/thread/futures/futures.promise/set_exception.pass.cpp
libcxx/test/libcxx/thread/futures/futures.promise/set_exception_at_thread_exit.pass.cpp
libcxx/test/libcxx/thread/thread.lock/thread.lock.guard/nodiscard.fail.cpp
libcxx/test/libcxx/thread/thread.mutex/thread_safety_lock_guard.pass.cpp
libcxx/test/libcxx/thread/thread.mutex/thread_safety_lock_unlock.pass.cpp
libcxx/test/libcxx/thread/thread.mutex/thread_safety_missing_unlock.fail.cpp
libcxx/test/libcxx/thread/thread.mutex/thread_safety_requires_capability.pass.cpp
libcxx/test/libcxx/utilities/memory/util.dynamic.safety/get_pointer_safety_new_abi.pass.cpp
libcxx/test/libcxx/utilities/tuple/tuple.tuple/tuple.cnstr/enable_reduced_arity_initialization_extension.pass.cpp
libcxx/test/std/containers/sequences/deque/types.pass.cpp
libcxx/test/std/containers/sequences/list/types.pass.cpp
libcxx/test/std/containers/sequences/vector/types.pass.cpp
libcxx/test/std/depr/depr.lib.binders/depr.lib.bind.1st/bind1st.depr_in_cxx11.fail.cpp
libcxx/test/std/depr/depr.lib.binders/depr.lib.bind.2nd/bind2nd.depr_in_cxx11.fail.cpp
libcxx/test/std/depr/depr.lib.binders/depr.lib.binder.1st/binder1st.depr_in_cxx11.fail.cpp
libcxx/test/std/depr/depr.lib.binders/depr.lib.binder.2nd/binder2nd.depr_in_cxx11.fail.cpp
libcxx/test/std/utilities/function.objects/negators/binary_negate.pass.cpp
libcxx/test/std/utilities/function.objects/negators/not1.pass.cpp
libcxx/test/std/utilities/function.objects/negators/not2.pass.cpp
libcxx/test/std/utilities/function.objects/negators/unary_negate.pass.cpp
libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp
libcxx/utils/libcxx/test/config.py
libcxx/utils/libcxx/test/format.py
libcxx/utils/libcxx/test/newformat.py
Removed:
################################################################################
diff --git a/libcxx/test/libcxx/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.cxx1z.pass.cpp b/libcxx/test/libcxx/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.cxx1z.pass.cpp
index a63c1c28b0e7..362493c756ff 100644
--- a/libcxx/test/libcxx/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.cxx1z.pass.cpp
+++ b/libcxx/test/libcxx/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.cxx1z.pass.cpp
@@ -24,10 +24,8 @@
// 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>
diff --git a/libcxx/test/libcxx/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.depr_in_cxx14.fail.cpp b/libcxx/test/libcxx/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.depr_in_cxx14.fail.cpp
index b67f9a8b75fa..2dc80131c605 100644
--- a/libcxx/test/libcxx/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.depr_in_cxx14.fail.cpp
+++ b/libcxx/test/libcxx/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.depr_in_cxx14.fail.cpp
@@ -21,8 +21,7 @@
// 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>
diff --git a/libcxx/test/libcxx/atomics/libcpp-has-no-threads.fail.cpp b/libcxx/test/libcxx/atomics/libcpp-has-no-threads.fail.cpp
index 6ee09e206467..9c6a8f7f55f6 100644
--- a/libcxx/test/libcxx/atomics/libcpp-has-no-threads.fail.cpp
+++ b/libcxx/test/libcxx/atomics/libcpp-has-no-threads.fail.cpp
@@ -11,10 +11,7 @@
// 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>
diff --git a/libcxx/test/libcxx/containers/sequences/array/array.zero/db_back.pass.cpp b/libcxx/test/libcxx/containers/sequences/array/array.zero/db_back.pass.cpp
index 1cd95f36149a..2ba397519241 100644
--- a/libcxx/test/libcxx/containers/sequences/array/array.zero/db_back.pass.cpp
+++ b/libcxx/test/libcxx/containers/sequences/array/array.zero/db_back.pass.cpp
@@ -8,14 +8,13 @@
// 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"
diff --git a/libcxx/test/libcxx/containers/sequences/array/array.zero/db_front.pass.cpp b/libcxx/test/libcxx/containers/sequences/array/array.zero/db_front.pass.cpp
index 98149fa20ad1..9eb98d59a9d6 100644
--- a/libcxx/test/libcxx/containers/sequences/array/array.zero/db_front.pass.cpp
+++ b/libcxx/test/libcxx/containers/sequences/array/array.zero/db_front.pass.cpp
@@ -8,14 +8,13 @@
// 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"
diff --git a/libcxx/test/libcxx/containers/sequences/array/array.zero/db_indexing.pass.cpp b/libcxx/test/libcxx/containers/sequences/array/array.zero/db_indexing.pass.cpp
index 8cbf0d753cd8..95016231136a 100644
--- a/libcxx/test/libcxx/containers/sequences/array/array.zero/db_indexing.pass.cpp
+++ b/libcxx/test/libcxx/containers/sequences/array/array.zero/db_indexing.pass.cpp
@@ -8,14 +8,13 @@
// 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"
diff --git a/libcxx/test/libcxx/containers/sequences/deque/incomplete.pass.cpp b/libcxx/test/libcxx/containers/sequences/deque/incomplete.pass.cpp
index 5576f2b8f904..65505ef8c2ef 100644
--- a/libcxx/test/libcxx/containers/sequences/deque/incomplete.pass.cpp
+++ b/libcxx/test/libcxx/containers/sequences/deque/incomplete.pass.cpp
@@ -11,8 +11,8 @@
// 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>
diff --git a/libcxx/test/libcxx/debug/containers/db_associative_container_tests.pass.cpp b/libcxx/test/libcxx/debug/containers/db_associative_container_tests.pass.cpp
index 8ee62aeeffa8..9386be0bb350 100644
--- a/libcxx/test/libcxx/debug/containers/db_associative_container_tests.pass.cpp
+++ b/libcxx/test/libcxx/debug/containers/db_associative_container_tests.pass.cpp
@@ -9,15 +9,13 @@
// 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>
diff --git a/libcxx/test/libcxx/debug/containers/db_sequence_container_iterators.multithread.pass.cpp b/libcxx/test/libcxx/debug/containers/db_sequence_container_iterators.multithread.pass.cpp
index fcdc45d93881..831f3e431620 100644
--- a/libcxx/test/libcxx/debug/containers/db_sequence_container_iterators.multithread.pass.cpp
+++ b/libcxx/test/libcxx/debug/containers/db_sequence_container_iterators.multithread.pass.cpp
@@ -9,15 +9,13 @@
// 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>
diff --git a/libcxx/test/libcxx/debug/containers/db_sequence_container_iterators.pass.cpp b/libcxx/test/libcxx/debug/containers/db_sequence_container_iterators.pass.cpp
index 68b41b26f58b..efd5f293f8f4 100644
--- a/libcxx/test/libcxx/debug/containers/db_sequence_container_iterators.pass.cpp
+++ b/libcxx/test/libcxx/debug/containers/db_sequence_container_iterators.pass.cpp
@@ -9,15 +9,13 @@
// 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>
diff --git a/libcxx/test/libcxx/debug/containers/db_string.pass.cpp b/libcxx/test/libcxx/debug/containers/db_string.pass.cpp
index 8c39cccb7be2..ff0c77718473 100644
--- a/libcxx/test/libcxx/debug/containers/db_string.pass.cpp
+++ b/libcxx/test/libcxx/debug/containers/db_string.pass.cpp
@@ -9,14 +9,13 @@
// 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>
diff --git a/libcxx/test/libcxx/debug/containers/db_unord_container_tests.pass.cpp b/libcxx/test/libcxx/debug/containers/db_unord_container_tests.pass.cpp
index b5d19954fc8a..b4cb874c8a33 100644
--- a/libcxx/test/libcxx/debug/containers/db_unord_container_tests.pass.cpp
+++ b/libcxx/test/libcxx/debug/containers/db_unord_container_tests.pass.cpp
@@ -9,14 +9,13 @@
// 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>
diff --git a/libcxx/test/libcxx/debug/db_string_view.pass.cpp b/libcxx/test/libcxx/debug/db_string_view.pass.cpp
index d4ae1cebdb43..6de2cf7021be 100644
--- a/libcxx/test/libcxx/debug/db_string_view.pass.cpp
+++ b/libcxx/test/libcxx/debug/db_string_view.pass.cpp
@@ -9,14 +9,13 @@
// 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"
diff --git a/libcxx/test/libcxx/debug/debug_abort.pass.cpp b/libcxx/test/libcxx/debug/debug_abort.pass.cpp
index 15c9173b285a..89dbdc7688fd 100644
--- a/libcxx/test/libcxx/debug/debug_abort.pass.cpp
+++ b/libcxx/test/libcxx/debug/debug_abort.pass.cpp
@@ -7,15 +7,13 @@
//
//===----------------------------------------------------------------------===//
-// 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>
diff --git a/libcxx/test/libcxx/debug/debug_helper_test.pass.cpp b/libcxx/test/libcxx/debug/debug_helper_test.pass.cpp
index fada39ccbaf3..be41d12d795d 100644
--- a/libcxx/test/libcxx/debug/debug_helper_test.pass.cpp
+++ b/libcxx/test/libcxx/debug/debug_helper_test.pass.cpp
@@ -13,9 +13,7 @@
// 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"
diff --git a/libcxx/test/libcxx/debug/debug_register.pass.cpp b/libcxx/test/libcxx/debug/debug_register.pass.cpp
index d687fc90a1ca..ac298c03fc9a 100644
--- a/libcxx/test/libcxx/debug/debug_register.pass.cpp
+++ b/libcxx/test/libcxx/debug/debug_register.pass.cpp
@@ -7,13 +7,11 @@
//
//===----------------------------------------------------------------------===//
-// 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>
diff --git a/libcxx/test/libcxx/depr/depr.auto.ptr/auto.ptr/auto_ptr.cxx1z.pass.cpp b/libcxx/test/libcxx/depr/depr.auto.ptr/auto.ptr/auto_ptr.cxx1z.pass.cpp
index cdf976cb606a..89ddd3351d16 100644
--- a/libcxx/test/libcxx/depr/depr.auto.ptr/auto.ptr/auto_ptr.cxx1z.pass.cpp
+++ b/libcxx/test/libcxx/depr/depr.auto.ptr/auto.ptr/auto_ptr.cxx1z.pass.cpp
@@ -15,10 +15,8 @@
// 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>
diff --git a/libcxx/test/libcxx/depr/depr.auto.ptr/auto.ptr/auto_ptr.depr_in_cxx11.fail.cpp b/libcxx/test/libcxx/depr/depr.auto.ptr/auto.ptr/auto_ptr.depr_in_cxx11.fail.cpp
index 0b7d908e2bdd..31019f3e9fc1 100644
--- a/libcxx/test/libcxx/depr/depr.auto.ptr/auto.ptr/auto_ptr.depr_in_cxx11.fail.cpp
+++ b/libcxx/test/libcxx/depr/depr.auto.ptr/auto.ptr/auto_ptr.depr_in_cxx11.fail.cpp
@@ -22,8 +22,7 @@
// 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"
diff --git a/libcxx/test/libcxx/depr/depr.default.allocator/allocator.members/address.cxx2a.pass.cpp b/libcxx/test/libcxx/depr/depr.default.allocator/allocator.members/address.cxx2a.pass.cpp
index 0cf49df5422a..59657ca46a14 100644
--- a/libcxx/test/libcxx/depr/depr.default.allocator/allocator.members/address.cxx2a.pass.cpp
+++ b/libcxx/test/libcxx/depr/depr.default.allocator/allocator.members/address.cxx2a.pass.cpp
@@ -16,10 +16,8 @@
// 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>
diff --git a/libcxx/test/libcxx/depr/depr.default.allocator/allocator.members/address.depr_in_cxx17.fail.cpp b/libcxx/test/libcxx/depr/depr.default.allocator/allocator.members/address.depr_in_cxx17.fail.cpp
index 03cd3b7bd67e..8b919e4f3b54 100644
--- a/libcxx/test/libcxx/depr/depr.default.allocator/allocator.members/address.depr_in_cxx17.fail.cpp
+++ b/libcxx/test/libcxx/depr/depr.default.allocator/allocator.members/address.depr_in_cxx17.fail.cpp
@@ -17,8 +17,7 @@
// 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"
diff --git a/libcxx/test/libcxx/depr/depr.default.allocator/allocator.members/allocate.cxx2a.fail.cpp b/libcxx/test/libcxx/depr/depr.default.allocator/allocator.members/allocate.cxx2a.fail.cpp
index 9c2e4b1cecd7..455016aa9100 100644
--- a/libcxx/test/libcxx/depr/depr.default.allocator/allocator.members/allocate.cxx2a.fail.cpp
+++ b/libcxx/test/libcxx/depr/depr.default.allocator/allocator.members/allocate.cxx2a.fail.cpp
@@ -19,10 +19,8 @@
// 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>
diff --git a/libcxx/test/libcxx/depr/depr.default.allocator/allocator.members/allocate.cxx2a.pass.cpp b/libcxx/test/libcxx/depr/depr.default.allocator/allocator.members/allocate.cxx2a.pass.cpp
index 1d83efa3bf0e..cca85103bcb1 100644
--- a/libcxx/test/libcxx/depr/depr.default.allocator/allocator.members/allocate.cxx2a.pass.cpp
+++ b/libcxx/test/libcxx/depr/depr.default.allocator/allocator.members/allocate.cxx2a.pass.cpp
@@ -11,10 +11,8 @@
// 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>
diff --git a/libcxx/test/libcxx/depr/depr.default.allocator/allocator.members/allocate.depr_in_cxx17.fail.cpp b/libcxx/test/libcxx/depr/depr.default.allocator/allocator.members/allocate.depr_in_cxx17.fail.cpp
index 03b1791d1601..844bb553e968 100644
--- a/libcxx/test/libcxx/depr/depr.default.allocator/allocator.members/allocate.depr_in_cxx17.fail.cpp
+++ b/libcxx/test/libcxx/depr/depr.default.allocator/allocator.members/allocate.depr_in_cxx17.fail.cpp
@@ -16,8 +16,7 @@
// 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"
diff --git a/libcxx/test/libcxx/depr/depr.default.allocator/allocator.members/construct.cxx2a.pass.cpp b/libcxx/test/libcxx/depr/depr.default.allocator/allocator.members/construct.cxx2a.pass.cpp
index e86bfe2d3c42..56acbbf184af 100644
--- a/libcxx/test/libcxx/depr/depr.default.allocator/allocator.members/construct.cxx2a.pass.cpp
+++ b/libcxx/test/libcxx/depr/depr.default.allocator/allocator.members/construct.cxx2a.pass.cpp
@@ -15,10 +15,8 @@
// 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>
diff --git a/libcxx/test/libcxx/depr/depr.default.allocator/allocator.members/max_size.cxx2a.pass.cpp b/libcxx/test/libcxx/depr/depr.default.allocator/allocator.members/max_size.cxx2a.pass.cpp
index 2b6499f9b962..b07568355fee 100644
--- a/libcxx/test/libcxx/depr/depr.default.allocator/allocator.members/max_size.cxx2a.pass.cpp
+++ b/libcxx/test/libcxx/depr/depr.default.allocator/allocator.members/max_size.cxx2a.pass.cpp
@@ -15,10 +15,8 @@
// 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>
diff --git a/libcxx/test/libcxx/depr/depr.default.allocator/allocator_types.cxx2a.pass.cpp b/libcxx/test/libcxx/depr/depr.default.allocator/allocator_types.cxx2a.pass.cpp
index 6d8c49399de8..33ed39a7c483 100644
--- a/libcxx/test/libcxx/depr/depr.default.allocator/allocator_types.cxx2a.pass.cpp
+++ b/libcxx/test/libcxx/depr/depr.default.allocator/allocator_types.cxx2a.pass.cpp
@@ -25,10 +25,8 @@
// ...
// };
-// 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>
diff --git a/libcxx/test/libcxx/depr/depr.default.allocator/allocator_types.depr_in_cxx17.fail.cpp b/libcxx/test/libcxx/depr/depr.default.allocator/allocator_types.depr_in_cxx17.fail.cpp
index c1a6333c0b07..73e22feffaa9 100644
--- a/libcxx/test/libcxx/depr/depr.default.allocator/allocator_types.depr_in_cxx17.fail.cpp
+++ b/libcxx/test/libcxx/depr/depr.default.allocator/allocator_types.depr_in_cxx17.fail.cpp
@@ -34,8 +34,7 @@
// 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"
diff --git a/libcxx/test/libcxx/depr/depr.default.allocator/allocator_void.cxx2a.pass.cpp b/libcxx/test/libcxx/depr/depr.default.allocator/allocator_void.cxx2a.pass.cpp
index a3dc9cb03725..3b941d2ce9ea 100644
--- a/libcxx/test/libcxx/depr/depr.default.allocator/allocator_void.cxx2a.pass.cpp
+++ b/libcxx/test/libcxx/depr/depr.default.allocator/allocator_void.cxx2a.pass.cpp
@@ -19,10 +19,8 @@
// 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>
diff --git a/libcxx/test/libcxx/depr/depr.default.allocator/allocator_void.depr_in_cxx17.fail.cpp b/libcxx/test/libcxx/depr/depr.default.allocator/allocator_void.depr_in_cxx17.fail.cpp
index 82d1777a5d2b..8133fff3b7ce 100644
--- a/libcxx/test/libcxx/depr/depr.default.allocator/allocator_void.depr_in_cxx17.fail.cpp
+++ b/libcxx/test/libcxx/depr/depr.default.allocator/allocator_void.depr_in_cxx17.fail.cpp
@@ -24,8 +24,7 @@
// 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"
diff --git a/libcxx/test/libcxx/depr/depr.function.objects/adaptors.depr_in_cxx11.fail.cpp b/libcxx/test/libcxx/depr/depr.function.objects/adaptors.depr_in_cxx11.fail.cpp
index 329b3acb2354..c5f155269a1a 100644
--- a/libcxx/test/libcxx/depr/depr.function.objects/adaptors.depr_in_cxx11.fail.cpp
+++ b/libcxx/test/libcxx/depr/depr.function.objects/adaptors.depr_in_cxx11.fail.cpp
@@ -12,8 +12,7 @@
// 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>
diff --git a/libcxx/test/libcxx/depr/depr.function.objects/depr.adaptors.cxx1z.pass.cpp b/libcxx/test/libcxx/depr/depr.function.objects/depr.adaptors.cxx1z.pass.cpp
index fff0d3592f7d..7583c36ba19d 100644
--- a/libcxx/test/libcxx/depr/depr.function.objects/depr.adaptors.cxx1z.pass.cpp
+++ b/libcxx/test/libcxx/depr/depr.function.objects/depr.adaptors.cxx1z.pass.cpp
@@ -13,10 +13,8 @@
// 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>
diff --git a/libcxx/test/libcxx/depr/enable_removed_cpp17_features.pass.cpp b/libcxx/test/libcxx/depr/enable_removed_cpp17_features.pass.cpp
index 115a5f3b4523..3ae848fcdfd0 100644
--- a/libcxx/test/libcxx/depr/enable_removed_cpp17_features.pass.cpp
+++ b/libcxx/test/libcxx/depr/enable_removed_cpp17_features.pass.cpp
@@ -9,8 +9,8 @@
// 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"
diff --git a/libcxx/test/libcxx/depr/exception.unexpected/get_unexpected.pass.cpp b/libcxx/test/libcxx/depr/exception.unexpected/get_unexpected.pass.cpp
index a40d889cfb42..e4533a01c5bf 100644
--- a/libcxx/test/libcxx/depr/exception.unexpected/get_unexpected.pass.cpp
+++ b/libcxx/test/libcxx/depr/exception.unexpected/get_unexpected.pass.cpp
@@ -8,9 +8,8 @@
// 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>
diff --git a/libcxx/test/libcxx/depr/exception.unexpected/set_unexpected.pass.cpp b/libcxx/test/libcxx/depr/exception.unexpected/set_unexpected.pass.cpp
index 745c3cda5bcf..f428790f6cc9 100644
--- a/libcxx/test/libcxx/depr/exception.unexpected/set_unexpected.pass.cpp
+++ b/libcxx/test/libcxx/depr/exception.unexpected/set_unexpected.pass.cpp
@@ -8,8 +8,8 @@
// 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>
diff --git a/libcxx/test/libcxx/depr/exception.unexpected/unexpected.pass.cpp b/libcxx/test/libcxx/depr/exception.unexpected/unexpected.pass.cpp
index fa7ed3e1d987..6ab1147b912e 100644
--- a/libcxx/test/libcxx/depr/exception.unexpected/unexpected.pass.cpp
+++ b/libcxx/test/libcxx/depr/exception.unexpected/unexpected.pass.cpp
@@ -8,8 +8,8 @@
// 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>
diff --git a/libcxx/test/libcxx/diagnostics/enable_nodiscard.fail.cpp b/libcxx/test/libcxx/diagnostics/enable_nodiscard.fail.cpp
index d579a4ccea8c..0888684ec354 100644
--- a/libcxx/test/libcxx/diagnostics/enable_nodiscard.fail.cpp
+++ b/libcxx/test/libcxx/diagnostics/enable_nodiscard.fail.cpp
@@ -18,8 +18,7 @@
// REQUIRES: verify-support
-// MODULES_DEFINES: _LIBCPP_ENABLE_NODISCARD
-#define _LIBCPP_ENABLE_NODISCARD
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_NODISCARD
#include <__config>
diff --git a/libcxx/test/libcxx/diagnostics/enable_nodiscard_disable_after_cxx17.fail.cpp b/libcxx/test/libcxx/diagnostics/enable_nodiscard_disable_after_cxx17.fail.cpp
index f4f74de52a10..1a21b48c009b 100644
--- a/libcxx/test/libcxx/diagnostics/enable_nodiscard_disable_after_cxx17.fail.cpp
+++ b/libcxx/test/libcxx/diagnostics/enable_nodiscard_disable_after_cxx17.fail.cpp
@@ -16,10 +16,8 @@
// 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>
diff --git a/libcxx/test/libcxx/diagnostics/enable_nodiscard_disable_nodiscard_ext.fail.cpp b/libcxx/test/libcxx/diagnostics/enable_nodiscard_disable_nodiscard_ext.fail.cpp
index c2f29387b3be..888785e31d94 100644
--- a/libcxx/test/libcxx/diagnostics/enable_nodiscard_disable_nodiscard_ext.fail.cpp
+++ b/libcxx/test/libcxx/diagnostics/enable_nodiscard_disable_nodiscard_ext.fail.cpp
@@ -14,10 +14,8 @@
// 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>
diff --git a/libcxx/test/libcxx/diagnostics/nodiscard_aftercxx17.pass.cpp b/libcxx/test/libcxx/diagnostics/nodiscard_aftercxx17.pass.cpp
index edf5a25e1db7..4e85e25e7135 100644
--- a/libcxx/test/libcxx/diagnostics/nodiscard_aftercxx17.pass.cpp
+++ b/libcxx/test/libcxx/diagnostics/nodiscard_aftercxx17.pass.cpp
@@ -10,8 +10,8 @@
// 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"
diff --git a/libcxx/test/libcxx/diagnostics/nodiscard_extensions.fail.cpp b/libcxx/test/libcxx/diagnostics/nodiscard_extensions.fail.cpp
index ef6e1fedfb88..6dbeb7f71024 100644
--- a/libcxx/test/libcxx/diagnostics/nodiscard_extensions.fail.cpp
+++ b/libcxx/test/libcxx/diagnostics/nodiscard_extensions.fail.cpp
@@ -21,8 +21,7 @@
// 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>
diff --git a/libcxx/test/libcxx/include_as_c.sh.cpp b/libcxx/test/libcxx/include_as_c.sh.cpp
index c001c63e8359..8a57e389dc2f 100644
--- a/libcxx/test/libcxx/include_as_c.sh.cpp
+++ b/libcxx/test/libcxx/include_as_c.sh.cpp
@@ -7,6 +7,9 @@
//
//===----------------------------------------------------------------------===//
+// 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
diff --git a/libcxx/test/libcxx/input.output/filesystems/class.path/path.itr/iterator_db.pass.cpp b/libcxx/test/libcxx/input.output/filesystems/class.path/path.itr/iterator_db.pass.cpp
index 6fa9d2c274bd..3c69c1833ac6 100644
--- a/libcxx/test/libcxx/input.output/filesystems/class.path/path.itr/iterator_db.pass.cpp
+++ b/libcxx/test/libcxx/input.output/filesystems/class.path/path.itr/iterator_db.pass.cpp
@@ -9,7 +9,7 @@
// 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
@@ -18,7 +18,6 @@
// class path
-#define _LIBCPP_DEBUG 0
#include "filesystem_include.h"
#include <iterator>
#include <type_traits>
diff --git a/libcxx/test/libcxx/iterators/advance.debug1.pass.cpp b/libcxx/test/libcxx/iterators/advance.debug1.pass.cpp
index fd67953c1f1b..f9b9596655bd 100644
--- a/libcxx/test/libcxx/iterators/advance.debug1.pass.cpp
+++ b/libcxx/test/libcxx/iterators/advance.debug1.pass.cpp
@@ -7,17 +7,15 @@
//===----------------------------------------------------------------------===//
// 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"
diff --git a/libcxx/test/libcxx/iterators/next.debug1.pass.cpp b/libcxx/test/libcxx/iterators/next.debug1.pass.cpp
index 66d3a1a03f0a..f7190645822f 100644
--- a/libcxx/test/libcxx/iterators/next.debug1.pass.cpp
+++ b/libcxx/test/libcxx/iterators/next.debug1.pass.cpp
@@ -7,17 +7,15 @@
//===----------------------------------------------------------------------===//
// 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"
diff --git a/libcxx/test/libcxx/iterators/prev.debug1.pass.cpp b/libcxx/test/libcxx/iterators/prev.debug1.pass.cpp
index 42222de4b6ed..b58debcdf794 100644
--- a/libcxx/test/libcxx/iterators/prev.debug1.pass.cpp
+++ b/libcxx/test/libcxx/iterators/prev.debug1.pass.cpp
@@ -7,18 +7,16 @@
//===----------------------------------------------------------------------===//
// 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"
diff --git a/libcxx/test/libcxx/strings/iterators.noexcept.pass.cpp b/libcxx/test/libcxx/strings/iterators.noexcept.pass.cpp
index b46bc639b7a8..787b86ad95b9 100644
--- a/libcxx/test/libcxx/strings/iterators.noexcept.pass.cpp
+++ b/libcxx/test/libcxx/strings/iterators.noexcept.pass.cpp
@@ -18,8 +18,7 @@
// 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>
diff --git a/libcxx/test/libcxx/thread/futures/futures.promise/set_exception.pass.cpp b/libcxx/test/libcxx/thread/futures/futures.promise/set_exception.pass.cpp
index 37ef0d1f04be..21683741fc96 100644
--- a/libcxx/test/libcxx/thread/futures/futures.promise/set_exception.pass.cpp
+++ b/libcxx/test/libcxx/thread/futures/futures.promise/set_exception.pass.cpp
@@ -10,7 +10,7 @@
// 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
@@ -22,8 +22,6 @@
// void set_exception(exception_ptr p);
// Test that a null exception_ptr is diagnosed.
-#define _LIBCPP_DEBUG 0
-
#include <future>
#include <exception>
#include <cstdlib>
diff --git a/libcxx/test/libcxx/thread/futures/futures.promise/set_exception_at_thread_exit.pass.cpp b/libcxx/test/libcxx/thread/futures/futures.promise/set_exception_at_thread_exit.pass.cpp
index 54778777056c..768900612785 100644
--- a/libcxx/test/libcxx/thread/futures/futures.promise/set_exception_at_thread_exit.pass.cpp
+++ b/libcxx/test/libcxx/thread/futures/futures.promise/set_exception_at_thread_exit.pass.cpp
@@ -10,7 +10,7 @@
// 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
@@ -22,7 +22,6 @@
// 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>
diff --git a/libcxx/test/libcxx/thread/thread.lock/thread.lock.guard/nodiscard.fail.cpp b/libcxx/test/libcxx/thread/thread.lock/thread.lock.guard/nodiscard.fail.cpp
index e14bcd979d90..f848d5ed6223 100644
--- a/libcxx/test/libcxx/thread/thread.lock/thread.lock.guard/nodiscard.fail.cpp
+++ b/libcxx/test/libcxx/thread/thread.lock/thread.lock.guard/nodiscard.fail.cpp
@@ -27,8 +27,8 @@
// 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**) {
diff --git a/libcxx/test/libcxx/thread/thread.mutex/thread_safety_lock_guard.pass.cpp b/libcxx/test/libcxx/thread/thread.mutex/thread_safety_lock_guard.pass.cpp
index 8f8b6ce1c33a..380839cceda9 100644
--- a/libcxx/test/libcxx/thread/thread.mutex/thread_safety_lock_guard.pass.cpp
+++ b/libcxx/test/libcxx/thread/thread.mutex/thread_safety_lock_guard.pass.cpp
@@ -15,8 +15,7 @@
// <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>
diff --git a/libcxx/test/libcxx/thread/thread.mutex/thread_safety_lock_unlock.pass.cpp b/libcxx/test/libcxx/thread/thread.mutex/thread_safety_lock_unlock.pass.cpp
index cc355eef515e..1c53f21177e5 100644
--- a/libcxx/test/libcxx/thread/thread.mutex/thread_safety_lock_unlock.pass.cpp
+++ b/libcxx/test/libcxx/thread/thread.mutex/thread_safety_lock_unlock.pass.cpp
@@ -15,8 +15,7 @@
// <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>
diff --git a/libcxx/test/libcxx/thread/thread.mutex/thread_safety_missing_unlock.fail.cpp b/libcxx/test/libcxx/thread/thread.mutex/thread_safety_missing_unlock.fail.cpp
index 7dd3f5da2990..f494ac87168c 100644
--- a/libcxx/test/libcxx/thread/thread.mutex/thread_safety_missing_unlock.fail.cpp
+++ b/libcxx/test/libcxx/thread/thread.mutex/thread_safety_missing_unlock.fail.cpp
@@ -15,8 +15,7 @@
// <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>
diff --git a/libcxx/test/libcxx/thread/thread.mutex/thread_safety_requires_capability.pass.cpp b/libcxx/test/libcxx/thread/thread.mutex/thread_safety_requires_capability.pass.cpp
index 538fbcc142de..ed4b8665d1fa 100644
--- a/libcxx/test/libcxx/thread/thread.mutex/thread_safety_requires_capability.pass.cpp
+++ b/libcxx/test/libcxx/thread/thread.mutex/thread_safety_requires_capability.pass.cpp
@@ -15,8 +15,7 @@
// <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>
diff --git a/libcxx/test/libcxx/utilities/memory/util.dynamic.safety/get_pointer_safety_new_abi.pass.cpp b/libcxx/test/libcxx/utilities/memory/util.dynamic.safety/get_pointer_safety_new_abi.pass.cpp
index 7a4a4cbf4895..4aa68544fbc8 100644
--- a/libcxx/test/libcxx/utilities/memory/util.dynamic.safety/get_pointer_safety_new_abi.pass.cpp
+++ b/libcxx/test/libcxx/utilities/memory/util.dynamic.safety/get_pointer_safety_new_abi.pass.cpp
@@ -13,8 +13,8 @@
// 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>
diff --git a/libcxx/test/libcxx/utilities/tuple/tuple.tuple/tuple.cnstr/enable_reduced_arity_initialization_extension.pass.cpp b/libcxx/test/libcxx/utilities/tuple/tuple.tuple/tuple.cnstr/enable_reduced_arity_initialization_extension.pass.cpp
index 9624eb8ff3d7..4e7341ffd48d 100644
--- a/libcxx/test/libcxx/utilities/tuple/tuple.tuple/tuple.cnstr/enable_reduced_arity_initialization_extension.pass.cpp
+++ b/libcxx/test/libcxx/utilities/tuple/tuple.tuple/tuple.cnstr/enable_reduced_arity_initialization_extension.pass.cpp
@@ -15,8 +15,8 @@
// 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>
diff --git a/libcxx/test/std/containers/sequences/deque/types.pass.cpp b/libcxx/test/std/containers/sequences/deque/types.pass.cpp
index 7e777e0c237f..bfe4808f863d 100644
--- a/libcxx/test/std/containers/sequences/deque/types.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/types.pass.cpp
@@ -28,10 +28,8 @@
// 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>
diff --git a/libcxx/test/std/containers/sequences/list/types.pass.cpp b/libcxx/test/std/containers/sequences/list/types.pass.cpp
index 644e5526dfa7..0c1ca27745ce 100644
--- a/libcxx/test/std/containers/sequences/list/types.pass.cpp
+++ b/libcxx/test/std/containers/sequences/list/types.pass.cpp
@@ -21,10 +21,8 @@
// 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>
diff --git a/libcxx/test/std/containers/sequences/vector/types.pass.cpp b/libcxx/test/std/containers/sequences/vector/types.pass.cpp
index 6cd79933dddc..4bcfbe7c3ea4 100644
--- a/libcxx/test/std/containers/sequences/vector/types.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector/types.pass.cpp
@@ -28,10 +28,8 @@
// 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>
diff --git a/libcxx/test/std/depr/depr.lib.binders/depr.lib.bind.1st/bind1st.depr_in_cxx11.fail.cpp b/libcxx/test/std/depr/depr.lib.binders/depr.lib.bind.1st/bind1st.depr_in_cxx11.fail.cpp
index 9efea4be0404..0a58370b70ef 100644
--- a/libcxx/test/std/depr/depr.lib.binders/depr.lib.bind.1st/bind1st.depr_in_cxx11.fail.cpp
+++ b/libcxx/test/std/depr/depr.lib.binders/depr.lib.bind.1st/bind1st.depr_in_cxx11.fail.cpp
@@ -13,9 +13,7 @@
// 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>
diff --git a/libcxx/test/std/depr/depr.lib.binders/depr.lib.bind.2nd/bind2nd.depr_in_cxx11.fail.cpp b/libcxx/test/std/depr/depr.lib.binders/depr.lib.bind.2nd/bind2nd.depr_in_cxx11.fail.cpp
index a1c8081436bd..b399dda30bda 100644
--- a/libcxx/test/std/depr/depr.lib.binders/depr.lib.bind.2nd/bind2nd.depr_in_cxx11.fail.cpp
+++ b/libcxx/test/std/depr/depr.lib.binders/depr.lib.bind.2nd/bind2nd.depr_in_cxx11.fail.cpp
@@ -13,9 +13,7 @@
// 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>
diff --git a/libcxx/test/std/depr/depr.lib.binders/depr.lib.binder.1st/binder1st.depr_in_cxx11.fail.cpp b/libcxx/test/std/depr/depr.lib.binders/depr.lib.binder.1st/binder1st.depr_in_cxx11.fail.cpp
index 6a5bc321a009..e19ac6890361 100644
--- a/libcxx/test/std/depr/depr.lib.binders/depr.lib.binder.1st/binder1st.depr_in_cxx11.fail.cpp
+++ b/libcxx/test/std/depr/depr.lib.binders/depr.lib.binder.1st/binder1st.depr_in_cxx11.fail.cpp
@@ -13,9 +13,7 @@
// 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>
diff --git a/libcxx/test/std/depr/depr.lib.binders/depr.lib.binder.2nd/binder2nd.depr_in_cxx11.fail.cpp b/libcxx/test/std/depr/depr.lib.binders/depr.lib.binder.2nd/binder2nd.depr_in_cxx11.fail.cpp
index 6ec5b6efd910..cc4a128ab7e9 100644
--- a/libcxx/test/std/depr/depr.lib.binders/depr.lib.binder.2nd/binder2nd.depr_in_cxx11.fail.cpp
+++ b/libcxx/test/std/depr/depr.lib.binders/depr.lib.binder.2nd/binder2nd.depr_in_cxx11.fail.cpp
@@ -13,9 +13,7 @@
// 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>
diff --git a/libcxx/test/std/utilities/function.objects/negators/binary_negate.pass.cpp b/libcxx/test/std/utilities/function.objects/negators/binary_negate.pass.cpp
index ba79cad80446..8e310e4887ab 100644
--- a/libcxx/test/std/utilities/function.objects/negators/binary_negate.pass.cpp
+++ b/libcxx/test/std/utilities/function.objects/negators/binary_negate.pass.cpp
@@ -10,8 +10,7 @@
// 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>
diff --git a/libcxx/test/std/utilities/function.objects/negators/not1.pass.cpp b/libcxx/test/std/utilities/function.objects/negators/not1.pass.cpp
index daccbcce3362..f74fb1c4b56d 100644
--- a/libcxx/test/std/utilities/function.objects/negators/not1.pass.cpp
+++ b/libcxx/test/std/utilities/function.objects/negators/not1.pass.cpp
@@ -10,8 +10,7 @@
// not1
-// MODULES_DEFINES: _LIBCPP_DISABLE_DEPRECATION_WARNINGS
-#define _LIBCPP_DISABLE_DEPRECATION_WARNINGS
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
#include <functional>
#include <cassert>
diff --git a/libcxx/test/std/utilities/function.objects/negators/not2.pass.cpp b/libcxx/test/std/utilities/function.objects/negators/not2.pass.cpp
index 8fb4959a776d..2235b99e10b9 100644
--- a/libcxx/test/std/utilities/function.objects/negators/not2.pass.cpp
+++ b/libcxx/test/std/utilities/function.objects/negators/not2.pass.cpp
@@ -10,8 +10,7 @@
// not2
-// MODULES_DEFINES: _LIBCPP_DISABLE_DEPRECATION_WARNINGS
-#define _LIBCPP_DISABLE_DEPRECATION_WARNINGS
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
#include <functional>
#include <cassert>
diff --git a/libcxx/test/std/utilities/function.objects/negators/unary_negate.pass.cpp b/libcxx/test/std/utilities/function.objects/negators/unary_negate.pass.cpp
index 91f09a839c18..de3c42901495 100644
--- a/libcxx/test/std/utilities/function.objects/negators/unary_negate.pass.cpp
+++ b/libcxx/test/std/utilities/function.objects/negators/unary_negate.pass.cpp
@@ -10,8 +10,7 @@
// 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>
diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp
index b51972432d03..77c021f41e40 100644
--- a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp
+++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp
@@ -13,8 +13,8 @@
// 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"
diff --git a/libcxx/utils/libcxx/test/config.py b/libcxx/utils/libcxx/test/config.py
index 80aa4f2f3df5..e3a48206d2eb 100644
--- a/libcxx/utils/libcxx/test/config.py
+++ b/libcxx/utils/libcxx/test/config.py
@@ -1036,7 +1036,8 @@ def configure_substitutions(self):
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)))
diff --git a/libcxx/utils/libcxx/test/format.py b/libcxx/utils/libcxx/test/format.py
index a4b6d669848e..0316835dd275 100644
--- a/libcxx/utils/libcxx/test/format.py
+++ b/libcxx/utils/libcxx/test/format.py
@@ -46,8 +46,6 @@ def __init__(self, cxx, use_verify_for_fail, execute_external,
@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,
@@ -144,11 +142,7 @@ def _execute(self, test, lit_config):
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
diff --git a/libcxx/utils/libcxx/test/newformat.py b/libcxx/utils/libcxx/test/newformat.py
index 80760478f8fb..f1518df6e5d0 100644
--- a/libcxx/utils/libcxx/test/newformat.py
+++ b/libcxx/utils/libcxx/test/newformat.py
@@ -81,8 +81,6 @@ class CxxStandardLibraryTest(lit.formats.TestFormat):
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):
@@ -128,10 +126,24 @@ def _useVerify(self, test, litConfig):
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)
More information about the libcxx-commits
mailing list