1 // Note: %s must be preceded by --, otherwise it may be interpreted as a 2 // command-line option, e.g. on Mac where %s is commonly under /Users. 3 4 // RUN: %clang_cl /c -### -- %s 2>&1 | FileCheck -check-prefix=TRIGRAPHS-DEFAULT %s 5 // cc1 will disable trigraphs for -fms-compatibility as long as -ftrigraphs 6 // isn't explicitly passed. 7 // TRIGRAPHS-DEFAULT-NOT: "-ftrigraphs" 8 9 // RUN: %clang_cl /c -### /Zc:trigraphs -- %s 2>&1 | FileCheck -check-prefix=TRIGRAPHS-ON %s 10 // TRIGRAPHS-ON: "-ftrigraphs" 11 12 // RUN: %clang_cl /c -### /Zc:trigraphs- -- %s 2>&1 | FileCheck -check-prefix=TRIGRAPHS-OFF %s 13 // TRIGRAPHS-OFF: "-fno-trigraphs" 14 15 // RUN: %clang_cl /c -### /Zc:sizedDealloc -- %s 2>&1 | FileCheck -check-prefix=SIZED-DEALLOC-ON %s 16 // SIZED-DEALLOC-ON: "-fsized-deallocation" 17 18 // RUN: %clang_cl /c -### /Zc:sizedDealloc- -- %s 2>&1 | FileCheck -check-prefix=SIZED-DEALLOC-OFF %s 19 // SIZED-DEALLOC-OFF-NOT: "-fsized-deallocation" 20 21 // RUN: %clang_cl /c /std:c++17 -### /Zc:alignedNew -- %s 2>&1 | FileCheck -check-prefix=ALIGNED-NEW-ON %s 22 // ALIGNED-NEW-ON: "-faligned-allocation" 23 24 // RUN: %clang_cl /c /std:c++17 -### /Zc:alignedNew- -- %s 2>&1 | FileCheck -check-prefix=ALIGNED-NEW-OFF %s 25 // ALIGNED-NEW-OFF-NOT: "-faligned-allocation" 26 27 // RUN: %clang_cl /c -### /kernel -- %s 2>&1 | FileCheck -check-prefixes=KERNEL-NO-RTTI,KERNEL-NO-EXCEPTIONS %s 28 // KERNEL-NO-RTTI: "-fno-rtti" 29 // KERNEL-NO-EXCEPTIONS-NOT: "-fcxx-exceptions" "-fexceptions" 30 31 // RUN: not %clang_cl /c -### --target=i686-pc-windows-msvc /kernel /arch:SSE -- %s 2>&1 | FileCheck -check-prefixes=KERNEL-SSE %s 32 // RUN: not %clang_cl /c -### --target=i686-pc-windows-msvc /kernel /arch:SSE2 -- %s 2>&1 | FileCheck -check-prefixes=KERNEL-SSE2 %s 33 // RUN: not %clang_cl /c -### --target=i686-pc-windows-msvc /kernel /arch:AVX -- %s 2>&1 | FileCheck -check-prefixes=KERNEL-AVX %s 34 // RUN: not %clang_cl /c -### --target=i686-pc-windows-msvc /kernel /arch:AVX2 -- %s 2>&1 | FileCheck -check-prefixes=KERNEL-AVX2 %s 35 // RUN: not %clang_cl /c -### --target=i686-pc-windows-msvc /kernel /arch:AVX512 -- %s 2>&1 | FileCheck -check-prefixes=KERNEL-AVX512 %s 36 // KERNEL-SSE: error: invalid argument '/arch:SSE' not allowed with '/kernel' 37 // KERNEL-SSE2: error: invalid argument '/arch:SSE2' not allowed with '/kernel' 38 // KERNEL-AVX: error: invalid argument '/arch:AVX' not allowed with '/kernel' 39 // KERNEL-AVX2: error: invalid argument '/arch:AVX2' not allowed with '/kernel' 40 // KERNEL-AVX512: error: invalid argument '/arch:AVX512' not allowed with '/kernel' 41 42 // RUN: %clang_cl /c -### /kernel /EHsc -- %s 2>&1 | FileCheck -check-prefixes=KERNEL-EHSC %s 43 // RUN: not %clang_cl /c -### /kernel /GR -- %s 2>&1 | FileCheck -check-prefixes=KERNEL-GR %s 44 // KERNEL-EHSC-NOT: "-fcxx-exceptions" "-fexceptions" 45 // KERNEL-GR: error: invalid argument '/GR' not allowed with '/kernel' 46 47 // RUN: not %clang_cl /c -### --target=x86_64-pc-windows-msvc /kernel /arch:AVX -- %s 2>&1 | FileCheck -check-prefixes=KERNEL-X64-AVX %s 48 // RUN: not %clang_cl /c -### --target=x86_64-pc-windows-msvc /kernel /arch:AVX2 -- %s 2>&1 | FileCheck -check-prefixes=KERNEL-X64-AVX2 %s 49 // RUN: not %clang_cl /c -### --target=x86_64-pc-windows-msvc /kernel /arch:AVX512 -- %s 2>&1 | FileCheck -check-prefixes=KERNEL-X64-AVX512 %s 50 // KERNEL-X64-AVX: error: invalid argument '/arch:AVX' not allowed with '/kernel' 51 // KERNEL-X64-AVX2: error: invalid argument '/arch:AVX2' not allowed with '/kernel' 52 // KERNEL-X64-AVX512: error: invalid argument '/arch:AVX512' not allowed with '/kernel' 53 54 // RUN: %clang_cl /c -### -- %s 2>&1 | FileCheck -check-prefix=STRICTSTRINGS-DEFAULT %s 55 // STRICTSTRINGS-DEFAULT-NOT: -Werror=c++11-compat-deprecated-writable-strings 56 // RUN: %clang_cl /c -### /Zc:strictStrings -- %s 2>&1 | FileCheck -check-prefix=STRICTSTRINGS-ON %s 57 // STRICTSTRINGS-ON: -Werror=c++11-compat-deprecated-writable-strings 58 // RUN: %clang_cl /c -### /Zc:strictStrings- -- %s 2>&1 | FileCheck -check-prefix=STRICTSTRINGS-OFF %s 59 // STRICTSTRINGS-OFF: argument unused during compilation 60 61 62 // RUN: %clang_cl /c -### /Zc:foobar -- %s 2>&1 | FileCheck -check-prefix=FOOBAR-ON %s 63 // FOOBAR-ON: argument unused during compilation 64 // RUN: %clang_cl /c -### /Zc:foobar- -- %s 2>&1 | FileCheck -check-prefix=FOOBAR-ON %s 65 // FOOBAR-OFF: argument unused during compilation 66 67 // These are ignored if enabled, and warn if disabled. 68 69 // RUN: %clang_cl /c -### /Zc:forScope -- %s 2>&1 | FileCheck -check-prefix=FORSCOPE-ON %s 70 // FORSCOPE-ON-NOT: argument unused during compilation 71 // RUN: %clang_cl /c -### /Zc:forScope- -- %s 2>&1 | FileCheck -check-prefix=FORSCOPE-OFF %s 72 // FORSCOPE-OFF: argument unused during compilation 73 74 // RUN: %clang_cl /c -### /Zc:wchar_t -- %s 2>&1 | FileCheck -check-prefix=WCHAR_T-ON %s 75 // WCHAR_T-ON-NOT: argument unused during compilation 76 // RUN: %clang_cl /c -### /Zc:wchar_t- -- %s 2>&1 | FileCheck -check-prefix=WCHAR_T-OFF %s 77 // WCHAR_T-OFF: "-fno-wchar" 78 79 // RUN: %clang_cl /c -### /Zc:auto -- %s 2>&1 | FileCheck -check-prefix=AUTO-ON %s 80 // AUTO-ON-NOT: argument unused during compilation 81 // RUN: %clang_cl /c -### /Zc:auto- -- %s 2>&1 | FileCheck -check-prefix=AUTO-OFF %s 82 // AUTO-OFF: argument unused during compilation 83 84 // RUN: %clang_cl /c -### /Zc:inline -- %s 2>&1 | FileCheck -check-prefix=INLINE-ON %s 85 // INLINE-ON-NOT: argument unused during compilation 86 // RUN: %clang_cl /c -### /Zc:inline- -- %s 2>&1 | FileCheck -check-prefix=INLINE-OFF %s 87 // INLINE-OFF: argument unused during compilation 88 89 // RUN: %clang_cl /c -### /Zc:ternary -- %s 2>&1 | FileCheck -check-prefix=TERNARY-ON %s 90 // TERNARY-ON-NOT: argument unused during compilation 91 // RUN: %clang_cl /c -### /Zc:ternary- -- %s 2>&1 | FileCheck -check-prefix=TERNARY-OFF %s 92 // TERNARY-OFF: argument unused during compilation 93 94 // thread safe statics are off for versions < 19. 95 // RUN: %clang_cl /c -### -fms-compatibility-version=18 -- %s 2>&1 | FileCheck -check-prefix=NoThreadSafeStatics %s 96 // RUN: %clang_cl /Zc:threadSafeInit /Zc:threadSafeInit- /c -### -- %s 2>&1 | FileCheck -check-prefix=NoThreadSafeStatics %s 97 // NoThreadSafeStatics: "-fno-threadsafe-statics" 98 99 // RUN: %clang_cl /Zc:threadSafeInit /c -### -- %s 2>&1 | FileCheck -check-prefix=ThreadSafeStatics %s 100 // ThreadSafeStatics-NOT: "-fno-threadsafe-statics" 101 102 // RUN: %clang_cl /Zc:tlsGuards- /c -### -- %s 2>&1 | FileCheck -check-prefix=NoTlsGuards %s 103 // NoTlsGuards: "-fno-ms-tls-guards" 104 105 // RUN: %clang_cl /Zc:dllexportInlines- /c -### -- %s 2>&1 | FileCheck -check-prefix=NoDllExportInlines %s 106 // NoDllExportInlines: "-fno-dllexport-inlines" 107 // RUN: %clang_cl /Zc:dllexportInlines /c -### -- %s 2>&1 | FileCheck -check-prefix=DllExportInlines %s 108 // DllExportInlines-NOT: "-fno-dllexport-inlines" 109 110 // We recognize -f[no-]delayed-template-parsing. 111 // /Zc:twoPhase[-] has the opposite meaning. 112 // RUN: %clang_cl -c -### -- %s 2>&1 | FileCheck -check-prefix=DELAYEDDEFAULT %s 113 // DELAYEDDEFAULT: "-fdelayed-template-parsing" 114 // RUN: %clang_cl -c -fdelayed-template-parsing -### -- %s 2>&1 | FileCheck -check-prefix=DELAYEDON %s 115 // RUN: %clang_cl -c /Zc:twoPhase- -### -- %s 2>&1 | FileCheck -check-prefix=DELAYEDON %s 116 // DELAYEDON: "-fdelayed-template-parsing" 117 // RUN: %clang_cl -c -fno-delayed-template-parsing -### -- %s 2>&1 | FileCheck -check-prefix=DELAYEDOFF %s 118 // RUN: %clang_cl -c /Zc:twoPhase -### -- %s 2>&1 | FileCheck -check-prefix=DELAYEDOFF %s 119 // DELAYEDOFF-NOT: "-fdelayed-template-parsing" 120 121 // RUN: %clang_cl -c -### /std:c++latest -- %s 2>&1 | FileCheck -check-prefix CHECK-LATEST-CHAR8_T %s 122 // CHECK-LATEST-CHAR8_T-NOT: "-fchar8_t" 123 // RUN: %clang_cl -c -### /Zc:char8_t -- %s 2>&1 | FileCheck -check-prefix CHECK-CHAR8_T %s 124 // CHECK-CHAR8_T: "-fchar8_t" 125 // RUN: %clang_cl -c -### /Zc:char8_t- -- %s 2>&1 | FileCheck -check-prefix CHECK-CHAR8_T_ %s 126 // CHECK-CHAR8_T_: "-fno-char8_t" 127 128 129 130 // These never warn, but don't have an effect yet. 131 132 // RUN: %clang_cl /c \ 133 // RUN: /Zc:__cplusplus \ 134 // RUN: /Zc:auto \ 135 // RUN: /Zc:forScope \ 136 // RUN: /Zc:inline \ 137 // RUN: /Zc:rvalueCast \ 138 // RUN: /Zc:ternary \ 139 // RUN: -### -- %s 2>&1 | FileCheck -DMSG=%errc_ENOENT -check-prefix=IGNORED %s 140 // IGNORED-NOT: argument unused during compilation 141 // IGNORED-NOT: [[MSG]] 142 143 // Negated form warns: 144 // RUN: %clang_cl /c \ 145 // RUN: /Zc:rvalueCast- \ 146 // RUN: -### -- %s 2>&1 | FileCheck -check-prefix=NOTIGNORED %s 147 // NOTIGNORED: argument unused during compilation 148