From d39928e2cc393a21c8367ef318019166124f4b56 Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Wed, 18 May 2022 09:45:06 -0400 Subject: [PATCH] clang-cl: Move /Zc: tests from cl-options.c to cl-zc.cpp Since we already have a dedicated file for testing the /Zc: flags, let's be consistent about putting /Zc: tests there. No behavior change. Differential Revision: https://reviews.llvm.org/D125889 --- clang/test/Driver/cl-options.c | 37 ------------------------------ clang/test/Driver/cl-zc.cpp | 52 ++++++++++++++++++++++++++++++++++++++---- 2 files changed, 48 insertions(+), 41 deletions(-) diff --git a/clang/test/Driver/cl-options.c b/clang/test/Driver/cl-options.c index 4eae94b..1e518e0 100644 --- a/clang/test/Driver/cl-options.c +++ b/clang/test/Driver/cl-options.c @@ -336,24 +336,6 @@ // RUN: %clang_cl -c -fno-delete-null-pointer-checks -### -- %s 2>&1 | FileCheck -check-prefix=NONULL %s // NONULL: "-fno-delete-null-pointer-checks" -// We recognize -f[no-]delayed-template-parsing. -// /Zc:twoPhase[-] has the opposite meaning. -// RUN: %clang_cl -c -### -- %s 2>&1 | FileCheck -check-prefix=DELAYEDDEFAULT %s -// DELAYEDDEFAULT: "-fdelayed-template-parsing" -// RUN: %clang_cl -c -fdelayed-template-parsing -### -- %s 2>&1 | FileCheck -check-prefix=DELAYEDON %s -// RUN: %clang_cl -c /Zc:twoPhase- -### -- %s 2>&1 | FileCheck -check-prefix=DELAYEDON %s -// DELAYEDON: "-fdelayed-template-parsing" -// RUN: %clang_cl -c -fno-delayed-template-parsing -### -- %s 2>&1 | FileCheck -check-prefix=DELAYEDOFF %s -// RUN: %clang_cl -c /Zc:twoPhase -### -- %s 2>&1 | FileCheck -check-prefix=DELAYEDOFF %s -// DELAYEDOFF-NOT: "-fdelayed-template-parsing" - -// RUN: %clang_cl -c -### /std:c++latest -- %s 2>&1 | FileCheck -check-prefix CHECK-LATEST-CHAR8_T %s -// CHECK-LATEST-CHAR8_T-NOT: "-fchar8_t" -// RUN: %clang_cl -c -### /Zc:char8_t -- %s 2>&1 | FileCheck -check-prefix CHECK-CHAR8_T %s -// CHECK-CHAR8_T: "-fchar8_t" -// RUN: %clang_cl -c -### /Zc:char8_t- -- %s 2>&1 | FileCheck -check-prefix CHECK-CHAR8_T_ %s -// CHECK-CHAR8_T_: "-fno-char8_t" - // RUN: %clang_cl -c -### /std:c11 -- %s 2>&1 | FileCheck -check-prefix CHECK-C11 %s // CHECK-C11: -std=c11 @@ -398,12 +380,6 @@ // RUN: /wd1234 \ // RUN: /Wv \ // RUN: /Wv:17 \ -// RUN: /Zc:__cplusplus \ -// RUN: /Zc:auto \ -// RUN: /Zc:forScope \ -// RUN: /Zc:inline \ -// RUN: /Zc:rvalueCast \ -// RUN: /Zc:ternary \ // RUN: /ZH:MD5 \ // RUN: /ZH:SHA1 \ // RUN: /ZH:SHA_256 \ @@ -553,19 +529,6 @@ // RTTI-NOT: "-fno-rtti-data" // RTTI-NOT: "-fno-rtti" -// thread safe statics are off for versions < 19. -// RUN: %clang_cl /c -### -fms-compatibility-version=18 -- %s 2>&1 | FileCheck -check-prefix=NoThreadSafeStatics %s -// RUN: %clang_cl /Zc:threadSafeInit /Zc:threadSafeInit- /c -### -- %s 2>&1 | FileCheck -check-prefix=NoThreadSafeStatics %s -// NoThreadSafeStatics: "-fno-threadsafe-statics" - -// RUN: %clang_cl /Zc:threadSafeInit /c -### -- %s 2>&1 | FileCheck -check-prefix=ThreadSafeStatics %s -// ThreadSafeStatics-NOT: "-fno-threadsafe-statics" - -// RUN: %clang_cl /Zc:dllexportInlines- /c -### -- %s 2>&1 | FileCheck -check-prefix=NoDllExportInlines %s -// NoDllExportInlines: "-fno-dllexport-inlines" -// RUN: %clang_cl /Zc:dllexportInlines /c -### -- %s 2>&1 | FileCheck -check-prefix=DllExportInlines %s -// DllExportInlines-NOT: "-fno-dllexport-inlines" - // RUN: %clang_cl /Zi /c -### -- %s 2>&1 | FileCheck -check-prefix=Zi %s // Zi: "-gcodeview" // Zi: "-debug-info-kind=constructor" diff --git a/clang/test/Driver/cl-zc.cpp b/clang/test/Driver/cl-zc.cpp index 53d28dd..077d22d 100644 --- a/clang/test/Driver/cl-zc.cpp +++ b/clang/test/Driver/cl-zc.cpp @@ -64,10 +64,54 @@ // RUN: %clang_cl /c -### /Zc:ternary- -- %s 2>&1 | FileCheck -check-prefix=TERNARY-OFF %s // TERNARY-OFF: argument unused during compilation +// thread safe statics are off for versions < 19. +// RUN: %clang_cl /c -### -fms-compatibility-version=18 -- %s 2>&1 | FileCheck -check-prefix=NoThreadSafeStatics %s +// RUN: %clang_cl /Zc:threadSafeInit /Zc:threadSafeInit- /c -### -- %s 2>&1 | FileCheck -check-prefix=NoThreadSafeStatics %s +// NoThreadSafeStatics: "-fno-threadsafe-statics" + +// RUN: %clang_cl /Zc:threadSafeInit /c -### -- %s 2>&1 | FileCheck -check-prefix=ThreadSafeStatics %s +// ThreadSafeStatics-NOT: "-fno-threadsafe-statics" + +// RUN: %clang_cl /Zc:dllexportInlines- /c -### -- %s 2>&1 | FileCheck -check-prefix=NoDllExportInlines %s +// NoDllExportInlines: "-fno-dllexport-inlines" +// RUN: %clang_cl /Zc:dllexportInlines /c -### -- %s 2>&1 | FileCheck -check-prefix=DllExportInlines %s +// DllExportInlines-NOT: "-fno-dllexport-inlines" + +// We recognize -f[no-]delayed-template-parsing. +// /Zc:twoPhase[-] has the opposite meaning. +// RUN: %clang_cl -c -### -- %s 2>&1 | FileCheck -check-prefix=DELAYEDDEFAULT %s +// DELAYEDDEFAULT: "-fdelayed-template-parsing" +// RUN: %clang_cl -c -fdelayed-template-parsing -### -- %s 2>&1 | FileCheck -check-prefix=DELAYEDON %s +// RUN: %clang_cl -c /Zc:twoPhase- -### -- %s 2>&1 | FileCheck -check-prefix=DELAYEDON %s +// DELAYEDON: "-fdelayed-template-parsing" +// RUN: %clang_cl -c -fno-delayed-template-parsing -### -- %s 2>&1 | FileCheck -check-prefix=DELAYEDOFF %s +// RUN: %clang_cl -c /Zc:twoPhase -### -- %s 2>&1 | FileCheck -check-prefix=DELAYEDOFF %s +// DELAYEDOFF-NOT: "-fdelayed-template-parsing" + +// RUN: %clang_cl -c -### /std:c++latest -- %s 2>&1 | FileCheck -check-prefix CHECK-LATEST-CHAR8_T %s +// CHECK-LATEST-CHAR8_T-NOT: "-fchar8_t" +// RUN: %clang_cl -c -### /Zc:char8_t -- %s 2>&1 | FileCheck -check-prefix CHECK-CHAR8_T %s +// CHECK-CHAR8_T: "-fchar8_t" +// RUN: %clang_cl -c -### /Zc:char8_t- -- %s 2>&1 | FileCheck -check-prefix CHECK-CHAR8_T_ %s +// CHECK-CHAR8_T_: "-fno-char8_t" + + // These never warn, but don't have an effect yet. -// RUN: %clang_cl /c -### /Zc:rvalueCast -- %s 2>&1 | FileCheck -check-prefix=RVALUECAST-ON %s -// RVALUECAST-ON-NOT: argument unused during compilation -// RUN: %clang_cl /c -### /Zc:rvalueCast- -- %s 2>&1 | FileCheck -check-prefix=RVALUECAST-OFF %s -// RVALUECAST-OFF: argument unused during compilation +// RUN: %clang_cl /c \ +// RUN: /Zc:__cplusplus \ +// RUN: /Zc:auto \ +// RUN: /Zc:forScope \ +// RUN: /Zc:inline \ +// RUN: /Zc:rvalueCast \ +// RUN: /Zc:ternary \ +// RUN: -### -- %s 2>&1 | FileCheck -check-prefix=IGNORED %s +// IGNORED-NOT: argument unused during compilation +// IGNORED-NOT: no such file or directory + +// Negated form warns: +// RUN: %clang_cl /c \ +// RUN: /Zc:rvalueCast- \ +// RUN: -### -- %s 2>&1 | FileCheck -check-prefix=NOTIGNORED %s +// NOTIGNORED: argument unused during compilation -- 2.7.4