]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/Driver/clang_f_opts.c
Vendor import of clang trunk r290819:
[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-dir=abc %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-DIR-UNUSED %s
70 // RUN: %clang -### -S -ftest-coverage -fprofile-dir=abc %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-DIR-UNUSED %s
71 // RUN: %clang -### -S -fprofile-arcs -fprofile-dir=abc %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-DIR %s
72 // RUN: %clang -### -S --coverage -fprofile-dir=abc %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-DIR %s
73 // RUN: %clang -### -S -fprofile-arcs -fno-profile-arcs -fprofile-dir=abc %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-DIR-NEITHER %s
74 // CHECK-PROFILE-DIR: "-coverage-data-file" "abc
75 // CHECK-PROFILE-DIR-UNUSED: argument unused
76 // CHECK-PROFILE-DIR-UNUSED-NOT: "-coverage-data-file" "abc
77 // CHECK-PROFILE-DIR-NEITHER-NOT: argument unused
78
79 // RUN: %clang -### -S -fprofile-generate %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-GENERATE-LLVM %s
80 // RUN: %clang -### -S -fprofile-instr-generate %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-GENERATE %s
81 // RUN: %clang -### -S -fprofile-generate=/some/dir %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-GENERATE-DIR %s
82 // RUN: %clang -### -S -fprofile-instr-generate=/tmp/somefile.profraw %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-GENERATE-FILE %s
83 // RUN: %clang -### -S -fprofile-generate -fprofile-use %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MIX-GEN-USE %s
84 // RUN: %clang -### -S -fprofile-generate -fprofile-use=dir %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MIX-GEN-USE %s
85 // RUN: %clang -### -S -fprofile-generate -fprofile-instr-use %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MIX-GEN-USE %s
86 // RUN: %clang -### -S -fprofile-generate -fprofile-instr-use=file %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MIX-GEN-USE %s
87 // RUN: %clang -### -S -fprofile-instr-generate -fprofile-use %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MIX-GEN-USE %s
88 // RUN: %clang -### -S -fprofile-instr-generate -fprofile-use=dir %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MIX-GEN-USE %s
89 // RUN: %clang -### -S -fprofile-instr-generate -fprofile-instr-use %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MIX-GEN-USE %s
90 // RUN: %clang -### -S -fprofile-instr-generate -fprofile-instr-use=file %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MIX-GEN-USE %s
91 // RUN: %clang -### -S -fprofile-instr-generate=file -fprofile-use %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MIX-GEN-USE %s
92 // RUN: %clang -### -S -fprofile-instr-generate=file -fprofile-use=dir %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MIX-GEN-USE %s
93 // RUN: %clang -### -S -fprofile-instr-generate=file -fprofile-instr-use %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MIX-GEN-USE %s
94 // RUN: %clang -### -S -fprofile-instr-generate=file -fprofile-instr-use=file %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MIX-GEN-USE %s
95 // RUN: %clang -### -S -fprofile-generate=dir -fprofile-use %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MIX-GEN-USE %s
96 // RUN: %clang -### -S -fprofile-generate=dir -fprofile-use=dir %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MIX-GEN-USE %s
97 // RUN: %clang -### -S -fprofile-generate=dir -fprofile-instr-use %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MIX-GEN-USE %s
98 // RUN: %clang -### -S -fprofile-generate=dir -fprofile-instr-use=file %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MIX-GEN-USE %s
99 // RUN: %clang -### -S -fprofile-instr-generate=file -fno-profile-instr-generate %s 2>&1 | FileCheck -check-prefix=CHECK-DISABLE-GEN %s
100 // RUN: %clang -### -S -fprofile-instr-generate -fprofile-generate %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MIX-GENERATE %s
101 // RUN: %clang -### -S -fprofile-instr-generate -fprofile-generate=file %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MIX-GENERATE %s
102 // RUN: %clang -### -S -fprofile-generate=dir -fno-profile-generate %s 2>&1 | FileCheck -check-prefix=CHECK-DISABLE-GEN %s
103 // RUN: %clang -### -S -fprofile-instr-use=file -fno-profile-instr-use %s 2>&1 | FileCheck -check-prefix=CHECK-DISABLE-USE %s
104 // RUN: %clang -### -S -fprofile-instr-use=file -fno-profile-use %s 2>&1 | FileCheck -check-prefix=CHECK-DISABLE-USE %s
105 // RUN: %clang -### -S -fprofile-use=file -fno-profile-use %s 2>&1 | FileCheck -check-prefix=CHECK-DISABLE-USE %s
106 // RUN: %clang -### -S -fprofile-use=file -fno-profile-instr-use %s 2>&1 | FileCheck -check-prefix=CHECK-DISABLE-USE %s
107 // RUN: %clang -### -S -fcoverage-mapping %s 2>&1 | FileCheck -check-prefix=CHECK-COVERAGE-AND-GEN %s
108 // RUN: %clang -### -S -fcoverage-mapping -fno-coverage-mapping %s 2>&1 | FileCheck -check-prefix=CHECK-DISABLE-COVERAGE %s
109 // RUN: %clang -### -S -fprofile-instr-generate -fcoverage-mapping -fno-coverage-mapping %s 2>&1 | FileCheck -check-prefix=CHECK-DISABLE-COVERAGE %s
110 // CHECK-PROFILE-GENERATE: "-fprofile-instrument=clang"
111 // CHECK-PROFILE-GENERATE-LLVM: "-fprofile-instrument=llvm"
112 // CHECK-PROFILE-GENERATE-DIR: "-fprofile-instrument-path=/some/dir{{/|\\\\}}{{.*}}"
113 // CHECK-PROFILE-GENERATE-FILE: "-fprofile-instrument-path=/tmp/somefile.profraw"
114 // CHECK-NO-MIX-GEN-USE: '{{[a-z=-]*}}' not allowed with '{{[a-z=-]*}}'
115 // CHECK-NO-MIX-GENERATE: '{{[a-z=-]*}}' not allowed with '{{[a-z=-]*}}'
116 // CHECK-DISABLE-GEN-NOT: "-fprofile-instrument=clang"
117 // CHECK-DISABLE-USE-NOT: "-fprofile-instr-use"
118 // CHECK-COVERAGE-AND-GEN: '-fcoverage-mapping' only allowed with '-fprofile-instr-generate'
119 // CHECK-DISABLE-COVERAGE-NOT: "-fcoverage-mapping"
120
121 // RUN: %clang -### -S -fprofile-use %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-USE %s
122 // RUN: %clang -### -S -fprofile-instr-use %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-USE %s
123 // RUN: mkdir -p %t.d/some/dir
124 // RUN: %clang -### -S -fprofile-use=%t.d/some/dir %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-USE-DIR %s
125 // RUN: %clang -### -S -fprofile-instr-use=/tmp/somefile.prof %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-USE-FILE %s
126 // CHECK-PROFILE-USE: "-fprofile-instrument-use-path=default.profdata"
127 // CHECK-PROFILE-USE-DIR: "-fprofile-instrument-use-path={{.*}}.d/some/dir{{/|\\\\}}default.profdata"
128 // CHECK-PROFILE-USE-FILE: "-fprofile-instrument-use-path=/tmp/somefile.prof"
129
130 // RUN: %clang -### -S -fvectorize %s 2>&1 | FileCheck -check-prefix=CHECK-VECTORIZE %s
131 // RUN: %clang -### -S -fno-vectorize -fvectorize %s 2>&1 | FileCheck -check-prefix=CHECK-VECTORIZE %s
132 // RUN: %clang -### -S -fno-vectorize %s 2>&1 | FileCheck -check-prefix=CHECK-NO-VECTORIZE %s
133 // RUN: %clang -### -S -fvectorize -fno-vectorize %s 2>&1 | FileCheck -check-prefix=CHECK-NO-VECTORIZE %s
134 // RUN: %clang -### -S -ftree-vectorize %s 2>&1 | FileCheck -check-prefix=CHECK-VECTORIZE %s
135 // RUN: %clang -### -S -fno-tree-vectorize -fvectorize %s 2>&1 | FileCheck -check-prefix=CHECK-VECTORIZE %s
136 // RUN: %clang -### -S -fno-tree-vectorize %s 2>&1 | FileCheck -check-prefix=CHECK-NO-VECTORIZE %s
137 // RUN: %clang -### -S -ftree-vectorize -fno-vectorize %s 2>&1 | FileCheck -check-prefix=CHECK-NO-VECTORIZE %s
138 // RUN: %clang -### -S -O %s 2>&1 | FileCheck -check-prefix=CHECK-VECTORIZE %s
139 // RUN: %clang -### -S -O2 %s 2>&1 | FileCheck -check-prefix=CHECK-VECTORIZE %s
140 // RUN: %clang -### -S -Os %s 2>&1 | FileCheck -check-prefix=CHECK-VECTORIZE %s
141 // RUN: %clang -### -S -O3 %s 2>&1 | FileCheck -check-prefix=CHECK-VECTORIZE %s
142 // RUN: %clang -### -S -fno-vectorize -O3 %s 2>&1 | FileCheck -check-prefix=CHECK-VECTORIZE %s
143 // RUN: %clang -### -S -O1 -fvectorize %s 2>&1 | FileCheck -check-prefix=CHECK-VECTORIZE %s
144 // RUN: %clang -### -S -Ofast %s 2>&1 | FileCheck -check-prefix=CHECK-VECTORIZE %s
145 // RUN: %clang -### -S %s 2>&1 | FileCheck -check-prefix=CHECK-NO-VECTORIZE %s
146 // RUN: %clang -### -S -O0 %s 2>&1 | FileCheck -check-prefix=CHECK-NO-VECTORIZE %s
147 // RUN: %clang -### -S -O1 %s 2>&1 | FileCheck -check-prefix=CHECK-NO-VECTORIZE %s
148 // RUN: %clang -### -S -Oz %s 2>&1 | FileCheck -check-prefix=CHECK-NO-VECTORIZE %s
149 // CHECK-VECTORIZE: "-vectorize-loops"
150 // CHECK-NO-VECTORIZE-NOT: "-vectorize-loops"
151
152 // RUN: %clang -### -S -fslp-vectorize %s 2>&1 | FileCheck -check-prefix=CHECK-SLP-VECTORIZE %s
153 // RUN: %clang -### -S -fno-slp-vectorize -fslp-vectorize %s 2>&1 | FileCheck -check-prefix=CHECK-SLP-VECTORIZE %s
154 // RUN: %clang -### -S -fno-slp-vectorize %s 2>&1 | FileCheck -check-prefix=CHECK-NO-SLP-VECTORIZE %s
155 // RUN: %clang -### -S -fslp-vectorize -fno-slp-vectorize %s 2>&1 | FileCheck -check-prefix=CHECK-NO-SLP-VECTORIZE %s
156 // RUN: %clang -### -S -ftree-slp-vectorize %s 2>&1 | FileCheck -check-prefix=CHECK-SLP-VECTORIZE %s
157 // RUN: %clang -### -S -fno-tree-slp-vectorize -fslp-vectorize %s 2>&1 | FileCheck -check-prefix=CHECK-SLP-VECTORIZE %s
158 // RUN: %clang -### -S -fno-tree-slp-vectorize %s 2>&1 | FileCheck -check-prefix=CHECK-NO-SLP-VECTORIZE %s
159 // RUN: %clang -### -S -ftree-slp-vectorize -fno-slp-vectorize %s 2>&1 | FileCheck -check-prefix=CHECK-NO-SLP-VECTORIZE %s
160 // RUN: %clang -### -S -O %s 2>&1 | FileCheck -check-prefix=CHECK-SLP-VECTORIZE %s
161 // RUN: %clang -### -S -O2 %s 2>&1 | FileCheck -check-prefix=CHECK-SLP-VECTORIZE %s
162 // RUN: %clang -### -S -Os %s 2>&1 | FileCheck -check-prefix=CHECK-SLP-VECTORIZE %s
163 // RUN: %clang -### -S -Oz %s 2>&1 | FileCheck -check-prefix=CHECK-SLP-VECTORIZE %s
164 // RUN: %clang -### -S -O3 %s 2>&1 | FileCheck -check-prefix=CHECK-SLP-VECTORIZE %s
165 // RUN: %clang -### -S -fno-slp-vectorize -O3 %s 2>&1 | FileCheck -check-prefix=CHECK-SLP-VECTORIZE %s
166 // RUN: %clang -### -S -O1 -fslp-vectorize %s 2>&1 | FileCheck -check-prefix=CHECK-SLP-VECTORIZE %s
167 // RUN: %clang -### -S -Ofast %s 2>&1 | FileCheck -check-prefix=CHECK-SLP-VECTORIZE %s
168 // RUN: %clang -### -S %s 2>&1 | FileCheck -check-prefix=CHECK-NO-SLP-VECTORIZE %s
169 // RUN: %clang -### -S -O0 %s 2>&1 | FileCheck -check-prefix=CHECK-NO-SLP-VECTORIZE %s
170 // RUN: %clang -### -S -O1 %s 2>&1 | FileCheck -check-prefix=CHECK-NO-SLP-VECTORIZE %s
171 // CHECK-SLP-VECTORIZE: "-vectorize-slp"
172 // CHECK-NO-SLP-VECTORIZE-NOT: "-vectorize-slp"
173
174 // RUN: %clang -### -S -fslp-vectorize-aggressive %s 2>&1 | FileCheck -check-prefix=CHECK-SLP-VECTORIZE-AGG %s
175 // RUN: %clang -### -S -fno-slp-vectorize-aggressive -fslp-vectorize-aggressive %s 2>&1 | FileCheck -check-prefix=CHECK-SLP-VECTORIZE-AGG %s
176 // RUN: %clang -### -S -fno-slp-vectorize-aggressive %s 2>&1 | FileCheck -check-prefix=CHECK-NO-SLP-VECTORIZE-AGG %s
177 // RUN: %clang -### -S -fslp-vectorize-aggressive -fno-slp-vectorize-aggressive %s 2>&1 | FileCheck -check-prefix=CHECK-NO-SLP-VECTORIZE-AGG %s
178 // CHECK-SLP-VECTORIZE-AGG: "-vectorize-slp-aggressive"
179 // CHECK-NO-SLP-VECTORIZE-AGG-NOT: "-vectorize-slp-aggressive"
180
181 // RUN: %clang -### -S -fextended-identifiers %s 2>&1 | FileCheck -check-prefix=CHECK-EXTENDED-IDENTIFIERS %s
182 // RUN: %clang -### -S -fno-extended-identifiers %s 2>&1 | FileCheck -check-prefix=CHECK-NO-EXTENDED-IDENTIFIERS %s
183 // CHECK-EXTENDED-IDENTIFIERS: "-cc1"
184 // CHECK-EXTENDED-IDENTIFIERS-NOT: "-fextended-identifiers"
185 // CHECK-NO-EXTENDED-IDENTIFIERS: error: unsupported option '-fno-extended-identifiers'
186
187 // RUN: %clang -### -S -fno-pascal-strings -mpascal-strings %s 2>&1 | FileCheck -check-prefix=CHECK-M-PASCAL-STRINGS %s
188 // CHECK-M-PASCAL-STRINGS: "-fpascal-strings"
189
190 // RUN: %clang -### -S -fpascal-strings -mno-pascal-strings %s 2>&1 | FileCheck -check-prefix=CHECK-NO-M-PASCAL-STRINGS %s
191 // CHECK-NO-M-PASCAL-STRINGS-NOT: "-fpascal-strings"
192
193 // RUN: %clang -### -S -O4 %s 2>&1 | FileCheck -check-prefix=CHECK-MAX-O %s
194 // CHECK-MAX-O: warning: -O4 is equivalent to -O3
195 // CHECK-MAX-O: -O3
196
197 // RUN: %clang -S -O20 -o /dev/null %s 2>&1 | FileCheck -check-prefix=CHECK-INVALID-O %s
198 // CHECK-INVALID-O: warning: optimization level '-O20' is not supported; using '-O3' instead
199
200 // RUN: %clang -### -S -finput-charset=iso-8859-1 -o /dev/null %s 2>&1 | FileCheck -check-prefix=CHECK-INVALID-CHARSET %s
201 // CHECK-INVALID-CHARSET: error: invalid value 'iso-8859-1' in '-finput-charset=iso-8859-1'
202
203 // RUN: %clang -### -S -fexec-charset=iso-8859-1 -o /dev/null %s 2>&1 | FileCheck -check-prefix=CHECK-INVALID-INPUT-CHARSET %s
204 // CHECK-INVALID-INPUT-CHARSET: error: invalid value 'iso-8859-1' in '-fexec-charset=iso-8859-1'
205
206 // Test that we don't error on these.
207 // RUN: %clang -### -S -Werror                                                \
208 // RUN:     -falign-functions -falign-functions=2 -fno-align-functions        \
209 // RUN:     -fasynchronous-unwind-tables -fno-asynchronous-unwind-tables      \
210 // RUN:     -fbuiltin -fno-builtin                                            \
211 // RUN:     -fdiagnostics-show-location=once                                  \
212 // RUN:     -ffloat-store -fno-float-store                                    \
213 // RUN:     -feliminate-unused-debug-types -fno-eliminate-unused-debug-types  \
214 // RUN:     -fgcse -fno-gcse                                                  \
215 // RUN:     -fident -fno-ident                                                \
216 // RUN:     -fimplicit-templates -fno-implicit-templates                      \
217 // RUN:     -finput-charset=UTF-8                                             \
218 // RUN:     -fexec-charset=UTF-8                                             \
219 // RUN:     -fivopts -fno-ivopts                                              \
220 // RUN:     -fnon-call-exceptions -fno-non-call-exceptions                    \
221 // RUN:     -fpermissive -fno-permissive                                      \
222 // RUN:     -fdefer-pop -fno-defer-pop                                        \
223 // RUN:     -fprefetch-loop-arrays -fno-prefetch-loop-arrays                  \
224 // RUN:     -fprofile-correction -fno-profile-correction                      \
225 // RUN:     -fprofile-values -fno-profile-values                              \
226 // RUN:     -frounding-math -fno-rounding-math                                \
227 // RUN:     -fsee -fno-see                                                    \
228 // RUN:     -ftracer -fno-tracer                                              \
229 // RUN:     -funroll-all-loops -fno-unroll-all-loops                          \
230 // RUN:     -fuse-ld=gold                                                     \
231 // RUN:     -fno-builtin-foobar                                               \
232 // RUN:     -fno-builtin-strcat -fno-builtin-strcpy                           \
233 // RUN:     -fno-var-tracking                                                 \
234 // RUN:     -fno-unsigned-char                                                \
235 // RUN:     -fno-signed-char                                                  \
236 // RUN:     -fstrength-reduce -fno-strength-reduce                            \
237 // RUN:     -finline-limit=1000                                               \
238 // RUN:     -finline-limit                                                    \
239 // RUN:     -flto=1                                                           \
240 // RUN:     -falign-labels                                                    \
241 // RUN:     -falign-labels=100                                                \
242 // RUN:     -falign-loops                                                     \
243 // RUN:     -falign-loops=100                                                 \
244 // RUN:     -falign-jumps                                                     \
245 // RUN:     -falign-jumps=100                                                 \
246 // RUN:     -fexcess-precision=100                                            \
247 // RUN:     -fbranch-count-reg                                                \
248 // RUN:     -fcaller-saves                                                    \
249 // RUN:     -fno-default-inline -fdefault-inline                              \
250 // RUN:     -fgcse-after-reload                                               \
251 // RUN:     -fgcse-las                                                        \
252 // RUN:     -fgcse-sm                                                         \
253 // RUN:     -fipa-cp                                                          \
254 // RUN:     -finline-functions-called-once                                    \
255 // RUN:     -fmodulo-sched                                                    \
256 // RUN:     -fmodulo-sched-allow-regmoves                                     \
257 // RUN:     -fpeel-loops                                                      \
258 // RUN:     -frename-registers                                                \
259 // RUN:     -fschedule-insns2                                                 \
260 // RUN:     -fsingle-precision-constant                                       \
261 // RUN:     -ftree_loop_im                                                    \
262 // RUN:     -ftree_loop_ivcanon                                               \
263 // RUN:     -ftree_loop_linear                                                \
264 // RUN:     -funsafe-loop-optimizations                                       \
265 // RUN:     -fuse-linker-plugin                                               \
266 // RUN:     -fvect-cost-model                                                 \
267 // RUN:     -fvariable-expansion-in-unroller                                  \
268 // RUN:     -fweb                                                             \
269 // RUN:     -fwhole-program                                                   \
270 // RUN:     -fno-tree-dce -ftree-dce                                          \
271 // RUN:     -fno-tree-ter -ftree-ter                                          \
272 // RUN:     -fno-tree-vrp -ftree-vrp                                          \
273 // RUN:     -fno-delete-null-pointer-checks -fdelete-null-pointer-checks      \
274 // RUN:     -fno-inline-small-functions -finline-small-functions              \
275 // RUN:     -fno-fat-lto-objects -ffat-lto-objects                            \
276 // RUN:     -fno-merge-constants -fmerge-constants                            \
277 // RUN:     -fno-caller-saves -fcaller-saves                                  \
278 // RUN:     -fno-reorder-blocks -freorder-blocks                              \
279 // RUN:     -fno-schedule-insns2 -fschedule-insns2                            \
280 // RUN:     -fno-stack-check                                                  \
281 // RUN:     -fno-check-new -fcheck-new                                        \
282 // RUN:     -ffriend-injection                                                \
283 // RUN:     -fno-implement-inlines -fimplement-inlines                        \
284 // RUN:     -fstack-check                                                     \
285 // RUN:     -fforce-addr                                                      \
286 // RUN:     -malign-functions=100                                             \
287 // RUN:     -malign-loops=100                                                 \
288 // RUN:     -malign-jumps=100                                                 \
289 // RUN:     %s 2>&1 | FileCheck --check-prefix=IGNORE %s
290 // IGNORE-NOT: error: unknown argument
291
292 // Test that the warning is displayed on these.
293 // RUN: %clang -###                                                           \
294 // RUN: -finline-limit=1000                                                   \
295 // RUN: -finline-limit                                                        \
296 // RUN: -fexpensive-optimizations                                             \
297 // RUN: -fno-expensive-optimizations                                          \
298 // RUN: -fno-defer-pop                                                        \
299 // RUN: -fkeep-inline-functions                                               \
300 // RUN: -fno-keep-inline-functions                                            \
301 // RUN: -freorder-blocks                                                      \
302 // RUN: -falign-functions                                                     \
303 // RUN: -falign-functions=1                                                   \
304 // RUN: -ffloat-store                                                         \
305 // RUN: -fgcse                                                                \
306 // RUN: -fivopts                                                              \
307 // RUN: -fprefetch-loop-arrays                                                \
308 // RUN: -fprofile-correction                                                  \
309 // RUN: -fprofile-values                                                      \
310 // RUN: -frounding-math                                                       \
311 // RUN: -fschedule-insns                                                      \
312 // RUN: -fsignaling-nans                                                      \
313 // RUN: -fstrength-reduce                                                     \
314 // RUN: -ftracer                                                              \
315 // RUN: -funroll-all-loops                                                    \
316 // RUN: -funswitch-loops                                                      \
317 // RUN: -flto=1                                                               \
318 // RUN: -falign-labels                                                        \
319 // RUN: -falign-labels=100                                                    \
320 // RUN: -falign-loops                                                         \
321 // RUN: -falign-loops=100                                                     \
322 // RUN: -falign-jumps                                                         \
323 // RUN: -falign-jumps=100                                                     \
324 // RUN: -fexcess-precision=100                                                \
325 // RUN: -fbranch-count-reg                                                    \
326 // RUN: -fcaller-saves                                                        \
327 // RUN: -fno-default-inline                                                   \
328 // RUN: -fgcse-after-reload                                                   \
329 // RUN: -fgcse-las                                                            \
330 // RUN: -fgcse-sm                                                             \
331 // RUN: -fipa-cp                                                              \
332 // RUN: -finline-functions-called-once                                        \
333 // RUN: -fmodulo-sched                                                        \
334 // RUN: -fmodulo-sched-allow-regmoves                                         \
335 // RUN: -fpeel-loops                                                          \
336 // RUN: -frename-registers                                                    \
337 // RUN: -fschedule-insns2                                                     \
338 // RUN: -fsingle-precision-constant                                           \
339 // RUN: -ftree_loop_im                                                        \
340 // RUN: -ftree_loop_ivcanon                                                   \
341 // RUN: -ftree_loop_linear                                                    \
342 // RUN: -funsafe-loop-optimizations                                           \
343 // RUN: -fuse-linker-plugin                                                   \
344 // RUN: -fvect-cost-model                                                     \
345 // RUN: -fvariable-expansion-in-unroller                                      \
346 // RUN: -fweb                                                                 \
347 // RUN: -fwhole-program                                                       \
348 // RUN: -fcaller-saves                                                        \
349 // RUN: -freorder-blocks                                                      \
350 // RUN: -fdelete-null-pointer-checks                                          \
351 // RUN: -ffat-lto-objects                                                     \
352 // RUN: -fmerge-constants                                                     \
353 // RUN: -finline-small-functions                                              \
354 // RUN: -ftree-dce                                                            \
355 // RUN: -ftree-ter                                                            \
356 // RUN: -ftree-vrp                                                            \
357 // RUN: -fno-devirtualize                                                     \
358 // RUN: -fno-devirtualize-speculatively                                       \
359 // RUN: %s 2>&1 | FileCheck --check-prefix=CHECK-WARNING %s
360 // CHECK-WARNING-DAG: optimization flag '-finline-limit=1000' is not supported
361 // CHECK-WARNING-DAG: optimization flag '-finline-limit' is not supported
362 // CHECK-WARNING-DAG: optimization flag '-fexpensive-optimizations' is not supported
363 // CHECK-WARNING-DAG: optimization flag '-fno-expensive-optimizations' is not supported
364 // CHECK-WARNING-DAG: optimization flag '-fno-defer-pop' is not supported
365 // CHECK-WARNING-DAG: optimization flag '-fkeep-inline-functions' is not supported
366 // CHECK-WARNING-DAG: optimization flag '-fno-keep-inline-functions' is not supported
367 // CHECK-WARNING-DAG: optimization flag '-freorder-blocks' is not supported
368 // CHECK-WARNING-DAG: optimization flag '-falign-functions' is not supported
369 // CHECK-WARNING-DAG: optimization flag '-falign-functions=1' is not supported
370 // CHECK-WARNING-DAG: optimization flag '-ffloat-store' is not supported
371 // CHECK-WARNING-DAG: optimization flag '-fgcse' is not supported
372 // CHECK-WARNING-DAG: optimization flag '-fivopts' is not supported
373 // CHECK-WARNING-DAG: optimization flag '-fprefetch-loop-arrays' is not supported
374 // CHECK-WARNING-DAG: optimization flag '-fprofile-correction' is not supported
375 // CHECK-WARNING-DAG: optimization flag '-fprofile-values' is not supported
376 // CHECK-WARNING-DAG: optimization flag '-frounding-math' is not supported
377 // CHECK-WARNING-DAG: optimization flag '-fschedule-insns' is not supported
378 // CHECK-WARNING-DAG: optimization flag '-fsignaling-nans' is not supported
379 // CHECK-WARNING-DAG: optimization flag '-fstrength-reduce' is not supported
380 // CHECK-WARNING-DAG: optimization flag '-ftracer' is not supported
381 // CHECK-WARNING-DAG: optimization flag '-funroll-all-loops' is not supported
382 // CHECK-WARNING-DAG: optimization flag '-funswitch-loops' is not supported
383 // CHECK-WARNING-DAG: unsupported argument '1' to option 'flto='
384 // CHECK-WARNING-DAG: optimization flag '-falign-labels' is not supported
385 // CHECK-WARNING-DAG: optimization flag '-falign-labels=100' is not supported
386 // CHECK-WARNING-DAG: optimization flag '-falign-loops' is not supported
387 // CHECK-WARNING-DAG: optimization flag '-falign-loops=100' is not supported
388 // CHECK-WARNING-DAG: optimization flag '-falign-jumps' is not supported
389 // CHECK-WARNING-DAG: optimization flag '-falign-jumps=100' is not supported
390 // CHECK-WARNING-DAG: optimization flag '-fexcess-precision=100' is not supported
391 // CHECK-WARNING-DAG: optimization flag '-fbranch-count-reg' is not supported
392 // CHECK-WARNING-DAG: optimization flag '-fcaller-saves' is not supported
393 // CHECK-WARNING-DAG: optimization flag '-fno-default-inline' is not supported
394 // CHECK-WARNING-DAG: optimization flag '-fgcse-after-reload' is not supported
395 // CHECK-WARNING-DAG: optimization flag '-fgcse-las' is not supported
396 // CHECK-WARNING-DAG: optimization flag '-fgcse-sm' is not supported
397 // CHECK-WARNING-DAG: optimization flag '-fipa-cp' is not supported
398 // CHECK-WARNING-DAG: optimization flag '-finline-functions-called-once' is not supported
399 // CHECK-WARNING-DAG: optimization flag '-fmodulo-sched' is not supported
400 // CHECK-WARNING-DAG: optimization flag '-fmodulo-sched-allow-regmoves' is not supported
401 // CHECK-WARNING-DAG: optimization flag '-fpeel-loops' is not supported
402 // CHECK-WARNING-DAG: optimization flag '-frename-registers' is not supported
403 // CHECK-WARNING-DAG: optimization flag '-fschedule-insns2' is not supported
404 // CHECK-WARNING-DAG: optimization flag '-fsingle-precision-constant' is not supported
405 // CHECK-WARNING-DAG: optimization flag '-ftree_loop_im' is not supported
406 // CHECK-WARNING-DAG: optimization flag '-ftree_loop_ivcanon' is not supported
407 // CHECK-WARNING-DAG: optimization flag '-ftree_loop_linear' is not supported
408 // CHECK-WARNING-DAG: optimization flag '-funsafe-loop-optimizations' is not supported
409 // CHECK-WARNING-DAG: optimization flag '-fuse-linker-plugin' is not supported
410 // CHECK-WARNING-DAG: optimization flag '-fvect-cost-model' is not supported
411 // CHECK-WARNING-DAG: optimization flag '-fvariable-expansion-in-unroller' is not supported
412 // CHECK-WARNING-DAG: optimization flag '-fweb' is not supported
413 // CHECK-WARNING-DAG: optimization flag '-fwhole-program' is not supported
414 // CHECK-WARNING-DAG: optimization flag '-fcaller-saves' is not supported
415 // CHECK-WARNING-DAG: optimization flag '-freorder-blocks' is not supported
416 // CHECK-WARNING-DAG: optimization flag '-fdelete-null-pointer-checks' is not supported
417 // CHECK-WARNING-DAG: optimization flag '-ffat-lto-objects' is not supported
418 // CHECK-WARNING-DAG: optimization flag '-fmerge-constants' is not supported
419 // CHECK-WARNING-DAG: optimization flag '-finline-small-functions' is not supported
420 // CHECK-WARNING-DAG: optimization flag '-ftree-dce' is not supported
421 // CHECK-WARNING-DAG: optimization flag '-ftree-ter' is not supported
422 // CHECK-WARNING-DAG: optimization flag '-ftree-vrp' is not supported
423 // CHECK-WARNING-DAG: optimization flag '-fno-devirtualize' is not supported
424 // CHECK-WARNING-DAG: optimization flag '-fno-devirtualize-speculatively' is not supported
425
426 // Test that we mute the warning on these
427 // RUN: %clang -### -finline-limit=1000 -Wno-invalid-command-line-argument              \
428 // RUN:     %s 2>&1 | FileCheck --check-prefix=CHECK-NO-WARNING1 %s
429 // RUN: %clang -### -finline-limit -Wno-invalid-command-line-argument                   \
430 // RUN:     %s 2>&1 | FileCheck --check-prefix=CHECK-NO-WARNING2 %s
431 // RUN: %clang -### -finline-limit \
432 // RUN:     -Winvalid-command-line-argument -Wno-ignored-optimization-argument          \
433 // RUN:     %s 2>&1 | FileCheck --check-prefix=CHECK-NO-WARNING2 %s
434 // CHECK-NO-WARNING1-NOT: optimization flag '-finline-limit=1000' is not supported
435 // CHECK-NO-WARNING2-NOT: optimization flag '-finline-limit' is not supported
436
437 // Test that an ignored optimization argument only prints 1 warning,
438 // not both a warning about not claiming the arg, *and* about not supporting
439 // the arg; and that adding -Wno-ignored-optimization silences the warning.
440 //
441 // RUN: %clang -### -fprofile-correction %s 2>&1 \
442 // RUN:   | FileCheck --check-prefix=CHECK-NO-WARNING3 %s
443 // CHECK-NO-WARNING3: optimization flag '-fprofile-correction' is not supported
444 // CHECK-NO-WARNING3-NOT: argument unused
445 // RUN: %clang -### -fprofile-correction -Wno-ignored-optimization-argument %s 2>&1 \
446 // RUN:   | FileCheck --check-prefix=CHECK-NO-WARNING4 %s
447 // CHECK-NO-WARNING4-NOT: not supported
448 // CHECK-NO-WARNING4-NOT: argument unused
449
450 // RUN: %clang -### -S -fsigned-char %s 2>&1 | FileCheck -check-prefix=CHAR-SIGN1 %s
451 // CHAR-SIGN1-NOT: -fno-signed-char
452
453 // RUN: %clang -### -S -funsigned-char %s 2>&1 | FileCheck -check-prefix=CHAR-SIGN2 %s
454 // CHAR-SIGN2: -fno-signed-char
455
456 // RUN: %clang -### -S -fno-signed-char %s 2>&1 | FileCheck -check-prefix=CHAR-SIGN3 %s
457 // CHAR-SIGN3: -fno-signed-char
458
459 // RUN: %clang -### -S -fno-unsigned-char %s 2>&1 | FileCheck -check-prefix=CHAR-SIGN4 %s
460 // CHAR-SIGN4-NOT: -fno-signed-char
461
462 // RUN: %clang -### -fshort-wchar -fno-short-wchar %s 2>&1 | FileCheck -check-prefix=CHECK-WCHAR1 -check-prefix=DELIMITERS %s
463 // RUN: %clang -### -fno-short-wchar -fshort-wchar %s 2>&1 | FileCheck -check-prefix=CHECK-WCHAR2 -check-prefix=DELIMITERS %s
464 // Make sure we don't match the -NOT lines with the linker invocation.
465 // Delimiters match the start of the cc1 and the start of the linker lines
466 // DELIMITERS: {{^ *"}}
467 // CHECK-WCHAR1: -fno-short-wchar
468 // CHECK-WCHAR1-NOT: -fshort-wchar
469 // CHECK-WCHAR2: -fshort-wchar
470 // CHECK-WCHAR2-NOT: -fno-short-wchar
471 // DELIMITERS: {{^ *"}}
472
473 // RUN: %clang -### -fno-experimental-new-pass-manager -fexperimental-new-pass-manager %s 2>&1 | FileCheck --check-prefix=CHECK-PM --check-prefix=CHECK-NEW-PM %s
474 // RUN: %clang -### -fexperimental-new-pass-manager -fno-experimental-new-pass-manager %s 2>&1 | FileCheck --check-prefix=CHECK-PM --check-prefix=CHECK-NO-NEW-PM %s
475 // CHECK-PM-NOT: argument unused
476 // CHECK-NEW-PM: -fexperimental-new-pass-manager
477 // CHECK-NEW-PM-NOT: -fno-experimental-new-pass-manager
478 // CHECK-NO-NEW-PM: -fno-experimental-new-pass-manager
479 // CHECK-NO-NEW-PM-NOT: -fexperimental-new-pass-manager