]>
Commit | Line | Data |
---|---|---|
00243d9a ML |
1 | #!/usr/bin/env python3 |
2 | ||
3 | # Copyright (C) 2020 Free Software Foundation, Inc. | |
4 | # | |
5 | # This file is part of GCC. | |
6 | # | |
7 | # GCC is free software; you can redistribute it and/or modify | |
8 | # it under the terms of the GNU General Public License as published by | |
9 | # the Free Software Foundation; either version 3, or (at your option) | |
10 | # any later version. | |
11 | # | |
12 | # GCC is distributed in the hope that it will be useful, | |
13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | # GNU General Public License for more details. | |
16 | # | |
17 | # You should have received a copy of the GNU General Public License | |
18 | # along with GCC; see the file COPYING. If not, write to | |
19 | # the Free Software Foundation, 51 Franklin Street, Fifth Floor, | |
20 | # Boston, MA 02110-1301, USA. | |
21 | ||
22 | # This script parses a .diff file generated with 'diff -up' or 'diff -cp' | |
23 | # and adds a skeleton ChangeLog file to the file. It does not try to be | |
24 | # too smart when parsing function names, but it produces a reasonable | |
25 | # approximation. | |
26 | # | |
27 | # Author: Martin Liska <mliska@suse.cz> | |
28 | ||
29 | import unittest | |
30 | ||
31 | from mklog import generate_changelog | |
32 | ||
33 | PATCH1 = '''\ | |
34 | diff --git a/gcc/config/riscv/riscv.h b/gcc/config/riscv/riscv.h | |
35 | index 567c23380fe..e6209ede9d6 100644 | |
36 | --- a/gcc/config/riscv/riscv.h | |
37 | +++ b/gcc/config/riscv/riscv.h | |
38 | @@ -920,6 +920,7 @@ extern unsigned riscv_stack_boundary; | |
39 | #define SHIFT_RS1 15 | |
40 | #define SHIFT_IMM 20 | |
41 | #define IMM_BITS 12 | |
42 | +#define C_S_BITS 5 | |
43 | #define C_SxSP_BITS 6 | |
44 | ||
45 | #define IMM_REACH (1LL << IMM_BITS) | |
46 | @@ -929,6 +930,10 @@ extern unsigned riscv_stack_boundary; | |
47 | #define SWSP_REACH (4LL << C_SxSP_BITS) | |
48 | #define SDSP_REACH (8LL << C_SxSP_BITS) | |
49 | ||
50 | +/* This is the maximum value that can be represented in a compressed load/store | |
51 | + offset (an unsigned 5-bit value scaled by 4). */ | |
52 | +#define CSW_MAX_OFFSET ((4LL << C_S_BITS) - 1) & ~3 | |
53 | + | |
54 | /* Called from RISCV_REORG, this is defined in riscv-sr.c. */ | |
55 | ||
56 | extern void riscv_remove_unneeded_save_restore_calls (void); | |
57 | ||
58 | ''' | |
59 | ||
60 | EXPECTED1 = '''\ | |
61 | gcc/ChangeLog: | |
62 | ||
63 | * config/riscv/riscv.h (C_S_BITS): | |
64 | (CSW_MAX_OFFSET): | |
65 | ||
66 | ''' | |
67 | ||
68 | PATCH2 = '''\ | |
69 | diff --git a/gcc/targhooks.h b/gcc/targhooks.h | |
70 | index 9704d23f1db..b572a36e8cf 100644 | |
71 | --- a/gcc/targhooks.h | |
72 | +++ b/gcc/targhooks.h | |
73 | @@ -120,7 +120,7 @@ extern bool default_empty_mask_is_expensive (unsigned); | |
74 | extern void *default_init_cost (class loop *); | |
75 | extern unsigned default_add_stmt_cost (class vec_info *, void *, int, | |
76 | enum vect_cost_for_stmt, | |
77 | - class _stmt_vec_info *, int, | |
78 | + class _stmt_vec_info *, tree, int, | |
79 | enum vect_cost_model_location); | |
80 | extern void default_finish_cost (void *, unsigned *, unsigned *, unsigned *); | |
81 | extern void default_destroy_cost_data (void *); | |
82 | @@ -186,6 +186,7 @@ extern tree default_emutls_var_init (tree, tree, tree); | |
83 | extern unsigned int default_hard_regno_nregs (unsigned int, machine_mode); | |
84 | extern bool default_hard_regno_scratch_ok (unsigned int); | |
85 | extern bool default_mode_dependent_address_p (const_rtx, addr_space_t); | |
86 | +extern bool default_new_address_profitable_p (rtx, rtx_insn *, rtx); | |
87 | extern bool default_target_option_valid_attribute_p (tree, tree, tree, int); | |
88 | extern bool default_target_option_pragma_parse (tree, tree); | |
89 | extern bool default_target_can_inline_p (tree, tree); | |
90 | ||
91 | ''' | |
92 | ||
93 | EXPECTED2 = '''\ | |
94 | gcc/ChangeLog: | |
95 | ||
96 | * targhooks.h (default_add_stmt_cost): | |
97 | (default_new_address_profitable_p): | |
98 | ||
99 | ''' | |
100 | ||
101 | PATCH3 = '''\ | |
102 | diff --git a/libcpp/include/cpplib.h b/libcpp/include/cpplib.h | |
103 | index 2b1e33f94ae..7f47402f9b9 100644 | |
104 | --- a/libcpp/include/cpplib.h | |
105 | +++ b/libcpp/include/cpplib.h | |
106 | @@ -173,7 +173,7 @@ enum c_lang {CLK_GNUC89 = 0, CLK_GNUC99, CLK_GNUC11, CLK_GNUC17, CLK_GNUC2X, | |
107 | CLK_STDC2X, | |
108 | CLK_GNUCXX, CLK_CXX98, CLK_GNUCXX11, CLK_CXX11, | |
109 | CLK_GNUCXX14, CLK_CXX14, CLK_GNUCXX17, CLK_CXX17, | |
110 | - CLK_GNUCXX2A, CLK_CXX2A, CLK_ASM}; | |
111 | + CLK_GNUCXX20, CLK_CXX20, CLK_ASM}; | |
112 | ||
113 | /* Payload of a NUMBER, STRING, CHAR or COMMENT token. */ | |
114 | struct GTY(()) cpp_string { | |
115 | @@ -484,7 +484,7 @@ struct cpp_options | |
116 | /* Nonzero for C2X decimal floating-point constants. */ | |
117 | unsigned char dfp_constants; | |
118 | ||
119 | - /* Nonzero for C++2a __VA_OPT__ feature. */ | |
120 | + /* Nonzero for C++20 __VA_OPT__ feature. */ | |
121 | unsigned char va_opt; | |
122 | ||
123 | /* Nonzero for the '::' token. */ | |
124 | ||
125 | ''' | |
126 | ||
127 | EXPECTED3 = '''\ | |
128 | libcpp/ChangeLog: | |
129 | ||
130 | * include/cpplib.h (enum c_lang): | |
131 | (struct cpp_options): | |
132 | ||
133 | ''' | |
134 | ||
135 | EXPECTED3B = '''\ | |
136 | libcpp/ChangeLog: | |
137 | ||
138 | * include/cpplib.h: | |
139 | ||
140 | ''' | |
141 | ||
142 | PATCH4 = '''\ | |
143 | diff --git a/gcc/ipa-icf.c b/gcc/ipa-icf.c | |
144 | index aab79492357..f0df1002488 100644 | |
145 | --- a/gcc/ipa-icf.c | |
146 | +++ b/gcc/ipa-icf.c | |
147 | @@ -1,5 +1,7 @@ | |
148 | ||
149 | ||
150 | + | |
151 | + | |
152 | /* Interprocedural Identical Code Folding pass | |
153 | Copyright (C) 2014-2020 Free Software Foundation, Inc. | |
154 | ||
155 | diff --git a/gcc/testsuite/gcc.dg/pr32374.c b/gcc/testsuite/gcc.dg/pr32374.c | |
156 | deleted file mode 100644 | |
157 | index de15d559f5b..00000000000 | |
158 | --- a/gcc/testsuite/gcc.dg/pr32374.c | |
159 | +++ /dev/null | |
160 | @@ -1,20 +0,0 @@ | |
161 | -/* { dg-do compile } */ | |
162 | -/* { dg-options "-O2" } */ | |
163 | - | |
164 | -extern int *stderr; | |
165 | - | |
166 | -void f (int *, const char *, ...); | |
167 | - | |
168 | -void g (const char *conf_name) | |
169 | -{ | |
170 | - typedef struct | |
171 | - { | |
172 | - const char *label; | |
173 | - const int value; | |
174 | - } Section; | |
175 | - | |
176 | - const Section sections[2] = { {"", 0}, {"", 1} }; | |
177 | - | |
178 | - f (stderr, "", "", conf_name, 0, sections[0]); | |
179 | - f (stderr, "", "", conf_name, 0, sections[0]); | |
180 | -} | |
181 | diff --git a/gcc/testsuite/gcc.dg/pr40209.c b/gcc/testsuite/gcc.dg/pr40209.c | |
182 | index 4e77df5c2e6..c23d69d1f1b 100644 | |
183 | --- a/gcc/testsuite/gcc.dg/pr40209.c | |
184 | +++ b/gcc/testsuite/gcc.dg/pr40209.c | |
185 | @@ -1,6 +1,8 @@ | |
186 | /* { dg-do compile } */ | |
187 | /* { dg-options "-O2 -fprofile-use -fopt-info -Wno-missing-profile" } */ | |
188 | ||
189 | + | |
190 | + | |
191 | void process(const char *s); | |
192 | ||
193 | struct BaseHolder { | |
194 | diff --git a/gcc/testsuite/gcc.dg/pr50209.c b/gcc/testsuite/gcc.dg/pr50209.c | |
195 | new file mode 100644 | |
196 | index 00000000000..b28b04f6431 | |
197 | --- /dev/null | |
198 | +++ b/gcc/testsuite/gcc.dg/pr50209.c | |
199 | @@ -0,0 +1,3 @@ | |
200 | + | |
201 | + | |
202 | + | |
203 | diff --git a/gcc/testsuite/gcc.dg/pr63567-1.c b/gcc/testsuite/gcc.dg/pr63567-1.c | |
204 | index 97da171563e..00c5ecc11fa 100644 | |
205 | --- a/gcc/testsuite/gcc.dg/pr63567-1.c | |
206 | +++ b/gcc/testsuite/gcc.dg/pr63567-1.c | |
207 | @@ -1,3 +1,4 @@ | |
208 | + | |
209 | /* PR c/63567 */ | |
210 | /* { dg-do compile } */ | |
211 | /* { dg-options "" } */ | |
212 | diff --git a/gcc/varasm.c b/gcc/varasm.c | |
213 | index f062e48071f..fd3c7ca8cf3 100644 | |
214 | --- a/gcc/varasm.c | |
215 | +++ b/gcc/varasm.c | |
216 | @@ -1,3 +1,5 @@ | |
217 | + | |
218 | + | |
219 | /* Output variables, constants and external declarations, for GNU compiler. | |
220 | Copyright (C) 1987-2020 Free Software Foundation, Inc. | |
221 | ||
222 | diff --git a/libssp/gets-chk.c b/libssp/gets-chk.c | |
223 | index 4ad78c1f77b..6687b368038 100644 | |
224 | --- a/libssp/gets-chk.c | |
225 | +++ b/libssp/gets-chk.c | |
226 | @@ -32,6 +32,8 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see | |
227 | <http://www.gnu.org/licenses/>. */ | |
228 | ||
229 | ||
230 | + | |
231 | + | |
232 | #include "config.h" | |
233 | #include <ssp/ssp.h> | |
234 | #include <stdarg.h> | |
235 | ''' | |
236 | ||
237 | EXPECTED4 = '''\ | |
238 | gcc/ChangeLog: | |
239 | ||
240 | * ipa-icf.c: | |
241 | * varasm.c: | |
242 | ||
243 | libssp/ChangeLog: | |
244 | ||
245 | * gets-chk.c: | |
246 | ||
247 | gcc/testsuite/ChangeLog: | |
248 | ||
249 | * gcc.dg/pr40209.c: | |
250 | * gcc.dg/pr63567-1.c: | |
251 | * gcc.dg/pr32374.c: Removed. | |
252 | * gcc.dg/pr50209.c: New test. | |
253 | ||
254 | ''' | |
255 | ||
256 | PATCH5 = '''\ | |
257 | diff --git a/gcc/testsuite/gcc.target/i386/pr95046-6.c b/gcc/testsuite/gcc.target/i386/pr95046-6.c | |
258 | new file mode 100644 | |
259 | index 00000000000..dcc8999c446 | |
260 | --- /dev/null | |
261 | +++ b/gcc/testsuite/gcc.target/i386/pr95046-6.c | |
262 | @@ -0,0 +1,44 @@ | |
263 | +/* PR target/95046 */ | |
264 | +/* { dg-do compile { target { ! ia32 } } } */ | |
265 | +/* { dg-options "-O3 -mavx512vl" } */ | |
266 | + | |
267 | + | |
268 | +double r[2]; | |
269 | +int s[2]; | |
270 | +unsigned int u[2]; | |
271 | + | |
272 | +void | |
273 | +test_float (void) | |
274 | +{ | |
275 | + for (int i = 0; i < 2; i++) | |
276 | + r[i] = s[i]; | |
277 | +} | |
278 | + | |
279 | +/* { dg-final { scan-assembler "\tvcvtdq2pd" } } */ | |
280 | + | |
281 | +void | |
282 | +test_ufloat (void) | |
283 | +{ | |
284 | + for (int i = 0; i < 2; i++) | |
285 | + r[i] = u[i]; | |
286 | +} | |
287 | + | |
288 | +/* { dg-final { scan-assembler "\tvcvtudq2pd" } } */ | |
289 | + | |
290 | +void | |
291 | +test_fix (void) | |
292 | +{ | |
293 | + for (int i = 0; i < 2; i++) | |
294 | + s[i] = r[i]; | |
295 | +} | |
296 | + | |
297 | +/* { dg-final { scan-assembler "\tvcvttpd2dqx" } } */ | |
298 | + | |
299 | +void | |
300 | +test_ufix (void) | |
301 | +{ | |
302 | + for (int i = 0; i < 2; i++) | |
303 | + u[i] = r[i]; | |
304 | +} | |
305 | + | |
306 | +/* { dg-final { scan-assembler "\tvcvttpd2udqx" } } */ | |
307 | -- | |
308 | 2.26.2 | |
309 | ||
310 | ''' | |
311 | ||
312 | EXPECTED5 = '''\ | |
313 | PR target/95046 - Vectorize V2SFmode operations | |
314 | ||
315 | gcc/testsuite/ChangeLog: | |
316 | ||
317 | PR target/95046 | |
318 | * gcc.target/i386/pr95046-6.c: New test. | |
319 | ||
320 | ''' | |
321 | ||
4f85a52c ML |
322 | PATCH6 = '''\ |
323 | diff --git a/gcc/cgraph.h b/gcc/cgraph.h | |
324 | index 5ddeb65269b..cfae6e91da9 100644 | |
325 | --- a/gcc/cgraph.h | |
326 | +++ b/gcc/cgraph.h | |
327 | @@ -937,7 +937,8 @@ struct GTY((tag ("SYMTAB_FUNCTION"))) cgraph_node : public symtab_node | |
328 | split_part (false), indirect_call_target (false), local (false), | |
329 | versionable (false), can_change_signature (false), | |
330 | redefined_extern_inline (false), tm_may_enter_irr (false), | |
331 | - ipcp_clone (false), m_uid (uid), m_summary_id (-1) | |
332 | + ipcp_clone (false), declare_variant_alt (false), | |
333 | + calls_declare_variant_alt (false), m_uid (uid), m_summary_id (-1) | |
334 | {} | |
335 | ||
336 | /* Remove the node from cgraph and all inline clones inlined into it. | |
337 | ||
338 | ''' | |
339 | ||
340 | EXPECTED6 = '''\ | |
341 | gcc/ChangeLog: | |
342 | ||
343 | * cgraph.h (struct cgraph_node): | |
344 | ||
345 | ''' | |
346 | ||
e7c7cdc5 ML |
347 | PATCH7 = '''\ |
348 | diff --git a/gcc/testsuite/g++.dg/DRs/dr2237.C b/gcc/testsuite/g++.dg/DRs/dr2237.C | |
349 | new file mode 100644 | |
350 | index 00000000000..f3d6d11e61e | |
351 | --- /dev/null | |
352 | +++ b/gcc/testsuite/g++.dg/DRs/dr2237.C | |
353 | @@ -0,0 +1,18 @@ | |
354 | +// DR 2237 - Can a template-id name a constructor? | |
355 | + | |
356 | +template<class T> | |
357 | +struct X { | |
358 | + X<T>(); // { dg-error "expected" "" { target c++20 } } | |
359 | + X(int); // OK, injected-class-name used | |
360 | + ~X<T>(); // { dg-error "template-id not allowed for destructor" "" { target c++20 } } | |
361 | +}; | |
362 | + | |
363 | +// ill-formed since DR1435 | |
364 | +template<typename T> X<T>::X<T>() {} // { dg-error "names the constructor|as no template constructors" } | |
365 | +template<typename T> X<T>::~X<T>() {} // { dg-error "template-id not allowed for destructor" "" { target c++20 } } | |
366 | + | |
367 | +struct Q { | |
368 | + // ill-formed since DR1435 | |
369 | + template<typename T> friend X<T>::X<T>(); // { dg-error "names the constructor|as no template constructors" } | |
370 | + template<typename T> friend X<T>::~X<T>(); // { dg-error "template-id not allowed for destructor" "" { target c++20 } } | |
371 | +}; | |
372 | ''' | |
373 | ||
374 | EXPECTED7 = '''\ | |
375 | gcc/testsuite/ChangeLog: | |
376 | ||
377 | DR 2237 | |
378 | * g++.dg/DRs/dr2237.C: New test. | |
379 | ||
380 | ''' | |
381 | ||
00243d9a ML |
382 | class TestMklog(unittest.TestCase): |
383 | def test_macro_definition(self): | |
384 | changelog = generate_changelog(PATCH1) | |
385 | assert changelog == EXPECTED1 | |
386 | ||
387 | def test_changed_argument(self): | |
388 | changelog = generate_changelog(PATCH2) | |
389 | assert changelog == EXPECTED2 | |
390 | ||
391 | def test_enum_and_struct(self): | |
392 | changelog = generate_changelog(PATCH3) | |
393 | assert changelog == EXPECTED3 | |
394 | ||
395 | def test_no_function(self): | |
396 | changelog = generate_changelog(PATCH3, True) | |
397 | assert changelog == EXPECTED3B | |
398 | ||
399 | def test_sorting(self): | |
400 | changelog = generate_changelog(PATCH4) | |
401 | assert changelog == EXPECTED4 | |
402 | ||
403 | def test_pr_bugzilla_download(self): | |
404 | changelog = generate_changelog(PATCH5, fill_pr_titles=True) | |
405 | assert changelog == EXPECTED5 | |
4f85a52c ML |
406 | |
407 | def test_gty_in_struct(self): | |
408 | changelog = generate_changelog(PATCH6, fill_pr_titles=True) | |
409 | assert changelog == EXPECTED6 | |
e7c7cdc5 ML |
410 | |
411 | def test_dr_detection_in_test_case(self): | |
412 | changelog = generate_changelog(PATCH7) | |
413 | assert changelog == EXPECTED7 |