]> granicus.if.org Git - clang/blob - test/Driver/cl-options.c
cl-options.c just use touch to create that .obj file
[clang] / test / Driver / cl-options.c
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=I %s
24 // RUN: %clang_cl /I myincludedir -### -- %s 2>&1 | FileCheck -check-prefix=I %s
25 // 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 // We forward any unrecognized -W diagnostic options to cc1.
92 // RUN: %clang_cl -Wunused-pragmas -### -- %s 2>&1 | FileCheck -check-prefix=WJoined %s
93 // WJoined: "-cc1"
94 // WJoined: "-Wunused-pragmas"
95
96
97 // Ignored options. Check that we don't get "unused during compilation" errors.
98 // (/Zs is for syntax-only, /WX is for -Werror)
99 // RUN: %clang_cl /Zs /WX /analyze- /errorReport:foo /nologo /Ob1 /Ob2 -- %s
100 // RUN: %clang_cl /Zs /WX /Zc:forScope /Zc:wchar_t /w12345 /wd1234 /RTC1 -- %s
101
102 // Ignored options and compile-only options are ignored for link jobs.
103 // RUN: touch %t.obj
104 // RUN: %clang_cl /nologo -### -- %t.obj 2>&1 | FileCheck -check-prefix=LINKUNUSED %s
105 // RUN: %clang_cl /Dfoo -### -- %t.obj 2>&1 | FileCheck -check-prefix=LINKUNUSED %s
106 // RUN: %clang_cl /MD -### -- %t.obj 2>&1 | FileCheck -check-prefix=LINKUNUSED %s
107 // LINKUNUSED-NOT: argument unused during compilation
108
109 // Support ignoring warnings about unused arguments.
110 // RUN: %clang_cl /Abracadabra -Qunused-arguments -### -- %s 2>&1 | FileCheck -check-prefix=UNUSED %s
111 // UNUSED-NOT: warning
112
113
114 // Unsupported but parsed options. Check that we don't error on them.
115 // (/Zs is for syntax-only)
116 // RUN: %clang_cl /Zs /EHsc /Fdfoo /fp:precise /Gd /GL /GL- -- %s 2>&1
117 // RUN: %clang_cl /Zs /Gm /Gm- /GS /Gy /Gy- /GZ -- %s 2>&1
118 // RUN: %clang_cl /Zs /ofoo.obj /o foo.obj -- %s 2>&1
119 // RUN: %clang_cl /Zs /wfoo /Zc:wchar_t- -- %s 2>&1
120 // RUN: %clang_cl /Zs /ZI /Zi /MP -- %s 2>&1
121
122
123 // We support -Xclang for forwarding options to cc1.
124 // RUN: %clang_cl -Xclang hellocc1 -### -- %s 2>&1 | FileCheck -check-prefix=Xclang %s
125 // Xclang: "-cc1"
126 // Xclang: "hellocc1"
127
128 void f() { }