[libc++] Remove the need for the %{build_module} substitution
authorLouis Dionne <ldionne@apple.com>
Wed, 15 Apr 2020 16:58:00 +0000 (12:58 -0400)
committerLouis Dionne <ldionne@apple.com>
Wed, 15 Apr 2020 17:01:26 +0000 (13:01 -0400)
Instead of using .sh.cpp tests for the modules tests, use .compile.pass.cpp
and add the -fmodules additional flag.

libcxx/test/libcxx/modules/cinttypes_exports.compile.pass.cpp [moved from libcxx/test/libcxx/modules/cinttypes_exports.sh.cpp with 90% similarity]
libcxx/test/libcxx/modules/clocale_exports.compile.pass.cpp [moved from libcxx/test/libcxx/modules/clocale_exports.sh.cpp with 81% similarity]
libcxx/test/libcxx/modules/cstdint_exports.compile.pass.cpp [moved from libcxx/test/libcxx/modules/cstdint_exports.sh.cpp with 90% similarity]
libcxx/test/libcxx/modules/inttypes_h_exports.compile.pass.cpp [moved from libcxx/test/libcxx/modules/inttypes_h_exports.sh.cpp with 93% similarity]
libcxx/test/libcxx/modules/stdint_h_exports.compile.pass.cpp [moved from libcxx/test/libcxx/modules/stdint_h_exports.sh.cpp with 82% similarity]
libcxx/utils/libcxx/test/config.py

 // XFAIL: libcpp-has-no-threads
 
 // REQUIRES: modules-support
+// ADDITIONAL_COMPILE_FLAGS: -fmodules
 
 // Test that <cinttypes> re-exports <cstdint>
 
-// RUN: %{build_module}
-
 #include <cinttypes>
 
 int main(int, char**) {
-  int8_t x; ((void)x);
-  std::int8_t y; ((void)y);
+  int8_t x; (void)x;
+  std::int8_t y; (void)y;
 
   return 0;
 }
 // but still gets built as part of the 'std' module, which breaks the build.
 // XFAIL: libcpp-has-no-threads
 
-// REQUIRES: modules-support
 // UNSUPPORTED: c++98, c++03
 
-// RUN: %{build_module}
+// REQUIRES: modules-support
+// ADDITIONAL_COMPILE_FLAGS: -fmodules
 
 #include <clocale>
 
-#define TEST(...) do { using T = decltype( __VA_ARGS__ ); } while(false)
-
 int main(int, char**) {
-  std::lconv l; ((void)l);
-
-  TEST(std::setlocale(0, ""));
-  TEST(std::localeconv());
+  std::lconv l; (void)l;
+  using T = decltype(std::setlocale(0, ""));
+  using U = decltype(std::localeconv());
 
   return 0;
 }
 // but still gets built as part of the 'std' module, which breaks the build.
 // XFAIL: libcpp-has-no-threads
 
-// REQUIRES: modules-support
-
 // Test that <cstdint> re-exports <stdint.h>
 
-// RUN: %{build_module}
+// REQUIRES: modules-support
+// ADDITIONAL_COMPILE_FLAGS: -fmodules
 
 #include <cstdint>
 
 int main(int, char**) {
-  int8_t x; ((void)x);
-  std::int8_t y; ((void)y);
+  int8_t x; (void)x;
+  std::int8_t y; (void)y;
 
   return 0;
 }
 // but still gets built as part of the 'std' module, which breaks the build.
 // XFAIL: libcpp-has-no-threads
 
-// REQUIRES: modules-support
-
 // Test that intypes.h re-exports stdint.h
 
-// RUN: %{build_module}
+// REQUIRES: modules-support
+// ADDITIONAL_COMPILE_FLAGS: -fmodules
 
 #include <inttypes.h>
 
 int main(int, char**) {
-  int8_t x; ((void)x);
+  int8_t x; (void)x;
 
   return 0;
 }
 // but still gets built as part of the 'std' module, which breaks the build.
 // XFAIL: libcpp-has-no-threads
 
-// REQUIRES: modules-support
-
-// Test that int8_t and the like are exported from stdint.h not inttypes.h
+// Test that int8_t and the like are exported from stdint.h, not inttypes.h
 
-// RUN: %{build_module}
+// REQUIRES: modules-support
+// ADDITIONAL_COMPILE_FLAGS: -fmodules
 
 #include <stdint.h>
 
 int main(int, char**) {
-  int8_t x; ((void)x);
+  int8_t x; (void)x;
 
   return 0;
 }
index 78989cc..3c18a36 100644 (file)
@@ -1009,10 +1009,6 @@ class Configuration(object):
         if self.cxx.isVerifySupported():
             sub.append(('%{verify}', ' '.join(self.cxx.verify_flags)))
         sub.append(('%{build}',   '%{cxx} -o %t.exe %s %{flags} %{compile_flags} %{link_flags}'))
-        if self.cxx.use_modules:
-            sub.append(('%{build_module}', '%{build}'))
-        elif self.cxx.modules_flags is not None:
-            sub.append(('%{build_module}', '%{{build}} {}'.format(' '.join(self.cxx.modules_flags))))
 
         # Configure exec prefix substitutions.
         # Configure run env substitution.