[libcxx-commits] [libcxx] e87c46b - [libc++] Remove the need for the %{build_module} substitution

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Wed Apr 15 10:01:40 PDT 2020


Author: Louis Dionne
Date: 2020-04-15T13:01:26-04:00
New Revision: e87c46b162632df0f962f05998d2e26bb78dac5d

URL: https://github.com/llvm/llvm-project/commit/e87c46b162632df0f962f05998d2e26bb78dac5d
DIFF: https://github.com/llvm/llvm-project/commit/e87c46b162632df0f962f05998d2e26bb78dac5d.diff

LOG: [libc++] Remove the need for the %{build_module} substitution

Instead of using .sh.cpp tests for the modules tests, use .compile.pass.cpp
and add the -fmodules additional flag.

Added: 
    libcxx/test/libcxx/modules/cinttypes_exports.compile.pass.cpp
    libcxx/test/libcxx/modules/clocale_exports.compile.pass.cpp
    libcxx/test/libcxx/modules/cstdint_exports.compile.pass.cpp
    libcxx/test/libcxx/modules/inttypes_h_exports.compile.pass.cpp
    libcxx/test/libcxx/modules/stdint_h_exports.compile.pass.cpp

Modified: 
    libcxx/utils/libcxx/test/config.py

Removed: 
    libcxx/test/libcxx/modules/cinttypes_exports.sh.cpp
    libcxx/test/libcxx/modules/clocale_exports.sh.cpp
    libcxx/test/libcxx/modules/cstdint_exports.sh.cpp
    libcxx/test/libcxx/modules/inttypes_h_exports.sh.cpp
    libcxx/test/libcxx/modules/stdint_h_exports.sh.cpp


################################################################################
diff  --git a/libcxx/test/libcxx/modules/cinttypes_exports.sh.cpp b/libcxx/test/libcxx/modules/cinttypes_exports.compile.pass.cpp
similarity index 90%
rename from libcxx/test/libcxx/modules/cinttypes_exports.sh.cpp
rename to libcxx/test/libcxx/modules/cinttypes_exports.compile.pass.cpp
index 135fb834030f..57a5ba5c55cb 100644
--- a/libcxx/test/libcxx/modules/cinttypes_exports.sh.cpp
+++ b/libcxx/test/libcxx/modules/cinttypes_exports.compile.pass.cpp
@@ -15,16 +15,15 @@
 // 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;
 }

diff  --git a/libcxx/test/libcxx/modules/clocale_exports.sh.cpp b/libcxx/test/libcxx/modules/clocale_exports.compile.pass.cpp
similarity index 81%
rename from libcxx/test/libcxx/modules/clocale_exports.sh.cpp
rename to libcxx/test/libcxx/modules/clocale_exports.compile.pass.cpp
index 29086de4f614..3b87b7b5c2a0 100644
--- a/libcxx/test/libcxx/modules/clocale_exports.sh.cpp
+++ b/libcxx/test/libcxx/modules/clocale_exports.compile.pass.cpp
@@ -14,20 +14,17 @@
 // 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;
 }

diff  --git a/libcxx/test/libcxx/modules/cstdint_exports.sh.cpp b/libcxx/test/libcxx/modules/cstdint_exports.compile.pass.cpp
similarity index 90%
rename from libcxx/test/libcxx/modules/cstdint_exports.sh.cpp
rename to libcxx/test/libcxx/modules/cstdint_exports.compile.pass.cpp
index 3ac9999bef2a..0887b597b5bf 100644
--- a/libcxx/test/libcxx/modules/cstdint_exports.sh.cpp
+++ b/libcxx/test/libcxx/modules/cstdint_exports.compile.pass.cpp
@@ -14,17 +14,16 @@
 // 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;
 }

diff  --git a/libcxx/test/libcxx/modules/inttypes_h_exports.sh.cpp b/libcxx/test/libcxx/modules/inttypes_h_exports.compile.pass.cpp
similarity index 93%
rename from libcxx/test/libcxx/modules/inttypes_h_exports.sh.cpp
rename to libcxx/test/libcxx/modules/inttypes_h_exports.compile.pass.cpp
index 828635a7f1c1..0add4e1a00ca 100644
--- a/libcxx/test/libcxx/modules/inttypes_h_exports.sh.cpp
+++ b/libcxx/test/libcxx/modules/inttypes_h_exports.compile.pass.cpp
@@ -14,16 +14,15 @@
 // 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;
 }

diff  --git a/libcxx/test/libcxx/modules/stdint_h_exports.sh.cpp b/libcxx/test/libcxx/modules/stdint_h_exports.compile.pass.cpp
similarity index 82%
rename from libcxx/test/libcxx/modules/stdint_h_exports.sh.cpp
rename to libcxx/test/libcxx/modules/stdint_h_exports.compile.pass.cpp
index f38e5f470faa..b83e99bcc9c6 100644
--- a/libcxx/test/libcxx/modules/stdint_h_exports.sh.cpp
+++ b/libcxx/test/libcxx/modules/stdint_h_exports.compile.pass.cpp
@@ -10,16 +10,15 @@
 // 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;
 }

diff  --git a/libcxx/utils/libcxx/test/config.py b/libcxx/utils/libcxx/test/config.py
index 78989cc3d7a3..3c18a36654f5 100644
--- a/libcxx/utils/libcxx/test/config.py
+++ b/libcxx/utils/libcxx/test/config.py
@@ -1009,10 +1009,6 @@ def configure_substitutions(self):
         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.


        


More information about the libcxx-commits mailing list