xref: /minix3/external/bsd/llvm/dist/clang/test/Driver/cl-inputs.c (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1f4a2713aSLionel Sambuc // Don't attempt slash switches on msys bash.
2f4a2713aSLionel Sambuc // REQUIRES: shell-preserves-root
3f4a2713aSLionel Sambuc 
4f4a2713aSLionel Sambuc // Note: %s must be preceded by --, otherwise it may be interpreted as a
5f4a2713aSLionel Sambuc // command-line option, e.g. on Mac where %s is commonly under /Users.
6f4a2713aSLionel Sambuc 
7f4a2713aSLionel Sambuc // RUN: %clang_cl /TC -### -- %s 2>&1 | FileCheck -check-prefix=TC %s
8f4a2713aSLionel Sambuc // TC:  "-x" "c"
9f4a2713aSLionel Sambuc // TC-NOT: warning
10f4a2713aSLionel Sambuc // TC-NOT: note
11f4a2713aSLionel Sambuc 
12f4a2713aSLionel Sambuc // RUN: %clang_cl /TP -### -- %s 2>&1 | FileCheck -check-prefix=TP %s
13f4a2713aSLionel Sambuc // TP:  "-x" "c++"
14f4a2713aSLionel Sambuc // TP-NOT: warning
15f4a2713aSLionel Sambuc // TP-NOT: note
16f4a2713aSLionel Sambuc 
17f4a2713aSLionel Sambuc // RUN: %clang_cl -### /Tc%s /TP -- %s 2>&1 | FileCheck -check-prefix=Tc %s
18f4a2713aSLionel Sambuc // RUN: %clang_cl -### /TP /Tc%s -- %s 2>&1 | FileCheck -check-prefix=Tc %s
19f4a2713aSLionel Sambuc // Tc:  "-x" "c"
20f4a2713aSLionel Sambuc // Tc:  "-x" "c++"
21f4a2713aSLionel Sambuc // Tc-NOT: warning
22f4a2713aSLionel Sambuc // Tc-NOT: note
23f4a2713aSLionel Sambuc 
24f4a2713aSLionel Sambuc // RUN: %clang_cl -### /Tp%s /TC -- %s 2>&1 | FileCheck -check-prefix=Tp %s
25f4a2713aSLionel Sambuc // RUN: %clang_cl -### /TC /Tp%s -- %s 2>&1 | FileCheck -check-prefix=Tp %s
26f4a2713aSLionel Sambuc // Tp:  "-x" "c++"
27f4a2713aSLionel Sambuc // Tp:  "-x" "c"
28f4a2713aSLionel Sambuc // Tp-NOT: warning
29f4a2713aSLionel Sambuc // Tp-NOT: note
30f4a2713aSLionel Sambuc 
31f4a2713aSLionel Sambuc // RUN: %clang_cl /TP /TC /TP -### -- %s 2>&1 | FileCheck -check-prefix=WARN %s
32f4a2713aSLionel Sambuc // WARN: warning: overriding '/TP' option with '/TC'
33f4a2713aSLionel Sambuc // WARN: warning: overriding '/TC' option with '/TP'
34f4a2713aSLionel Sambuc // WARN: note: The last /TC or /TP option takes precedence over earlier instances
35f4a2713aSLionel Sambuc // WARN-NOT: note
36*0a6a1f1dSLionel Sambuc 
37*0a6a1f1dSLionel Sambuc // RUN: env LIB=%S/Inputs/cl-libs %clang_cl /c /TP cl-test.lib -### 2>&1 | FileCheck -check-prefix=TPlib %s
38*0a6a1f1dSLionel Sambuc // TPlib: warning: cl-test.lib: 'linker' input unused
39*0a6a1f1dSLionel Sambuc // TPlib: warning: argument unused during compilation: '/TP'
40*0a6a1f1dSLionel Sambuc // TPlib-NOT: cl-test.lib
41*0a6a1f1dSLionel Sambuc 
42*0a6a1f1dSLionel Sambuc // RUN: env LIB=%S/Inputs/cl-libs %clang_cl /c /TC cl-test.lib -### 2>&1 | FileCheck -check-prefix=TClib %s
43*0a6a1f1dSLionel Sambuc // TClib: warning: cl-test.lib: 'linker' input unused
44*0a6a1f1dSLionel Sambuc // TClib: warning: argument unused during compilation: '/TC'
45*0a6a1f1dSLionel Sambuc // TClib-NOT: cl-test.lib
46*0a6a1f1dSLionel Sambuc 
47*0a6a1f1dSLionel Sambuc // RUN: not %clang_cl - 2>&1 | FileCheck -check-prefix=STDIN %s
48*0a6a1f1dSLionel Sambuc // STDIN: error: use /Tc or /Tp
49*0a6a1f1dSLionel Sambuc 
50*0a6a1f1dSLionel Sambuc // RUN: %clang_cl -### /Tc - 2>&1 | FileCheck -check-prefix=STDINTc %s
51*0a6a1f1dSLionel Sambuc // STDINTc: "-x" "c"
52*0a6a1f1dSLionel Sambuc 
53*0a6a1f1dSLionel Sambuc // RUN: env LIB=%S/Inputs/cl-libs %clang_cl -### -- %s cl-test.lib 2>&1 | FileCheck -check-prefix=LIBINPUT %s
54*0a6a1f1dSLionel Sambuc // LIBINPUT: link.exe"
55*0a6a1f1dSLionel Sambuc // LIBINPUT: "cl-test.lib"
56*0a6a1f1dSLionel Sambuc 
57*0a6a1f1dSLionel Sambuc // RUN: env LIB=%S/Inputs/cl-libs %clang_cl -### -- %s cl-test2.lib 2>&1 | FileCheck -check-prefix=LIBINPUT2 %s
58*0a6a1f1dSLionel Sambuc // LIBINPUT2: error: no such file or directory: 'cl-test2.lib'
59*0a6a1f1dSLionel Sambuc // LIBINPUT2: link.exe"
60*0a6a1f1dSLionel Sambuc // LIBINPUT2-NOT: "cl-test2.lib"
61*0a6a1f1dSLionel Sambuc 
62*0a6a1f1dSLionel Sambuc void f();
63