]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/Driver/clang_f_opts.c
Vendor import of clang trunk r242221:
[FreeBSD/FreeBSD.git] / test / Driver / clang_f_opts.c
1 // REQUIRES: clang-driver
2
3 // RUN: %clang -### -S -fasm -fblocks -fbuiltin -fno-math-errno -fcommon -fpascal-strings -fno-blocks -fno-builtin -fmath-errno -fno-common -fno-pascal-strings -fblocks -fbuiltin -fmath-errno -fcommon -fpascal-strings -fsplit-stack %s 2>&1 | FileCheck -check-prefix=CHECK-OPTIONS1 %s
4 // RUN: %clang -### -S -fasm -fblocks -fbuiltin -fno-math-errno -fcommon -fpascal-strings -fno-asm -fno-blocks -fno-builtin -fmath-errno -fno-common -fno-pascal-strings -fno-show-source-location -fshort-enums -fshort-wchar %s 2>&1 | FileCheck -check-prefix=CHECK-OPTIONS2 %s
5
6 // CHECK-OPTIONS1: -split-stacks
7 // CHECK-OPTIONS1: -fgnu-keywords
8 // CHECK-OPTIONS1: -fblocks
9 // CHECK-OPTIONS1: -fpascal-strings
10
11 // CHECK-OPTIONS2: -fmath-errno
12 // CHECK-OPTIONS2: -fno-gnu-keywords
13 // CHECK-OPTIONS2: -fno-builtin
14 // CHECK-OPTIONS2: -fshort-enums
15 // CHECK-OPTIONS2: -fshort-wchar
16 // CHECK-OPTIONS2: -fno-common
17 // CHECK-OPTIONS2: -fno-show-source-location
18
19 // RUN: %clang -### -S -Wwrite-strings %s 2>&1 | FileCheck -check-prefix=WRITE-STRINGS1 %s
20 // WRITE-STRINGS1: -fconst-strings
21 // RUN: %clang -### -S -Wwrite-strings -Wno-write-strings %s 2>&1 | FileCheck -check-prefix=WRITE-STRINGS2 %s
22 // WRITE-STRINGS2-NOT: -fconst-strings
23 // RUN: %clang -### -S -Wwrite-strings -w %s 2>&1 | FileCheck -check-prefix=WRITE-STRINGS3 %s
24 // WRITE-STRINGS3-NOT: -fconst-strings
25
26 // RUN: %clang -### -x c++ -c %s 2>&1 | FileCheck -check-prefix=DEPRECATED-ON-CHECK %s
27 // RUN: %clang -### -x c++ -c -Wdeprecated %s 2>&1 | FileCheck -check-prefix=DEPRECATED-ON-CHECK %s
28 // RUN: %clang -### -x c++ -c -Wno-deprecated %s 2>&1 | FileCheck -check-prefix=DEPRECATED-OFF-CHECK %s
29 // RUN: %clang -### -x c++ -c -Wno-deprecated -Wdeprecated %s 2>&1 | FileCheck -check-prefix=DEPRECATED-ON-CHECK %s
30 // RUN: %clang -### -x c++ -c -w %s 2>&1 | FileCheck -check-prefix=DEPRECATED-ON-CHECK %s
31 // RUN: %clang -### -c %s 2>&1 | FileCheck -check-prefix=DEPRECATED-OFF-CHECK %s
32 // RUN: %clang -### -c -Wdeprecated %s 2>&1 | FileCheck -check-prefix=DEPRECATED-OFF-CHECK %s
33 // DEPRECATED-ON-CHECK: -fdeprecated-macro
34 // DEPRECATED-OFF-CHECK-NOT: -fdeprecated-macro
35
36 // RUN: %clang -### -S -ffp-contract=fast %s 2>&1 | FileCheck -check-prefix=FP-CONTRACT-FAST-CHECK %s
37 // RUN: %clang -### -S -ffast-math %s 2>&1 | FileCheck -check-prefix=FP-CONTRACT-FAST-CHECK %s
38 // RUN: %clang -### -S -ffp-contract=off %s 2>&1 | FileCheck -check-prefix=FP-CONTRACT-OFF-CHECK %s
39 // FP-CONTRACT-FAST-CHECK: -ffp-contract=fast
40 // FP-CONTRACT-OFF-CHECK: -ffp-contract=off
41
42 // RUN: %clang -### -S -funroll-loops %s 2>&1 | FileCheck -check-prefix=CHECK-UNROLL-LOOPS %s
43 // RUN: %clang -### -S -fno-unroll-loops %s 2>&1 | FileCheck -check-prefix=CHECK-NO-UNROLL-LOOPS %s
44 // RUN: %clang -### -S -fno-unroll-loops -funroll-loops %s 2>&1 | FileCheck -check-prefix=CHECK-UNROLL-LOOPS %s
45 // RUN: %clang -### -S -funroll-loops -fno-unroll-loops %s 2>&1 | FileCheck -check-prefix=CHECK-NO-UNROLL-LOOPS %s
46 // CHECK-UNROLL-LOOPS: "-funroll-loops"
47 // CHECK-NO-UNROLL-LOOPS: "-fno-unroll-loops"
48
49 // RUN: %clang -### -S -freroll-loops %s 2>&1 | FileCheck -check-prefix=CHECK-REROLL-LOOPS %s
50 // RUN: %clang -### -S -fno-reroll-loops %s 2>&1 | FileCheck -check-prefix=CHECK-NO-REROLL-LOOPS %s
51 // RUN: %clang -### -S -fno-reroll-loops -freroll-loops %s 2>&1 | FileCheck -check-prefix=CHECK-REROLL-LOOPS %s
52 // RUN: %clang -### -S -freroll-loops -fno-reroll-loops %s 2>&1 | FileCheck -check-prefix=CHECK-NO-REROLL-LOOPS %s
53 // CHECK-REROLL-LOOPS: "-freroll-loops"
54 // CHECK-NO-REROLL-LOOPS-NOT: "-freroll-loops"
55
56 // RUN: %clang -### -S -fprofile-sample-use=%S/Inputs/file.prof %s 2>&1 | FileCheck -check-prefix=CHECK-SAMPLE-PROFILE %s
57 // CHECK-SAMPLE-PROFILE: "-fprofile-sample-use={{.*}}/file.prof"
58
59 // RUN: %clang -### -S -fauto-profile=%S/Inputs/file.prof %s 2>&1 | FileCheck -check-prefix=CHECK-AUTO-PROFILE %s
60 // CHECK-AUTO-PROFILE: "-fprofile-sample-use={{.*}}/file.prof"
61
62 // RUN: %clang -### -S -fprofile-arcs %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-ARCS %s
63 // RUN: %clang -### -S -fno-profile-arcs -fprofile-arcs %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-ARCS %s
64 // RUN: %clang -### -S -fno-profile-arcs %s 2>&1 | FileCheck -check-prefix=CHECK-NO-PROFILE-ARCS %s
65 // RUN: %clang -### -S -fprofile-arcs -fno-profile-arcs %s 2>&1 | FileCheck -check-prefix=CHECK-NO-PROFILE-ARCS %s
66 // CHECK-PROFILE-ARCS: "-femit-coverage-data"
67 // CHECK-NO-PROFILE-ARCS-NOT: "-femit-coverage-data"
68
69 // RUN: %clang -### -S -fprofile-generate %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-GENERATE %s
70 // RUN: %clang -### -S -fprofile-instr-generate %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-GENERATE %s
71 // RUN: %clang -### -S -fprofile-generate=/some/dir %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-GENERATE-DIR %s
72 // RUN: %clang -### -S -fprofile-instr-generate=/tmp/somefile.profraw %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-GENERATE-FILE %s
73 // RUN: %clang -### -S -fprofile-generate -fprofile-use %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MIX-GEN-USE %s
74 // RUN: %clang -### -S -fprofile-generate -fprofile-use=dir %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MIX-GEN-USE %s
75 // RUN: %clang -### -S -fprofile-generate -fprofile-instr-use %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MIX-GEN-USE %s
76 // RUN: %clang -### -S -fprofile-generate -fprofile-instr-use=file %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MIX-GEN-USE %s
77 // RUN: %clang -### -S -fprofile-instr-generate -fprofile-use %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MIX-GEN-USE %s
78 // RUN: %clang -### -S -fprofile-instr-generate -fprofile-use=dir %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MIX-GEN-USE %s
79 // RUN: %clang -### -S -fprofile-instr-generate -fprofile-instr-use %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MIX-GEN-USE %s
80 // RUN: %clang -### -S -fprofile-instr-generate -fprofile-instr-use=file %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MIX-GEN-USE %s
81 // RUN: %clang -### -S -fprofile-instr-generate=file -fprofile-use %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MIX-GEN-USE %s
82 // RUN: %clang -### -S -fprofile-instr-generate=file -fprofile-use=dir %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MIX-GEN-USE %s
83 // RUN: %clang -### -S -fprofile-instr-generate=file -fprofile-instr-use %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MIX-GEN-USE %s
84 // RUN: %clang -### -S -fprofile-instr-generate=file -fprofile-instr-use=file %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MIX-GEN-USE %s
85 // RUN: %clang -### -S -fprofile-generate=dir -fprofile-use %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MIX-GEN-USE %s
86 // RUN: %clang -### -S -fprofile-generate=dir -fprofile-use=dir %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MIX-GEN-USE %s
87 // RUN: %clang -### -S -fprofile-generate=dir -fprofile-instr-use %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MIX-GEN-USE %s
88 // RUN: %clang -### -S -fprofile-generate=dir -fprofile-instr-use=file %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MIX-GEN-USE %s
89 // CHECK-PROFILE-GENERATE: "-fprofile-instr-generate"
90 // CHECK-PROFILE-GENERATE-DIR: "-fprofile-instr-generate=/some/dir{{/|\\\\}}default.profraw"
91 // CHECK-PROFILE-GENERATE-FILE: "-fprofile-instr-generate=/tmp/somefile.profraw"
92 // CHECK-NO-MIX-GEN-USE: '{{[a-z=-]*}}' not allowed with '{{[a-z=-]*}}'
93
94 // RUN: %clang -### -S -fprofile-use %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-USE %s
95 // RUN: %clang -### -S -fprofile-instr-use %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-USE %s
96 // RUN: mkdir -p %t.d/some/dir
97 // RUN: %clang -### -S -fprofile-use=%t.d/some/dir %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-USE-DIR %s
98 // RUN: %clang -### -S -fprofile-instr-use=/tmp/somefile.prof %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-USE-FILE %s
99 // CHECK-PROFILE-USE: "-fprofile-instr-use=default.profdata"
100 // CHECK-PROFILE-USE-DIR: "-fprofile-instr-use={{.*}}.d/some/dir{{/|\\\\}}default.profdata"
101 // CHECK-PROFILE-USE-FILE: "-fprofile-instr-use=/tmp/somefile.prof"
102
103 // RUN: %clang -### -S -fvectorize %s 2>&1 | FileCheck -check-prefix=CHECK-VECTORIZE %s
104 // RUN: %clang -### -S -fno-vectorize -fvectorize %s 2>&1 | FileCheck -check-prefix=CHECK-VECTORIZE %s
105 // RUN: %clang -### -S -fno-vectorize %s 2>&1 | FileCheck -check-prefix=CHECK-NO-VECTORIZE %s
106 // RUN: %clang -### -S -fvectorize -fno-vectorize %s 2>&1 | FileCheck -check-prefix=CHECK-NO-VECTORIZE %s
107 // RUN: %clang -### -S -ftree-vectorize %s 2>&1 | FileCheck -check-prefix=CHECK-VECTORIZE %s
108 // RUN: %clang -### -S -fno-tree-vectorize -fvectorize %s 2>&1 | FileCheck -check-prefix=CHECK-VECTORIZE %s
109 // RUN: %clang -### -S -fno-tree-vectorize %s 2>&1 | FileCheck -check-prefix=CHECK-NO-VECTORIZE %s
110 // RUN: %clang -### -S -ftree-vectorize -fno-vectorize %s 2>&1 | FileCheck -check-prefix=CHECK-NO-VECTORIZE %s
111 // RUN: %clang -### -S -O %s 2>&1 | FileCheck -check-prefix=CHECK-VECTORIZE %s
112 // RUN: %clang -### -S -O2 %s 2>&1 | FileCheck -check-prefix=CHECK-VECTORIZE %s
113 // RUN: %clang -### -S -Os %s 2>&1 | FileCheck -check-prefix=CHECK-VECTORIZE %s
114 // RUN: %clang -### -S -O3 %s 2>&1 | FileCheck -check-prefix=CHECK-VECTORIZE %s
115 // RUN: %clang -### -S -fno-vectorize -O3 %s 2>&1 | FileCheck -check-prefix=CHECK-VECTORIZE %s
116 // RUN: %clang -### -S -O1 -fvectorize %s 2>&1 | FileCheck -check-prefix=CHECK-VECTORIZE %s
117 // RUN: %clang -### -S -Ofast %s 2>&1 | FileCheck -check-prefix=CHECK-VECTORIZE %s
118 // RUN: %clang -### -S %s 2>&1 | FileCheck -check-prefix=CHECK-NO-VECTORIZE %s
119 // RUN: %clang -### -S -O0 %s 2>&1 | FileCheck -check-prefix=CHECK-NO-VECTORIZE %s
120 // RUN: %clang -### -S -O1 %s 2>&1 | FileCheck -check-prefix=CHECK-NO-VECTORIZE %s
121 // RUN: %clang -### -S -Oz %s 2>&1 | FileCheck -check-prefix=CHECK-NO-VECTORIZE %s
122 // CHECK-VECTORIZE: "-vectorize-loops"
123 // CHECK-NO-VECTORIZE-NOT: "-vectorize-loops"
124
125 // RUN: %clang -### -S -fslp-vectorize %s 2>&1 | FileCheck -check-prefix=CHECK-SLP-VECTORIZE %s
126 // RUN: %clang -### -S -fno-slp-vectorize -fslp-vectorize %s 2>&1 | FileCheck -check-prefix=CHECK-SLP-VECTORIZE %s
127 // RUN: %clang -### -S -fno-slp-vectorize %s 2>&1 | FileCheck -check-prefix=CHECK-NO-SLP-VECTORIZE %s
128 // RUN: %clang -### -S -fslp-vectorize -fno-slp-vectorize %s 2>&1 | FileCheck -check-prefix=CHECK-NO-SLP-VECTORIZE %s
129 // RUN: %clang -### -S -ftree-slp-vectorize %s 2>&1 | FileCheck -check-prefix=CHECK-SLP-VECTORIZE %s
130 // RUN: %clang -### -S -fno-tree-slp-vectorize -fslp-vectorize %s 2>&1 | FileCheck -check-prefix=CHECK-SLP-VECTORIZE %s
131 // RUN: %clang -### -S -fno-tree-slp-vectorize %s 2>&1 | FileCheck -check-prefix=CHECK-NO-SLP-VECTORIZE %s
132 // RUN: %clang -### -S -ftree-slp-vectorize -fno-slp-vectorize %s 2>&1 | FileCheck -check-prefix=CHECK-NO-SLP-VECTORIZE %s
133 // RUN: %clang -### -S -O %s 2>&1 | FileCheck -check-prefix=CHECK-SLP-VECTORIZE %s
134 // RUN: %clang -### -S -O2 %s 2>&1 | FileCheck -check-prefix=CHECK-SLP-VECTORIZE %s
135 // RUN: %clang -### -S -Os %s 2>&1 | FileCheck -check-prefix=CHECK-SLP-VECTORIZE %s
136 // RUN: %clang -### -S -Oz %s 2>&1 | FileCheck -check-prefix=CHECK-SLP-VECTORIZE %s
137 // RUN: %clang -### -S -O3 %s 2>&1 | FileCheck -check-prefix=CHECK-SLP-VECTORIZE %s
138 // RUN: %clang -### -S -fno-slp-vectorize -O3 %s 2>&1 | FileCheck -check-prefix=CHECK-SLP-VECTORIZE %s
139 // RUN: %clang -### -S -O1 -fslp-vectorize %s 2>&1 | FileCheck -check-prefix=CHECK-SLP-VECTORIZE %s
140 // RUN: %clang -### -S -Ofast %s 2>&1 | FileCheck -check-prefix=CHECK-SLP-VECTORIZE %s
141 // RUN: %clang -### -S %s 2>&1 | FileCheck -check-prefix=CHECK-NO-SLP-VECTORIZE %s
142 // RUN: %clang -### -S -O0 %s 2>&1 | FileCheck -check-prefix=CHECK-NO-SLP-VECTORIZE %s
143 // RUN: %clang -### -S -O1 %s 2>&1 | FileCheck -check-prefix=CHECK-NO-SLP-VECTORIZE %s
144 // CHECK-SLP-VECTORIZE: "-vectorize-slp"
145 // CHECK-NO-SLP-VECTORIZE-NOT: "-vectorize-slp"
146
147 // RUN: %clang -### -S -fslp-vectorize-aggressive %s 2>&1 | FileCheck -check-prefix=CHECK-SLP-VECTORIZE-AGG %s
148 // RUN: %clang -### -S -fno-slp-vectorize-aggressive -fslp-vectorize-aggressive %s 2>&1 | FileCheck -check-prefix=CHECK-SLP-VECTORIZE-AGG %s
149 // RUN: %clang -### -S -fno-slp-vectorize-aggressive %s 2>&1 | FileCheck -check-prefix=CHECK-NO-SLP-VECTORIZE-AGG %s
150 // RUN: %clang -### -S -fslp-vectorize-aggressive -fno-slp-vectorize-aggressive %s 2>&1 | FileCheck -check-prefix=CHECK-NO-SLP-VECTORIZE-AGG %s
151 // CHECK-SLP-VECTORIZE-AGG: "-vectorize-slp-aggressive"
152 // CHECK-NO-SLP-VECTORIZE-AGG-NOT: "-vectorize-slp-aggressive"
153
154 // RUN: %clang -### -S -fextended-identifiers %s 2>&1 | FileCheck -check-prefix=CHECK-EXTENDED-IDENTIFIERS %s
155 // RUN: %clang -### -S -fno-extended-identifiers %s 2>&1 | FileCheck -check-prefix=CHECK-NO-EXTENDED-IDENTIFIERS %s
156 // CHECK-EXTENDED-IDENTIFIERS: "-cc1"
157 // CHECK-EXTENDED-IDENTIFIERS-NOT: "-fextended-identifiers"
158 // CHECK-NO-EXTENDED-IDENTIFIERS: error: unsupported option '-fno-extended-identifiers'
159
160 // RUN: %clang -### -S -fno-pascal-strings -mpascal-strings %s 2>&1 | FileCheck -check-prefix=CHECK-M-PASCAL-STRINGS %s
161 // CHECK-M-PASCAL-STRINGS: "-fpascal-strings"
162
163 // RUN: %clang -### -S -fpascal-strings -mno-pascal-strings %s 2>&1 | FileCheck -check-prefix=CHECK-NO-M-PASCAL-STRINGS %s
164 // CHECK-NO-M-PASCAL-STRINGS-NOT: "-fpascal-strings"
165
166 // RUN: %clang -### -S -O4 %s 2>&1 | FileCheck -check-prefix=CHECK-MAX-O %s
167 // CHECK-MAX-O: warning: -O4 is equivalent to -O3
168 // CHECK-MAX-O: -O3
169
170 // RUN: %clang -S -O20 -o /dev/null %s 2>&1 | FileCheck -check-prefix=CHECK-INVALID-O %s
171 // CHECK-INVALID-O: warning: optimization level '-O20' is not supported; using '-O3' instead
172
173 // RUN: %clang -### -S -finput-charset=iso-8859-1 -o /dev/null %s 2>&1 | FileCheck -check-prefix=CHECK-INVALID-CHARSET %s
174 // CHECK-INVALID-CHARSET: error: invalid value 'iso-8859-1' in '-finput-charset=iso-8859-1'
175
176 // RUN: %clang -### -S -fexec-charset=iso-8859-1 -o /dev/null %s 2>&1 | FileCheck -check-prefix=CHECK-INVALID-INPUT-CHARSET %s
177 // CHECK-INVALID-INPUT-CHARSET: error: invalid value 'iso-8859-1' in '-fexec-charset=iso-8859-1'
178
179 // Test that we don't error on these.
180 // RUN: %clang -### -S -Werror                                                \
181 // RUN:     -falign-functions -falign-functions=2 -fno-align-functions        \
182 // RUN:     -fasynchronous-unwind-tables -fno-asynchronous-unwind-tables      \
183 // RUN:     -fbuiltin -fno-builtin                                            \
184 // RUN:     -fdiagnostics-show-location=once                                  \
185 // RUN:     -ffloat-store -fno-float-store                                    \
186 // RUN:     -feliminate-unused-debug-types -fno-eliminate-unused-debug-types  \
187 // RUN:     -fgcse -fno-gcse                                                  \
188 // RUN:     -fident -fno-ident                                                \
189 // RUN:     -fimplicit-templates -fno-implicit-templates                      \
190 // RUN:     -finput-charset=UTF-8                                             \
191 // RUN:     -fexec-charset=UTF-8                                             \
192 // RUN:     -fivopts -fno-ivopts                                              \
193 // RUN:     -fnon-call-exceptions -fno-non-call-exceptions                    \
194 // RUN:     -fpermissive -fno-permissive                                      \
195 // RUN:     -fdefer-pop -fno-defer-pop                                        \
196 // RUN:     -fprefetch-loop-arrays -fno-prefetch-loop-arrays                  \
197 // RUN:     -fprofile-correction -fno-profile-correction                      \
198 // RUN:     -fprofile-dir=bar                                                 \
199 // RUN:     -fprofile-values -fno-profile-values                              \
200 // RUN:     -frounding-math -fno-rounding-math                                \
201 // RUN:     -fsee -fno-see                                                    \
202 // RUN:     -ftracer -fno-tracer                                              \
203 // RUN:     -funroll-all-loops -fno-unroll-all-loops                          \
204 // RUN:     -fuse-ld=gold                                                     \
205 // RUN:     -fno-builtin-foobar                                               \
206 // RUN:     -fno-builtin-strcat -fno-builtin-strcpy                           \
207 // RUN:     -fno-var-tracking                                                 \
208 // RUN:     -fno-unsigned-char                                                \
209 // RUN:     -fno-signed-char                                                  \
210 // RUN:     -fstrength-reduce -fno-strength-reduce                            \
211 // RUN:     -finline-limit=1000                                               \
212 // RUN:     -finline-limit                                                    \
213 // RUN:     -flto=1                                                           \
214 // RUN:     -falign-labels                                                    \
215 // RUN:     -falign-labels=100                                                \
216 // RUN:     -falign-loops                                                     \
217 // RUN:     -falign-loops=100                                                 \
218 // RUN:     -falign-jumps                                                     \
219 // RUN:     -falign-jumps=100                                                 \
220 // RUN:     -fexcess-precision=100                                            \
221 // RUN:     -fbranch-count-reg                                                \
222 // RUN:     -fcaller-saves                                                    \
223 // RUN:     -fno-default-inline -fdefault-inline                              \
224 // RUN:     -fgcse-after-reload                                               \
225 // RUN:     -fgcse-las                                                        \
226 // RUN:     -fgcse-sm                                                         \
227 // RUN:     -fipa-cp                                                          \
228 // RUN:     -finline-functions-called-once                                    \
229 // RUN:     -fmodulo-sched                                                    \
230 // RUN:     -fmodulo-sched-allow-regmoves                                     \
231 // RUN:     -fpeel-loops                                                      \
232 // RUN:     -frename-registers                                                \
233 // RUN:     -fschedule-insns2                                                 \
234 // RUN:     -fsingle-precision-constant                                       \
235 // RUN:     -ftree_loop_im                                                    \
236 // RUN:     -ftree_loop_ivcanon                                               \
237 // RUN:     -ftree_loop_linear                                                \
238 // RUN:     -funsafe-loop-optimizations                                       \
239 // RUN:     -fuse-linker-plugin                                               \
240 // RUN:     -fvect-cost-model                                                 \
241 // RUN:     -fvariable-expansion-in-unroller                                  \
242 // RUN:     -fweb                                                             \
243 // RUN:     -fwhole-program                                                   \
244 // RUN:     -fno-tree-dce -ftree-dce                                          \
245 // RUN:     -fno-tree-ter -ftree-ter                                          \
246 // RUN:     -fno-tree-vrp -ftree-vrp                                          \
247 // RUN:     -fno-delete-null-pointer-checks -fdelete-null-pointer-checks      \
248 // RUN:     -fno-inline-small-functions -finline-small-functions              \
249 // RUN:     -fno-fat-lto-objects -ffat-lto-objects                            \
250 // RUN:     -fno-merge-constants -fmerge-constants                            \
251 // RUN:     -fno-caller-saves -fcaller-saves                                  \
252 // RUN:     -fno-reorder-blocks -freorder-blocks                              \
253 // RUN:     -fno-schedule-insns2 -fschedule-insns2                            \
254 // RUN:     -fno-stack-check                                                  \
255 // RUN:     -fno-check-new -fcheck-new                                        \
256 // RUN:     -ffriend-injection                                                \
257 // RUN:     -fno-implement-inlines -fimplement-inlines                        \
258 // RUN:     -fstack-check                                                     \
259 // RUN:     -fforce-addr                                                      \
260 // RUN:     -malign-functions=100                                             \
261 // RUN:     -malign-loops=100                                                 \
262 // RUN:     -malign-jumps=100                                                 \
263 // RUN:     %s 2>&1 | FileCheck --check-prefix=IGNORE %s
264 // IGNORE-NOT: error: unknown argument
265
266 // Test that the warning is displayed on these.
267 // RUN: %clang -###                                                           \
268 // RUN: -finline-limit=1000                                                   \
269 // RUN: -finline-limit                                                        \
270 // RUN: -fexpensive-optimizations                                             \
271 // RUN: -fno-expensive-optimizations                                          \
272 // RUN: -fno-defer-pop                                                        \
273 // RUN: -finline-functions                                                    \
274 // RUN: -fkeep-inline-functions                                               \
275 // RUN: -fno-keep-inline-functions                                            \
276 // RUN: -freorder-blocks                                                      \
277 // RUN: -fprofile-dir=/rand/dir                                               \
278 // RUN: -falign-functions                                                     \
279 // RUN: -falign-functions=1                                                   \
280 // RUN: -ffloat-store                                                         \
281 // RUN: -fgcse                                                                \
282 // RUN: -fivopts                                                              \
283 // RUN: -fprefetch-loop-arrays                                                \
284 // RUN: -fprofile-correction                                                  \
285 // RUN: -fprofile-values                                                      \
286 // RUN: -frounding-math                                                       \
287 // RUN: -fschedule-insns                                                      \
288 // RUN: -fsignaling-nans                                                      \
289 // RUN: -fstrength-reduce                                                     \
290 // RUN: -ftracer                                                              \
291 // RUN: -funroll-all-loops                                                    \
292 // RUN: -funswitch-loops                                                      \
293 // RUN: -flto=1                                                               \
294 // RUN: -falign-labels                                                        \
295 // RUN: -falign-labels=100                                                    \
296 // RUN: -falign-loops                                                         \
297 // RUN: -falign-loops=100                                                     \
298 // RUN: -falign-jumps                                                         \
299 // RUN: -falign-jumps=100                                                     \
300 // RUN: -fexcess-precision=100                                                \
301 // RUN: -fbranch-count-reg                                                    \
302 // RUN: -fcaller-saves                                                        \
303 // RUN: -fno-default-inline                                                   \
304 // RUN: -fgcse-after-reload                                                   \
305 // RUN: -fgcse-las                                                            \
306 // RUN: -fgcse-sm                                                             \
307 // RUN: -fipa-cp                                                              \
308 // RUN: -finline-functions-called-once                                        \
309 // RUN: -fmodulo-sched                                                        \
310 // RUN: -fmodulo-sched-allow-regmoves                                         \
311 // RUN: -fpeel-loops                                                          \
312 // RUN: -frename-registers                                                    \
313 // RUN: -fschedule-insns2                                                     \
314 // RUN: -fsingle-precision-constant                                           \
315 // RUN: -ftree_loop_im                                                        \
316 // RUN: -ftree_loop_ivcanon                                                   \
317 // RUN: -ftree_loop_linear                                                    \
318 // RUN: -funsafe-loop-optimizations                                           \
319 // RUN: -fuse-linker-plugin                                                   \
320 // RUN: -fvect-cost-model                                                     \
321 // RUN: -fvariable-expansion-in-unroller                                      \
322 // RUN: -fweb                                                                 \
323 // RUN: -fwhole-program                                                       \
324 // RUN: -fcaller-saves                                                        \
325 // RUN: -freorder-blocks                                                      \
326 // RUN: -fdelete-null-pointer-checks                                          \
327 // RUN: -ffat-lto-objects                                                     \
328 // RUN: -fmerge-constants                                                     \
329 // RUN: -finline-small-functions                                              \
330 // RUN: -ftree-dce                                                            \
331 // RUN: -ftree-ter                                                            \
332 // RUN: -ftree-vrp                                                            \
333 // RUN: -fno-devirtualize                                                     \
334 // RUN: -fno-devirtualize-speculatively                                       \
335 // RUN: %s 2>&1 | FileCheck --check-prefix=CHECK-WARNING %s
336 // CHECK-WARNING-DAG: optimization flag '-finline-limit=1000' is not supported
337 // CHECK-WARNING-DAG: optimization flag '-finline-limit' is not supported
338 // CHECK-WARNING-DAG: optimization flag '-fexpensive-optimizations' is not supported
339 // CHECK-WARNING-DAG: optimization flag '-fno-expensive-optimizations' is not supported
340 // CHECK-WARNING-DAG: optimization flag '-fno-defer-pop' is not supported
341 // CHECK-WARNING-DAG: optimization flag '-finline-functions' is not supported
342 // CHECK-WARNING-DAG: optimization flag '-fkeep-inline-functions' is not supported
343 // CHECK-WARNING-DAG: optimization flag '-fno-keep-inline-functions' is not supported
344 // CHECK-WARNING-DAG: optimization flag '-freorder-blocks' is not supported
345 // CHECK-WARNING-DAG: optimization flag '-fprofile-dir=/rand/dir' is not supported
346 // CHECK-WARNING-DAG: optimization flag '-falign-functions' is not supported
347 // CHECK-WARNING-DAG: optimization flag '-falign-functions=1' is not supported
348 // CHECK-WARNING-DAG: optimization flag '-ffloat-store' is not supported
349 // CHECK-WARNING-DAG: optimization flag '-fgcse' is not supported
350 // CHECK-WARNING-DAG: optimization flag '-fivopts' is not supported
351 // CHECK-WARNING-DAG: optimization flag '-fprefetch-loop-arrays' is not supported
352 // CHECK-WARNING-DAG: optimization flag '-fprofile-correction' is not supported
353 // CHECK-WARNING-DAG: optimization flag '-fprofile-values' is not supported
354 // CHECK-WARNING-DAG: optimization flag '-frounding-math' is not supported
355 // CHECK-WARNING-DAG: optimization flag '-fschedule-insns' is not supported
356 // CHECK-WARNING-DAG: optimization flag '-fsignaling-nans' is not supported
357 // CHECK-WARNING-DAG: optimization flag '-fstrength-reduce' is not supported
358 // CHECK-WARNING-DAG: optimization flag '-ftracer' is not supported
359 // CHECK-WARNING-DAG: optimization flag '-funroll-all-loops' is not supported
360 // CHECK-WARNING-DAG: optimization flag '-funswitch-loops' is not supported
361 // CHECK-WARNING-DAG: optimization flag '-flto=1' is not supported
362 // CHECK-WARNING-DAG: optimization flag '-falign-labels' is not supported
363 // CHECK-WARNING-DAG: optimization flag '-falign-labels=100' is not supported
364 // CHECK-WARNING-DAG: optimization flag '-falign-loops' is not supported
365 // CHECK-WARNING-DAG: optimization flag '-falign-loops=100' is not supported
366 // CHECK-WARNING-DAG: optimization flag '-falign-jumps' is not supported
367 // CHECK-WARNING-DAG: optimization flag '-falign-jumps=100' is not supported
368 // CHECK-WARNING-DAG: optimization flag '-fexcess-precision=100' is not supported
369 // CHECK-WARNING-DAG: optimization flag '-fbranch-count-reg' is not supported
370 // CHECK-WARNING-DAG: optimization flag '-fcaller-saves' is not supported
371 // CHECK-WARNING-DAG: optimization flag '-fno-default-inline' is not supported
372 // CHECK-WARNING-DAG: optimization flag '-fgcse-after-reload' is not supported
373 // CHECK-WARNING-DAG: optimization flag '-fgcse-las' is not supported
374 // CHECK-WARNING-DAG: optimization flag '-fgcse-sm' is not supported
375 // CHECK-WARNING-DAG: optimization flag '-fipa-cp' is not supported
376 // CHECK-WARNING-DAG: optimization flag '-finline-functions-called-once' is not supported
377 // CHECK-WARNING-DAG: optimization flag '-fmodulo-sched' is not supported
378 // CHECK-WARNING-DAG: optimization flag '-fmodulo-sched-allow-regmoves' is not supported
379 // CHECK-WARNING-DAG: optimization flag '-fpeel-loops' is not supported
380 // CHECK-WARNING-DAG: optimization flag '-frename-registers' is not supported
381 // CHECK-WARNING-DAG: optimization flag '-fschedule-insns2' is not supported
382 // CHECK-WARNING-DAG: optimization flag '-fsingle-precision-constant' is not supported
383 // CHECK-WARNING-DAG: optimization flag '-ftree_loop_im' is not supported
384 // CHECK-WARNING-DAG: optimization flag '-ftree_loop_ivcanon' is not supported
385 // CHECK-WARNING-DAG: optimization flag '-ftree_loop_linear' is not supported
386 // CHECK-WARNING-DAG: optimization flag '-funsafe-loop-optimizations' is not supported
387 // CHECK-WARNING-DAG: optimization flag '-fuse-linker-plugin' is not supported
388 // CHECK-WARNING-DAG: optimization flag '-fvect-cost-model' is not supported
389 // CHECK-WARNING-DAG: optimization flag '-fvariable-expansion-in-unroller' is not supported
390 // CHECK-WARNING-DAG: optimization flag '-fweb' is not supported
391 // CHECK-WARNING-DAG: optimization flag '-fwhole-program' is not supported
392 // CHECK-WARNING-DAG: optimization flag '-fcaller-saves' is not supported
393 // CHECK-WARNING-DAG: optimization flag '-freorder-blocks' is not supported
394 // CHECK-WARNING-DAG: optimization flag '-fdelete-null-pointer-checks' is not supported
395 // CHECK-WARNING-DAG: optimization flag '-ffat-lto-objects' is not supported
396 // CHECK-WARNING-DAG: optimization flag '-fmerge-constants' is not supported
397 // CHECK-WARNING-DAG: optimization flag '-finline-small-functions' is not supported
398 // CHECK-WARNING-DAG: optimization flag '-ftree-dce' is not supported
399 // CHECK-WARNING-DAG: optimization flag '-ftree-ter' is not supported
400 // CHECK-WARNING-DAG: optimization flag '-ftree-vrp' is not supported
401 // CHECK-WARNING-DAG: optimization flag '-fno-devirtualize' is not supported
402 // CHECK-WARNING-DAG: optimization flag '-fno-devirtualize-speculatively' is not supported
403
404 // Test that we mute the warning on these
405 // RUN: %clang -### -finline-limit=1000 -Wno-invalid-command-line-argument              \
406 // RUN:     %s 2>&1 | FileCheck --check-prefix=CHECK-NO-WARNING1 %s
407 // RUN: %clang -### -finline-limit -Wno-invalid-command-line-argument                   \
408 // RUN:     %s 2>&1 | FileCheck --check-prefix=CHECK-NO-WARNING2 %s
409 // RUN: %clang -### -finline-limit \
410 // RUN:     -Winvalid-command-line-argument -Wno-ignored-optimization-argument          \
411 // RUN:     %s 2>&1 | FileCheck --check-prefix=CHECK-NO-WARNING2 %s
412 // CHECK-NO-WARNING1-NOT: optimization flag '-finline-limit=1000' is not supported
413 // CHECK-NO-WARNING2-NOT: optimization flag '-finline-limit' is not supported
414
415 // RUN: %clang -### -S -fsigned-char %s 2>&1 | FileCheck -check-prefix=CHAR-SIGN1 %s
416 // CHAR-SIGN1-NOT: -fno-signed-char
417
418 // RUN: %clang -### -S -funsigned-char %s 2>&1 | FileCheck -check-prefix=CHAR-SIGN2 %s
419 // CHAR-SIGN2: -fno-signed-char
420
421 // RUN: %clang -### -S -fno-signed-char %s 2>&1 | FileCheck -check-prefix=CHAR-SIGN3 %s
422 // CHAR-SIGN3: -fno-signed-char
423
424 // RUN: %clang -### -S -fno-unsigned-char %s 2>&1 | FileCheck -check-prefix=CHAR-SIGN4 %s
425 // CHAR-SIGN4-NOT: -fno-signed-char
426
427 // RUN: %clang -### -fshort-wchar -fno-short-wchar %s 2>&1 | FileCheck -check-prefix=CHECK-WCHAR1 -check-prefix=DELIMITERS %s
428 // RUN: %clang -### -fno-short-wchar -fshort-wchar %s 2>&1 | FileCheck -check-prefix=CHECK-WCHAR2 -check-prefix=DELIMITERS %s
429 // Make sure we don't match the -NOT lines with the linker invocation.
430 // Delimiters match the start of the cc1 and the start of the linker lines
431 // DELIMITERS: {{^ *"}}
432 // CHECK-WCHAR1: -fno-short-wchar
433 // CHECK-WCHAR1-NOT: -fshort-wchar
434 // CHECK-WCHAR2: -fshort-wchar
435 // CHECK-WCHAR2-NOT: -fno-short-wchar
436 // DELIMITERS: {{^ *"}}