1 // Don't attempt slash switches on msys bash. 2 // REQUIRES: shell-preserves-root 3 4 // Note: %s must be preceded by --, otherwise it may be interpreted as a 5 // command-line option, e.g. on Mac where %s is commonly under /Users. 6 7 8 // Alias options: 9 10 // RUN: %clang_cl /c -### -- %s 2>&1 | FileCheck -check-prefix=C %s 11 // C: -c 12 13 // RUN: %clang_cl /Dfoo=bar -### -- %s 2>&1 | FileCheck -check-prefix=D %s 14 // RUN: %clang_cl /D foo=bar -### -- %s 2>&1 | FileCheck -check-prefix=D %s 15 // D: "-D" "foo=bar" 16 17 // RTTI is on by default; just check that we don't error. 18 // RUN: %clang_cl /Zs /GR -- %s 2>&1 19 20 // RUN: %clang_cl /GR- -### -- %s 2>&1 | FileCheck -check-prefix=GR_ %s 21 // GR_: -fno-rtti 22 23 // RUN: %clang_cl /Imyincludedir -### -- %s 2>&1 | FileCheck -check-prefix=SLASH_I %s 24 // RUN: %clang_cl /I myincludedir -### -- %s 2>&1 | FileCheck -check-prefix=SLASH_I %s 25 // SLASH_I: "-I" "myincludedir" 26 27 // RUN: %clang_cl /J -### -- %s 2>&1 | FileCheck -check-prefix=J %s 28 // J: -fno-signed-char 29 30 // RUN: %clang_cl /Ofoo -### -- %s 2>&1 | FileCheck -check-prefix=O %s 31 // O: -Ofoo 32 33 // RUN: %clang_cl /Ob0 -### -- %s 2>&1 | FileCheck -check-prefix=Ob0 %s 34 // Ob0: -fno-inline 35 36 // RUN: %clang_cl /Od -### -- %s 2>&1 | FileCheck -check-prefix=Od %s 37 // Od: -O0 38 39 // RUN: %clang_cl /Oi- /Oi -### -- %s 2>&1 | FileCheck -check-prefix=Oi %s 40 // Oi-NOT: -fno-builtin 41 42 // RUN: %clang_cl /Oi- -### -- %s 2>&1 | FileCheck -check-prefix=Oi_ %s 43 // Oi_: -fno-builtin 44 45 // RUN: %clang_cl /Os -### -- %s 2>&1 | FileCheck -check-prefix=Os %s 46 // Os: -Os 47 48 // RUN: %clang_cl /Ot -### -- %s 2>&1 | FileCheck -check-prefix=Ot %s 49 // Ot: -O2 50 51 // RUN: %clang_cl /Ox -### -- %s 2>&1 | FileCheck -check-prefix=Ox %s 52 // Ox: -O3 53 54 // RUN: %clang_cl /Zs /Oy -- %s 2>&1 55 56 // RUN: %clang_cl /Oy- -### -- %s 2>&1 | FileCheck -check-prefix=Oy_ %s 57 // Oy_: -mdisable-fp-elim 58 59 // RUN: %clang_cl /P -### -- %s 2>&1 | FileCheck -check-prefix=P %s 60 // P: -E 61 62 // RUN: %clang_cl /showIncludes -### -- %s 2>&1 | FileCheck -check-prefix=showIncludes %s 63 // showIncludes: --show-includes 64 65 // RUN: %clang_cl /Umymacro -### -- %s 2>&1 | FileCheck -check-prefix=U %s 66 // RUN: %clang_cl /U mymacro -### -- %s 2>&1 | FileCheck -check-prefix=U %s 67 // U: "-U" "mymacro" 68 69 // RUN: %clang_cl /W0 -### -- %s 2>&1 | FileCheck -check-prefix=W0 %s 70 // W0: -w 71 72 // RUN: %clang_cl /W1 -### -- %s 2>&1 | FileCheck -check-prefix=W1 %s 73 // RUN: %clang_cl /W2 -### -- %s 2>&1 | FileCheck -check-prefix=W1 %s 74 // RUN: %clang_cl /W3 -### -- %s 2>&1 | FileCheck -check-prefix=W1 %s 75 // RUN: %clang_cl /W4 -### -- %s 2>&1 | FileCheck -check-prefix=W1 %s 76 // RUN: %clang_cl /Wall -### -- %s 2>&1 | FileCheck -check-prefix=W1 %s 77 // W1: -Wall 78 79 // RUN: %clang_cl /WX -### -- %s 2>&1 | FileCheck -check-prefix=WX %s 80 // WX: -Werror 81 82 // RUN: %clang_cl /WX- -### -- %s 2>&1 | FileCheck -check-prefix=WX_ %s 83 // WX_: -Wno-error 84 85 // RUN: %clang_cl /w -### -- %s 2>&1 | FileCheck -check-prefix=w %s 86 // w: -w 87 88 // RUN: %clang_cl /Zs -### -- %s 2>&1 | FileCheck -check-prefix=Zs %s 89 // Zs: -fsyntax-only 90 91 // RUN: %clang_cl /FIasdf.h -### -- %s 2>&1 | FileCheck -check-prefix=FI %s 92 // FI: "-include" "asdf.h" 93 94 // RUN: %clang_cl /FI asdf.h -### -- %s 2>&1 | FileCheck -check-prefix=FI_ %s 95 // FI_: "-include" "asdf.h" 96 97 // We forward any unrecognized -W diagnostic options to cc1. 98 // RUN: %clang_cl -Wunused-pragmas -### -- %s 2>&1 | FileCheck -check-prefix=WJoined %s 99 // WJoined: "-cc1" 100 // WJoined: "-Wunused-pragmas" 101 102 103 // Ignored options. Check that we don't get "unused during compilation" errors. 104 // (/Zs is for syntax-only, /WX is for -Werror) 105 // RUN: %clang_cl /Zs /WX \ 106 // RUN: /analyze- \ 107 // RUN: /errorReport:foo \ 108 // RUN: /FS \ 109 // RUN: /GF \ 110 // RUN: /GS- \ 111 // RUN: /kernel- \ 112 // RUN: /nologo \ 113 // RUN: /Ob1 \ 114 // RUN: /Ob2 \ 115 // RUN: /RTC1 \ 116 // RUN: /sdl \ 117 // RUN: /sdl- \ 118 // RUN: /vmg \ 119 // RUN: /w12345 \ 120 // RUN: /wd1234 \ 121 // RUN: /Zc:forScope \ 122 // RUN: /Zc:wchar_t \ 123 // RUN: -- %s 124 125 // Ignored options and compile-only options are ignored for link jobs. 126 // RUN: touch %t.obj 127 // RUN: %clang_cl /nologo -### -- %t.obj 2>&1 | FileCheck -check-prefix=LINKUNUSED %s 128 // RUN: %clang_cl /Dfoo -### -- %t.obj 2>&1 | FileCheck -check-prefix=LINKUNUSED %s 129 // RUN: %clang_cl /MD -### -- %t.obj 2>&1 | FileCheck -check-prefix=LINKUNUSED %s 130 // LINKUNUSED-NOT: argument unused during compilation 131 132 // Support ignoring warnings about unused arguments. 133 // RUN: %clang_cl /Abracadabra -Qunused-arguments -### -- %s 2>&1 | FileCheck -check-prefix=UNUSED %s 134 // UNUSED-NOT: warning 135 136 // Unsupported but parsed options. Check that we don't error on them. 137 // (/Zs is for syntax-only) 138 // RUN: %clang_cl /Zs \ 139 // RUN: /AIfoo \ 140 // RUN: /arch:sse2 \ 141 // RUN: /clr:pure \ 142 // RUN: /docname \ 143 // RUN: /E \ 144 // RUN: /EHsc \ 145 // RUN: /EP \ 146 // RUN: /F \ 147 // RUN: /FA \ 148 // RUN: /FAc \ 149 // RUN: /Fafilename \ 150 // RUN: /FAs \ 151 // RUN: /FAu \ 152 // RUN: /favor:blend \ 153 // RUN: /FC \ 154 // RUN: /Fdfoo \ 155 // RUN: /Fifoo \ 156 // RUN: /Fmfoo \ 157 // RUN: /FpDebug\main.pch \ 158 // RUN: /fp:precise \ 159 // RUN: /Frfoo \ 160 // RUN: /FRfoo \ 161 // RUN: /FU foo \ 162 // RUN: /Fx \ 163 // RUN: /G1 \ 164 // RUN: /G2 \ 165 // RUN: /GA \ 166 // RUN: /Gd \ 167 // RUN: /Ge \ 168 // RUN: /Gh \ 169 // RUN: /GH \ 170 // RUN: /GL \ 171 // RUN: /GL- \ 172 // RUN: /Gm \ 173 // RUN: /Gm- \ 174 // RUN: /Gr \ 175 // RUN: /GS \ 176 // RUN: /Gs1000 \ 177 // RUN: /GT \ 178 // RUN: /GX \ 179 // RUN: /Gy \ 180 // RUN: /Gy- \ 181 // RUN: /Gz \ 182 // RUN: /GZ \ 183 // RUN: /H \ 184 // RUN: /homeparams \ 185 // RUN: /hotpatch \ 186 // RUN: /kernel \ 187 // RUN: /LN \ 188 // RUN: /MP \ 189 // RUN: /o foo.obj \ 190 // RUN: /ofoo.obj \ 191 // RUN: /openmp \ 192 // RUN: /Qfast_transcendentals \ 193 // RUN: /QIfist \ 194 // RUN: /Qimprecise_fwaits \ 195 // RUN: /Qpar \ 196 // RUN: /Qvec-report:2 \ 197 // RUN: /u \ 198 // RUN: /V \ 199 // RUN: /vd2 \ 200 // RUN: /vmb \ 201 // RUN: /vmm \ 202 // RUN: /vms \ 203 // RUN: /vmv \ 204 // RUN: /volatile \ 205 // RUN: /wfoo \ 206 // RUN: /WL \ 207 // RUN: /Wp64 \ 208 // RUN: /X \ 209 // RUN: /Y- \ 210 // RUN: /Yc \ 211 // RUN: /Ycstdafx.h \ 212 // RUN: /Yd \ 213 // RUN: /Yl- \ 214 // RUN: /Ylfoo \ 215 // RUN: /Yustdafx.h \ 216 // RUN: /Z7 \ 217 // RUN: /Za \ 218 // RUN: /Zc:auto \ 219 // RUN: /Zc:wchar_t- \ 220 // RUN: /Ze \ 221 // RUN: /Zg \ 222 // RUN: /Zi \ 223 // RUN: /ZI \ 224 // RUN: /Zl \ 225 // RUN: /Zp \ 226 // RUN: /ZW:nostdlib \ 227 // RUN: -- %s 2>&1 228 229 // We support -Xclang for forwarding options to cc1. 230 // RUN: %clang_cl -Xclang hellocc1 -### -- %s 2>&1 | FileCheck -check-prefix=Xclang %s 231 // Xclang: "-cc1" 232 // Xclang: "hellocc1" 233 234 // We support -m32 and -m64. 235 // RUN: %clang_cl /Zs /WX -m32 -m64 -- %s 236 237 238 void f() { } 239