]> granicus.if.org Git - clang/blob - test/Driver/cl-options.c
clang-cl: Ignore the /wd n flag for disabling a warning
[clang] / test / Driver / cl-options.c
1 // Don't attempt slash switches on msys bash.
2 // REQUIRES: shell-preserves-root
3 // Exclude gcc-driven clang.
4 // REQUIRES: clang-driver
5
6 // Note: %s must be preceded by --, otherwise it may be interpreted as a
7 // command-line option, e.g. on Mac where %s is commonly under /Users.
8
9
10 // Alias options:
11
12 // RUN: %clang_cl /c -### -- %s 2>&1 | FileCheck -check-prefix=C %s
13 // C: -c
14
15 // RUN: %clang_cl /Dfoo=bar -### -- %s 2>&1 | FileCheck -check-prefix=D %s
16 // RUN: %clang_cl /D foo=bar -### -- %s 2>&1 | FileCheck -check-prefix=D %s
17 // D: "-D" "foo=bar"
18
19 // RTTI is on by default; just check that we don't error.
20 // RUN: %clang_cl /Zs /GR -- %s 2>&1
21
22 // RUN: %clang_cl /GR- -### -- %s 2>&1 | FileCheck -check-prefix=GR_ %s
23 // GR_: -fno-rtti
24
25 // RUN: %clang_cl /Imyincludedir -### -- %s 2>&1 | FileCheck -check-prefix=I %s
26 // RUN: %clang_cl /I myincludedir -### -- %s 2>&1 | FileCheck -check-prefix=I %s
27 // I: "-I" "myincludedir"
28
29 // RUN: %clang_cl /J -### -- %s 2>&1 | FileCheck -check-prefix=J %s
30 // J: -fno-signed-char
31
32 // RUN: %clang_cl /Ofoo -### -- %s 2>&1 | FileCheck -check-prefix=O %s
33 // O: -Ofoo
34
35 // RUN: %clang_cl /Ob0 -### -- %s 2>&1 | FileCheck -check-prefix=Ob0 %s
36 // Ob0: -fno-inline
37
38 // RUN: %clang_cl /Od -### -- %s 2>&1 | FileCheck -check-prefix=Od %s
39 // Od: -O0
40
41 // RUN: %clang_cl /Oi- /Oi -### -- %s 2>&1 | FileCheck -check-prefix=Oi %s
42 // Oi-NOT: -fno-builtin
43
44 // RUN: %clang_cl /Oi- -### -- %s 2>&1 | FileCheck -check-prefix=Oi_ %s
45 // Oi_: -fno-builtin
46
47 // RUN: %clang_cl /Os -### -- %s 2>&1 | FileCheck -check-prefix=Os %s
48 // Os: -Os
49
50 // RUN: %clang_cl /Ot -### -- %s 2>&1 | FileCheck -check-prefix=Ot %s
51 // Ot: -O2
52
53 // RUN: %clang_cl /Ox -### -- %s 2>&1 | FileCheck -check-prefix=Ox %s
54 // Ox: -O3
55
56 // RUN: %clang_cl /Zs /Oy -- %s 2>&1
57
58 // RUN: %clang_cl /Oy- -### -- %s 2>&1 | FileCheck -check-prefix=Oy_ %s
59 // Oy_: -mdisable-fp-elim
60
61 // RUN: %clang_cl /P -### -- %s 2>&1 | FileCheck -check-prefix=P %s
62 // P: -E
63
64 // RUN: %clang_cl /showIncludes -### -- %s 2>&1 | FileCheck -check-prefix=showIncludes %s
65 // showIncludes: --show-includes
66
67 // RUN: %clang_cl /Umymacro -### -- %s 2>&1 | FileCheck -check-prefix=U %s
68 // RUN: %clang_cl /U mymacro -### -- %s 2>&1 | FileCheck -check-prefix=U %s
69 // U: "-U" "mymacro"
70
71 // RUN: %clang_cl /W0 -### -- %s 2>&1 | FileCheck -check-prefix=W0 %s
72 // W0: -w
73
74 // RUN: %clang_cl /W1 -### -- %s 2>&1 | FileCheck -check-prefix=W1 %s
75 // RUN: %clang_cl /W2 -### -- %s 2>&1 | FileCheck -check-prefix=W1 %s
76 // RUN: %clang_cl /W3 -### -- %s 2>&1 | FileCheck -check-prefix=W1 %s
77 // RUN: %clang_cl /W4 -### -- %s 2>&1 | FileCheck -check-prefix=W1 %s
78 // RUN: %clang_cl /Wall -### -- %s 2>&1 | FileCheck -check-prefix=W1 %s
79 // W1: -Wall
80
81 // RUN: %clang_cl /WX -### -- %s 2>&1 | FileCheck -check-prefix=WX %s
82 // WX: -Werror
83
84 // RUN: %clang_cl /WX- -### -- %s 2>&1 | FileCheck -check-prefix=WX_ %s
85 // WX_: -Wno-error
86
87 // RUN: %clang_cl /w -### -- %s 2>&1 | FileCheck -check-prefix=w %s
88 // w: -w
89
90 // RUN: %clang_cl /Zs -### -- %s 2>&1 | FileCheck -check-prefix=Zs %s
91 // Zs: -fsyntax-only
92
93
94 // Ignored options. Check that we don't get "unused during compilation" errors.
95 // (/Zs is for syntax-only, /WX is for -Werror)
96 // RUN: %clang_cl /Zs /WX /analyze- /errorReport:foo /nologo /Ob1 /Ob2 -- %s
97 // RUN: %clang_cl /Zs /WX /Zc:forScope /Zc:wchar_t /wd1234 -- %s
98
99
100 // Unsupported but parsed options. Check that we don't error on them.
101 // (/Zs is for syntax-only)
102 // RUN: %clang_cl /Zs /EHsc /Fdfoo /fp:precise /Gd /GL /GL- -- %s 2>&1
103 // RUN: %clang_cl /Zs /Gm /Gm- /GS /Gy /Gy- /GZ -- %s 2>&1
104 // RUN: %clang_cl /Zs /RTC1 /wfoo /Zc:wchar_t- -- %s 2>&1
105 // RUN: %clang_cl /Zs /ZI /Zi /MP -- %s 2>&1
106
107
108 // We support -Xclang for forwarding options to cc1.
109 // RUN: %clang_cl -Xclang hellocc1 -### -- %s 2>&1 | FileCheck -check-prefix=Xclang %s
110 // Xclang: "-cc1"
111 // Xclang: "hellocc1"