[PATCH] D149997: [clang] [test] Narrow down MSVC specific behaviours from "any windows" to only MSVC/clang-cl

Martin Storsjö via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri May 5 14:43:35 PDT 2023


mstorsjo created this revision.
mstorsjo added reviewers: aaron.ballman, hans.
Herald added a project: All.
mstorsjo requested review of this revision.
Herald added a project: clang.

This fixes running tests with a toolchain that defaults to a MinGW
target.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D149997

Files:
  clang/test/C/drs/dr1xx.c
  clang/test/Driver/experimental-library-flag.cpp
  clang/test/SemaCXX/attr-trivial-abi.cpp


Index: clang/test/SemaCXX/attr-trivial-abi.cpp
===================================================================
--- clang/test/SemaCXX/attr-trivial-abi.cpp
+++ clang/test/SemaCXX/attr-trivial-abi.cpp
@@ -5,11 +5,11 @@
 // Should not crash.
 template <class>
 class __attribute__((trivial_abi)) a { a(a &&); };
-#ifdef _WIN64
-// On Windows, to be trivial-for-calls, an object must be trivially copyable.
+#if defined(_WIN64) && defined(_MSC_VER)
+// On Windows/MSVC, to be trivial-for-calls, an object must be trivially copyable.
 // (And it is only trivially relocatable, currently, if it is trivial for calls.)
 // In this case, it is suppressed by an explicitly defined move constructor.
-// Similar concerns apply to later tests that have #ifdef _WIN64.
+// Similar concerns apply to later tests that have #if defined(_WIN64) && defined(_MSC_VER).
 static_assert(!__is_trivially_relocatable(a<int>), "");
 #else
 static_assert(__is_trivially_relocatable(a<int>), "");
@@ -137,7 +137,7 @@
   CopyDeleted(const CopyDeleted &) = delete;
   CopyDeleted(CopyDeleted &&) = default;
 };
-#ifdef _WIN64
+#if defined(_WIN64) && defined(_MSC_VER)
 static_assert(!__is_trivially_relocatable(CopyDeleted), "");
 #else
 static_assert(__is_trivially_relocatable(CopyDeleted), "");
@@ -163,7 +163,7 @@
 struct __attribute__((trivial_abi)) S20 {
   int &&a; // a member of rvalue reference type deletes the copy constructor.
 };
-#ifdef _WIN64
+#if defined(_WIN64) && defined(_MSC_VER)
 static_assert(!__is_trivially_relocatable(S20), "");
 #else
 static_assert(__is_trivially_relocatable(S20), "");
Index: clang/test/Driver/experimental-library-flag.cpp
===================================================================
--- clang/test/Driver/experimental-library-flag.cpp
+++ clang/test/Driver/experimental-library-flag.cpp
@@ -1,6 +1,6 @@
 // On some platforms, -stdlib=libc++ is currently ignored, so -lc++experimental is not added.
 // Once -stdlib=libc++ works on those, this XFAIL can be removed.
-// XFAIL: target={{.*-windows.*}}, target={{.*-(ps4|ps5)}}
+// XFAIL: target={{.*-windows-msvc.*}}, target={{.*-(ps4|ps5)}}
 
 // For some reason, this fails with a core dump on AIX. This needs to be investigated.
 // UNSUPPORTED: target={{.*}}-aix{{.*}}
Index: clang/test/C/drs/dr1xx.c
===================================================================
--- clang/test/C/drs/dr1xx.c
+++ clang/test/C/drs/dr1xx.c
@@ -235,7 +235,7 @@
 	 * type at this point.
 	 */
     Val = sizeof(enum E)
-    #ifndef _WIN32
+    #ifndef _MSC_VER
     /* expected-error at -2 {{invalid application of 'sizeof' to an incomplete type 'enum E'}} */
     /* expected-note at -12 {{definition of 'enum E' is not complete until the closing '}'}} */
     #endif


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D149997.519978.patch
Type: text/x-patch
Size: 2731 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230505/3c235b66/attachment-0001.bin>


More information about the cfe-commits mailing list