1 // Don't attempt slash switches on msys bash.
2 // REQUIRES: shell-preserves-root
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.
10 // RUN: %clang_cl /c -### -- %s 2>&1 | FileCheck -check-prefix=C %s
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
17 // RUN: %clang_cl /E -### -- %s 2>&1 | FileCheck -check-prefix=E %s
21 // RTTI is on by default; just check that we don't error.
22 // RUN: %clang_cl /Zs /GR -- %s 2>&1
24 // RUN: %clang_cl /GR- -### -- %s 2>&1 | FileCheck -check-prefix=GR_ %s
27 // RUN: %clang_cl /Imyincludedir -### -- %s 2>&1 | FileCheck -check-prefix=SLASH_I %s
28 // RUN: %clang_cl /I myincludedir -### -- %s 2>&1 | FileCheck -check-prefix=SLASH_I %s
29 // SLASH_I: "-I" "myincludedir"
31 // RUN: %clang_cl /J -### -- %s 2>&1 | FileCheck -check-prefix=J %s
32 // J: -fno-signed-char
34 // RUN: %clang_cl /Ofoo -### -- %s 2>&1 | FileCheck -check-prefix=O %s
37 // RUN: %clang_cl /Ob0 -### -- %s 2>&1 | FileCheck -check-prefix=Ob0 %s
40 // RUN: %clang_cl /Od -### -- %s 2>&1 | FileCheck -check-prefix=Od %s
43 // RUN: %clang_cl /Oi- /Oi -### -- %s 2>&1 | FileCheck -check-prefix=Oi %s
44 // Oi-NOT: -fno-builtin
46 // RUN: %clang_cl /Oi- -### -- %s 2>&1 | FileCheck -check-prefix=Oi_ %s
49 // RUN: %clang_cl /Os -### -- %s 2>&1 | FileCheck -check-prefix=Os %s
52 // RUN: %clang_cl /Ot -### -- %s 2>&1 | FileCheck -check-prefix=Ot %s
55 // RUN: %clang_cl /Ox -### -- %s 2>&1 | FileCheck -check-prefix=Ox %s
58 // RUN: %clang_cl /Zs /Oy -- %s 2>&1
60 // RUN: %clang_cl /Oy- -### -- %s 2>&1 | FileCheck -check-prefix=Oy_ %s
61 // Oy_: -mdisable-fp-elim
63 // RUN: %clang_cl /showIncludes -### -- %s 2>&1 | FileCheck -check-prefix=showIncludes %s
64 // showIncludes: --show-includes
66 // RUN: %clang_cl /Umymacro -### -- %s 2>&1 | FileCheck -check-prefix=U %s
67 // RUN: %clang_cl /U mymacro -### -- %s 2>&1 | FileCheck -check-prefix=U %s
70 // RUN: %clang_cl /vmg -### -- %s 2>&1 | FileCheck -check-prefix=VMG %s
71 // VMG: "-fms-memptr-rep=virtual"
73 // RUN: %clang_cl /vmg /vms -### -- %s 2>&1 | FileCheck -check-prefix=VMS %s
74 // VMS: "-fms-memptr-rep=single"
76 // RUN: %clang_cl /vmg /vmm -### -- %s 2>&1 | FileCheck -check-prefix=VMM %s
77 // VMM: "-fms-memptr-rep=multiple"
79 // RUN: %clang_cl /vmg /vmv -### -- %s 2>&1 | FileCheck -check-prefix=VMV %s
80 // VMV: "-fms-memptr-rep=virtual"
82 // RUN: %clang_cl /vmg /vmb -### -- %s 2>&1 | FileCheck -check-prefix=VMB %s
83 // VMB: '/vmg' not allowed with '/vmb'
85 // RUN: %clang_cl /vmg /vmm /vms -### -- %s 2>&1 | FileCheck -check-prefix=VMX %s
86 // VMX: '/vms' not allowed with '/vmm'
88 // RUN: %clang_cl /W0 -### -- %s 2>&1 | FileCheck -check-prefix=W0 %s
91 // RUN: %clang_cl /W1 -### -- %s 2>&1 | FileCheck -check-prefix=W1 %s
92 // RUN: %clang_cl /W2 -### -- %s 2>&1 | FileCheck -check-prefix=W1 %s
93 // RUN: %clang_cl /W3 -### -- %s 2>&1 | FileCheck -check-prefix=W1 %s
94 // RUN: %clang_cl /W4 -### -- %s 2>&1 | FileCheck -check-prefix=W1 %s
95 // RUN: %clang_cl /Wall -### -- %s 2>&1 | FileCheck -check-prefix=W1 %s
98 // RUN: %clang_cl /WX -### -- %s 2>&1 | FileCheck -check-prefix=WX %s
101 // RUN: %clang_cl /WX- -### -- %s 2>&1 | FileCheck -check-prefix=WX_ %s
104 // RUN: %clang_cl /w -### -- %s 2>&1 | FileCheck -check-prefix=w %s
107 // RUN: %clang_cl /Zs -### -- %s 2>&1 | FileCheck -check-prefix=Zs %s
110 // RUN: %clang_cl /FIasdf.h -### -- %s 2>&1 | FileCheck -check-prefix=FI %s
111 // FI: "-include" "asdf.h"
113 // RUN: %clang_cl /FI asdf.h -### -- %s 2>&1 | FileCheck -check-prefix=FI_ %s
114 // FI_: "-include" "asdf.h"
116 // We forward any unrecognized -W diagnostic options to cc1.
117 // RUN: %clang_cl -Wunused-pragmas -### -- %s 2>&1 | FileCheck -check-prefix=WJoined %s
119 // WJoined: "-Wunused-pragmas"
122 // Ignored options. Check that we don't get "unused during compilation" errors.
123 // (/Zs is for syntax-only, /WX is for -Werror)
124 // RUN: %clang_cl /Zs /WX \
126 // RUN: /errorReport:foo \
140 // RUN: /Zc:forScope \
141 // RUN: /Zc:wchar_t \
144 // Ignored options and compile-only options are ignored for link jobs.
146 // RUN: %clang_cl /nologo -### -- %t.obj 2>&1 | FileCheck -check-prefix=LINKUNUSED %s
147 // RUN: %clang_cl /Dfoo -### -- %t.obj 2>&1 | FileCheck -check-prefix=LINKUNUSED %s
148 // RUN: %clang_cl /MD -### -- %t.obj 2>&1 | FileCheck -check-prefix=LINKUNUSED %s
149 // LINKUNUSED-NOT: argument unused during compilation
151 // Support ignoring warnings about unused arguments.
152 // RUN: %clang_cl /Abracadabra -Qunused-arguments -### -- %s 2>&1 | FileCheck -check-prefix=UNUSED %s
153 // UNUSED-NOT: warning
155 // Unsupported but parsed options. Check that we don't error on them.
156 // (/Zs is for syntax-only)
157 // RUN: %clang_cl /Zs \
168 // RUN: /Fafilename \
171 // RUN: /favor:blend \
176 // RUN: /FpDebug\main.pch \
177 // RUN: /fp:precise \
203 // RUN: /homeparams \
211 // RUN: /Qfast_transcendentals \
213 // RUN: /Qimprecise_fwaits \
215 // RUN: /Qvec-report:2 \
226 // RUN: /Ycstdafx.h \
230 // RUN: /Yustdafx.h \
234 // RUN: /Zc:wchar_t- \
242 // RUN: /ZW:nostdlib \
245 // We support -Xclang for forwarding options to cc1.
246 // RUN: %clang_cl -Xclang hellocc1 -### -- %s 2>&1 | FileCheck -check-prefix=Xclang %s
248 // Xclang: "hellocc1"
250 // We support -m32 and -m64.
251 // RUN: %clang_cl /Zs /WX -m32 -m64 -- %s
253 // Use -fno-rtti by default.
254 // RUN: %clang_cl /c -### -- %s 2>&1 | FileCheck -check-prefix=NoRTTI %s
255 // NoRTTI: "-fno-rtti"
256 // RUN: %clang_cl /c /GR -### -- %s 2>&1 | FileCheck -check-prefix=RTTI %s
257 // RTTI-NOT: "-fno-rtti"