[libcxx-commits] [libcxx] 1a7c6b2 - [libc++] Move some .sh.cpp tests to .compile.pass.cpp

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Wed Apr 15 09:33:51 PDT 2020


Author: Louis Dionne
Date: 2020-04-15T12:27:49-04:00
New Revision: 1a7c6b23fcbbc09c02b655697cf5830634392bef

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

LOG: [libc++] Move some .sh.cpp tests to .compile.pass.cpp

As a fly-by fix, improve/fix the comments explaining the tests. This is
a step towards removing references to the %{compile} substitution.

Added: 
    libcxx/test/libcxx/depr/depr.c.headers/math_h.compile.pass.cpp
    libcxx/test/libcxx/min_max_macros.compile.pass.cpp
    libcxx/test/libcxx/no_assert_include.compile.pass.cpp

Modified: 
    

Removed: 
    libcxx/test/libcxx/depr/depr.c.headers/math_h.sh.cpp
    libcxx/test/libcxx/min_max_macros.sh.cpp
    libcxx/test/libcxx/no_assert_include.sh.cpp


################################################################################
diff  --git a/libcxx/test/libcxx/depr/depr.c.headers/math_h.sh.cpp b/libcxx/test/libcxx/depr/depr.c.headers/math_h.compile.pass.cpp
similarity index 51%
rename from libcxx/test/libcxx/depr/depr.c.headers/math_h.sh.cpp
rename to libcxx/test/libcxx/depr/depr.c.headers/math_h.compile.pass.cpp
index a7ae41aaa2ba..b878b6342800 100644
--- a/libcxx/test/libcxx/depr/depr.c.headers/math_h.sh.cpp
+++ b/libcxx/test/libcxx/depr/depr.c.headers/math_h.compile.pass.cpp
@@ -6,17 +6,23 @@
 //
 //===----------------------------------------------------------------------===//
 
-// RUN: %{compile} -fsyntax-only
+// Code on Windows expects to be able to do:
+//
+//  #define _USE_MATH_DEFINES
+//  #include <math.h>
+//
+// and receive the definitions of mathematical constants, even if <math.h>
+// has previously been included. Make sure that works.
+//
 
 #ifdef _MSC_VER
+#   include <math.h>
+#   define _USE_MATH_DEFINES
+#   include <math.h>
 
-#include <math.h>
-
-#define _USE_MATH_DEFINES
-#include <math.h>
-
-#ifndef M_PI
-#error M_PI not defined
+#   ifndef M_PI
+#       error M_PI not defined
+#   endif
 #endif
 
-#endif
+int main() { }

diff  --git a/libcxx/test/libcxx/min_max_macros.sh.cpp b/libcxx/test/libcxx/min_max_macros.compile.pass.cpp
similarity index 97%
rename from libcxx/test/libcxx/min_max_macros.sh.cpp
rename to libcxx/test/libcxx/min_max_macros.compile.pass.cpp
index 4e09e8ee42d1..03b79bed2829 100644
--- a/libcxx/test/libcxx/min_max_macros.sh.cpp
+++ b/libcxx/test/libcxx/min_max_macros.compile.pass.cpp
@@ -7,9 +7,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-// Test that we can include each header in two TU's and link them together.
-
-// RUN: %{compile} -fsyntax-only
+// Test that headers are not tripped up by the surrounding code defining the
+// min() and max() macros.
 
 // Prevent <ext/hash_map> from generating deprecated warnings for this test.
 #if defined(__DEPRECATED)
@@ -283,3 +282,5 @@ TEST_MACROS();
 TEST_MACROS();
 #include <ext/hash_set>
 TEST_MACROS();
+
+int main() { }

diff  --git a/libcxx/test/libcxx/no_assert_include.sh.cpp b/libcxx/test/libcxx/no_assert_include.compile.pass.cpp
similarity index 99%
rename from libcxx/test/libcxx/no_assert_include.sh.cpp
rename to libcxx/test/libcxx/no_assert_include.compile.pass.cpp
index 2b5f5f04ebdd..79f3536a5b0d 100644
--- a/libcxx/test/libcxx/no_assert_include.sh.cpp
+++ b/libcxx/test/libcxx/no_assert_include.compile.pass.cpp
@@ -10,8 +10,6 @@
 // Ensure that none of the standard C++ headers implicitly include cassert or
 // assert.h (because assert() is implemented as a macro).
 
-// RUN: %{compile} -fsyntax-only
-
 // Prevent <ext/hash_map> from generating deprecated warnings for this test.
 #if defined(__DEPRECATED)
 #undef __DEPRECATED
@@ -169,3 +167,5 @@
 #ifdef assert
 #error "Do not include cassert or assert.h in standard header files"
 #endif
+
+int main() { }


        


More information about the libcxx-commits mailing list