blob: 632000990f07799e2dd70104532eb2d91f11349a [file] [log] [blame]
Hans Wennborg24ffd632013-09-10 20:35:58 +00001// 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// RUN: %clang_cl /TC -### -- %s 2>&1 | FileCheck -check-prefix=TC %s
8// TC: "-x" "c"
9// TC-NOT: warning
10// TC-NOT: note
11
12// RUN: %clang_cl /TP -### -- %s 2>&1 | FileCheck -check-prefix=TP %s
13// TP: "-x" "c++"
14// TP-NOT: warning
15// TP-NOT: note
16
17// RUN: %clang_cl -### /Tc%s /TP -- %s 2>&1 | FileCheck -check-prefix=Tc %s
18// RUN: %clang_cl -### /TP /Tc%s -- %s 2>&1 | FileCheck -check-prefix=Tc %s
19// Tc: "-x" "c"
20// Tc: "-x" "c++"
21// Tc-NOT: warning
22// Tc-NOT: note
23
24// RUN: %clang_cl -### /Tp%s /TC -- %s 2>&1 | FileCheck -check-prefix=Tp %s
25// RUN: %clang_cl -### /TC /Tp%s -- %s 2>&1 | FileCheck -check-prefix=Tp %s
26// Tp: "-x" "c++"
27// Tp: "-x" "c"
28// Tp-NOT: warning
29// Tp-NOT: note
30
31// RUN: %clang_cl /TP /TC /TP -### -- %s 2>&1 | FileCheck -check-prefix=WARN %s
32// WARN: warning: overriding '/TP' option with '/TC'
33// WARN: warning: overriding '/TC' option with '/TP'
34// WARN: note: The last /TC or /TP option takes precedence over earlier instances
35// WARN-NOT: note
Hans Wennborgcfdd8b52014-01-29 01:04:40 +000036
Ehsan Akhgaric249abb2014-09-12 21:44:24 +000037// RUN: env LIB=%S/Inputs/cl-libs %clang_cl /c /TP cl-test.lib -### 2>&1 | FileCheck -check-prefix=TPlib %s
Ehsan Akhgari7e954ea2014-09-12 18:15:10 +000038// TPlib: warning: cl-test.lib: 'linker' input unused
Ehsan Akhgaric249abb2014-09-12 21:44:24 +000039// TPlib: warning: argument unused during compilation: '/TP'
Ehsan Akhgari7e954ea2014-09-12 18:15:10 +000040// TPlib-NOT: cl-test.lib
41
Ehsan Akhgaric249abb2014-09-12 21:44:24 +000042// RUN: env LIB=%S/Inputs/cl-libs %clang_cl /c /TC cl-test.lib -### 2>&1 | FileCheck -check-prefix=TClib %s
Ehsan Akhgari7e954ea2014-09-12 18:15:10 +000043// TClib: warning: cl-test.lib: 'linker' input unused
Ehsan Akhgaric249abb2014-09-12 21:44:24 +000044// TClib: warning: argument unused during compilation: '/TC'
Ehsan Akhgari7e954ea2014-09-12 18:15:10 +000045// TClib-NOT: cl-test.lib
46
Hans Wennborgcfdd8b52014-01-29 01:04:40 +000047// RUN: not %clang_cl - 2>&1 | FileCheck -check-prefix=STDIN %s
48// STDIN: error: use /Tc or /Tp
49
50// RUN: %clang_cl -### /Tc - 2>&1 | FileCheck -check-prefix=STDINTc %s
51// STDINTc: "-x" "c"
52
Hans Wennborg23d26a32014-06-18 17:21:50 +000053// RUN: env LIB=%S/Inputs/cl-libs %clang_cl -### -- %s cl-test.lib 2>&1 | FileCheck -check-prefix=LIBINPUT %s
Reid Kleckner7d0c0662014-06-18 21:34:36 +000054// LIBINPUT: link.exe"
Hans Wennborg23d26a32014-06-18 17:21:50 +000055// LIBINPUT: "cl-test.lib"
56
57// RUN: env LIB=%S/Inputs/cl-libs %clang_cl -### -- %s cl-test2.lib 2>&1 | FileCheck -check-prefix=LIBINPUT2 %s
58// LIBINPUT2: error: no such file or directory: 'cl-test2.lib'
Reid Kleckner7d0c0662014-06-18 21:34:36 +000059// LIBINPUT2: link.exe"
Hans Wennborg23d26a32014-06-18 17:21:50 +000060// LIBINPUT2-NOT: "cl-test2.lib"
61
Nico Weber1f0f1652015-04-24 22:16:53 +000062// RUN: %clang_cl -### -- %s /nonexisting.lib 2>&1 | FileCheck -check-prefix=LIBINPUT3 %s
63// LIBINPUT3: error: no such file or directory: '/nonexisting.lib'
64// LIBINPUT3: link.exe"
65// LIBINPUT3-NOT: "/nonexisting.lib"
66
Hans Wennborgcfdd8b52014-01-29 01:04:40 +000067void f();