]>
Commit | Line | Data |
---|---|---|
00243d9a ML |
1 | #!/usr/bin/env python3 |
2 | ||
83ffe9cd | 3 | # Copyright (C) 2020-2023 Free Software Foundation, Inc. |
00243d9a ML |
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 | ||
eb78da45 ML |
33 | import unidiff |
34 | ||
35 | unidiff_supports_renaming = hasattr(unidiff.PatchedFile(), 'is_rename') | |
36 | ||
37 | ||
00243d9a ML |
38 | PATCH1 = '''\ |
39 | diff --git a/gcc/config/riscv/riscv.h b/gcc/config/riscv/riscv.h | |
40 | index 567c23380fe..e6209ede9d6 100644 | |
41 | --- a/gcc/config/riscv/riscv.h | |
42 | +++ b/gcc/config/riscv/riscv.h | |
43 | @@ -920,6 +920,7 @@ extern unsigned riscv_stack_boundary; | |
44 | #define SHIFT_RS1 15 | |
45 | #define SHIFT_IMM 20 | |
46 | #define IMM_BITS 12 | |
47 | +#define C_S_BITS 5 | |
48 | #define C_SxSP_BITS 6 | |
49 | ||
50 | #define IMM_REACH (1LL << IMM_BITS) | |
51 | @@ -929,6 +930,10 @@ extern unsigned riscv_stack_boundary; | |
52 | #define SWSP_REACH (4LL << C_SxSP_BITS) | |
53 | #define SDSP_REACH (8LL << C_SxSP_BITS) | |
54 | ||
55 | +/* This is the maximum value that can be represented in a compressed load/store | |
56 | + offset (an unsigned 5-bit value scaled by 4). */ | |
57 | +#define CSW_MAX_OFFSET ((4LL << C_S_BITS) - 1) & ~3 | |
58 | + | |
59 | /* Called from RISCV_REORG, this is defined in riscv-sr.c. */ | |
60 | ||
61 | extern void riscv_remove_unneeded_save_restore_calls (void); | |
62 | ||
63 | ''' | |
64 | ||
65 | EXPECTED1 = '''\ | |
66 | gcc/ChangeLog: | |
67 | ||
68 | * config/riscv/riscv.h (C_S_BITS): | |
69 | (CSW_MAX_OFFSET): | |
70 | ||
71 | ''' | |
72 | ||
73 | PATCH2 = '''\ | |
74 | diff --git a/gcc/targhooks.h b/gcc/targhooks.h | |
75 | index 9704d23f1db..b572a36e8cf 100644 | |
76 | --- a/gcc/targhooks.h | |
77 | +++ b/gcc/targhooks.h | |
78 | @@ -120,7 +120,7 @@ extern bool default_empty_mask_is_expensive (unsigned); | |
79 | extern void *default_init_cost (class loop *); | |
80 | extern unsigned default_add_stmt_cost (class vec_info *, void *, int, | |
81 | enum vect_cost_for_stmt, | |
82 | - class _stmt_vec_info *, int, | |
83 | + class _stmt_vec_info *, tree, int, | |
84 | enum vect_cost_model_location); | |
85 | extern void default_finish_cost (void *, unsigned *, unsigned *, unsigned *); | |
86 | extern void default_destroy_cost_data (void *); | |
87 | @@ -186,6 +186,7 @@ extern tree default_emutls_var_init (tree, tree, tree); | |
88 | extern unsigned int default_hard_regno_nregs (unsigned int, machine_mode); | |
89 | extern bool default_hard_regno_scratch_ok (unsigned int); | |
90 | extern bool default_mode_dependent_address_p (const_rtx, addr_space_t); | |
91 | +extern bool default_new_address_profitable_p (rtx, rtx_insn *, rtx); | |
92 | extern bool default_target_option_valid_attribute_p (tree, tree, tree, int); | |
93 | extern bool default_target_option_pragma_parse (tree, tree); | |
94 | extern bool default_target_can_inline_p (tree, tree); | |
95 | ||
96 | ''' | |
97 | ||
98 | EXPECTED2 = '''\ | |
99 | gcc/ChangeLog: | |
100 | ||
101 | * targhooks.h (default_add_stmt_cost): | |
102 | (default_new_address_profitable_p): | |
103 | ||
104 | ''' | |
105 | ||
106 | PATCH3 = '''\ | |
107 | diff --git a/libcpp/include/cpplib.h b/libcpp/include/cpplib.h | |
108 | index 2b1e33f94ae..7f47402f9b9 100644 | |
109 | --- a/libcpp/include/cpplib.h | |
110 | +++ b/libcpp/include/cpplib.h | |
111 | @@ -173,7 +173,7 @@ enum c_lang {CLK_GNUC89 = 0, CLK_GNUC99, CLK_GNUC11, CLK_GNUC17, CLK_GNUC2X, | |
112 | CLK_STDC2X, | |
113 | CLK_GNUCXX, CLK_CXX98, CLK_GNUCXX11, CLK_CXX11, | |
114 | CLK_GNUCXX14, CLK_CXX14, CLK_GNUCXX17, CLK_CXX17, | |
115 | - CLK_GNUCXX2A, CLK_CXX2A, CLK_ASM}; | |
116 | + CLK_GNUCXX20, CLK_CXX20, CLK_ASM}; | |
117 | ||
118 | /* Payload of a NUMBER, STRING, CHAR or COMMENT token. */ | |
119 | struct GTY(()) cpp_string { | |
120 | @@ -484,7 +484,7 @@ struct cpp_options | |
121 | /* Nonzero for C2X decimal floating-point constants. */ | |
122 | unsigned char dfp_constants; | |
123 | ||
124 | - /* Nonzero for C++2a __VA_OPT__ feature. */ | |
125 | + /* Nonzero for C++20 __VA_OPT__ feature. */ | |
126 | unsigned char va_opt; | |
127 | ||
128 | /* Nonzero for the '::' token. */ | |
129 | ||
130 | ''' | |
131 | ||
132 | EXPECTED3 = '''\ | |
133 | libcpp/ChangeLog: | |
134 | ||
135 | * include/cpplib.h (enum c_lang): | |
136 | (struct cpp_options): | |
137 | ||
138 | ''' | |
139 | ||
140 | EXPECTED3B = '''\ | |
141 | libcpp/ChangeLog: | |
142 | ||
143 | * include/cpplib.h: | |
144 | ||
145 | ''' | |
146 | ||
147 | PATCH4 = '''\ | |
148 | diff --git a/gcc/ipa-icf.c b/gcc/ipa-icf.c | |
149 | index aab79492357..f0df1002488 100644 | |
150 | --- a/gcc/ipa-icf.c | |
151 | +++ b/gcc/ipa-icf.c | |
152 | @@ -1,5 +1,7 @@ | |
153 | ||
154 | ||
155 | + | |
156 | + | |
157 | /* Interprocedural Identical Code Folding pass | |
83ffe9cd | 158 | Copyright (C) 2014-2023 Free Software Foundation, Inc. |
00243d9a ML |
159 | |
160 | diff --git a/gcc/testsuite/gcc.dg/pr32374.c b/gcc/testsuite/gcc.dg/pr32374.c | |
161 | deleted file mode 100644 | |
162 | index de15d559f5b..00000000000 | |
163 | --- a/gcc/testsuite/gcc.dg/pr32374.c | |
164 | +++ /dev/null | |
165 | @@ -1,20 +0,0 @@ | |
166 | -/* { dg-do compile } */ | |
167 | -/* { dg-options "-O2" } */ | |
168 | - | |
169 | -extern int *stderr; | |
170 | - | |
171 | -void f (int *, const char *, ...); | |
172 | - | |
173 | -void g (const char *conf_name) | |
174 | -{ | |
175 | - typedef struct | |
176 | - { | |
177 | - const char *label; | |
178 | - const int value; | |
179 | - } Section; | |
180 | - | |
181 | - const Section sections[2] = { {"", 0}, {"", 1} }; | |
182 | - | |
183 | - f (stderr, "", "", conf_name, 0, sections[0]); | |
184 | - f (stderr, "", "", conf_name, 0, sections[0]); | |
185 | -} | |
186 | diff --git a/gcc/testsuite/gcc.dg/pr40209.c b/gcc/testsuite/gcc.dg/pr40209.c | |
187 | index 4e77df5c2e6..c23d69d1f1b 100644 | |
188 | --- a/gcc/testsuite/gcc.dg/pr40209.c | |
189 | +++ b/gcc/testsuite/gcc.dg/pr40209.c | |
190 | @@ -1,6 +1,8 @@ | |
191 | /* { dg-do compile } */ | |
192 | /* { dg-options "-O2 -fprofile-use -fopt-info -Wno-missing-profile" } */ | |
193 | ||
194 | + | |
195 | + | |
196 | void process(const char *s); | |
197 | ||
198 | struct BaseHolder { | |
199 | diff --git a/gcc/testsuite/gcc.dg/pr50209.c b/gcc/testsuite/gcc.dg/pr50209.c | |
200 | new file mode 100644 | |
201 | index 00000000000..b28b04f6431 | |
202 | --- /dev/null | |
203 | +++ b/gcc/testsuite/gcc.dg/pr50209.c | |
204 | @@ -0,0 +1,3 @@ | |
205 | + | |
206 | + | |
207 | + | |
208 | diff --git a/gcc/testsuite/gcc.dg/pr63567-1.c b/gcc/testsuite/gcc.dg/pr63567-1.c | |
209 | index 97da171563e..00c5ecc11fa 100644 | |
210 | --- a/gcc/testsuite/gcc.dg/pr63567-1.c | |
211 | +++ b/gcc/testsuite/gcc.dg/pr63567-1.c | |
212 | @@ -1,3 +1,4 @@ | |
213 | + | |
214 | /* PR c/63567 */ | |
215 | /* { dg-do compile } */ | |
216 | /* { dg-options "" } */ | |
217 | diff --git a/gcc/varasm.c b/gcc/varasm.c | |
218 | index f062e48071f..fd3c7ca8cf3 100644 | |
219 | --- a/gcc/varasm.c | |
220 | +++ b/gcc/varasm.c | |
221 | @@ -1,3 +1,5 @@ | |
222 | + | |
223 | + | |
224 | /* Output variables, constants and external declarations, for GNU compiler. | |
83ffe9cd | 225 | Copyright (C) 1987-2023 Free Software Foundation, Inc. |
00243d9a ML |
226 | |
227 | diff --git a/libssp/gets-chk.c b/libssp/gets-chk.c | |
228 | index 4ad78c1f77b..6687b368038 100644 | |
229 | --- a/libssp/gets-chk.c | |
230 | +++ b/libssp/gets-chk.c | |
231 | @@ -32,6 +32,8 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see | |
232 | <http://www.gnu.org/licenses/>. */ | |
233 | ||
234 | ||
235 | + | |
236 | + | |
237 | #include "config.h" | |
238 | #include <ssp/ssp.h> | |
239 | #include <stdarg.h> | |
240 | ''' | |
241 | ||
242 | EXPECTED4 = '''\ | |
edf0c3ff TB |
243 | |
244 | PR 50209 | |
245 | ||
00243d9a ML |
246 | gcc/ChangeLog: |
247 | ||
248 | * ipa-icf.c: | |
249 | * varasm.c: | |
250 | ||
251 | libssp/ChangeLog: | |
252 | ||
253 | * gets-chk.c: | |
254 | ||
255 | gcc/testsuite/ChangeLog: | |
256 | ||
257 | * gcc.dg/pr40209.c: | |
258 | * gcc.dg/pr63567-1.c: | |
259 | * gcc.dg/pr32374.c: Removed. | |
260 | * gcc.dg/pr50209.c: New test. | |
261 | ||
262 | ''' | |
263 | ||
264 | PATCH5 = '''\ | |
265 | diff --git a/gcc/testsuite/gcc.target/i386/pr95046-6.c b/gcc/testsuite/gcc.target/i386/pr95046-6.c | |
266 | new file mode 100644 | |
267 | index 00000000000..dcc8999c446 | |
268 | --- /dev/null | |
269 | +++ b/gcc/testsuite/gcc.target/i386/pr95046-6.c | |
270 | @@ -0,0 +1,44 @@ | |
271 | +/* PR target/95046 */ | |
272 | +/* { dg-do compile { target { ! ia32 } } } */ | |
273 | +/* { dg-options "-O3 -mavx512vl" } */ | |
274 | + | |
275 | + | |
276 | +double r[2]; | |
277 | +int s[2]; | |
278 | +unsigned int u[2]; | |
279 | + | |
280 | +void | |
281 | +test_float (void) | |
282 | +{ | |
283 | + for (int i = 0; i < 2; i++) | |
284 | + r[i] = s[i]; | |
285 | +} | |
286 | + | |
287 | +/* { dg-final { scan-assembler "\tvcvtdq2pd" } } */ | |
288 | + | |
289 | +void | |
290 | +test_ufloat (void) | |
291 | +{ | |
292 | + for (int i = 0; i < 2; i++) | |
293 | + r[i] = u[i]; | |
294 | +} | |
295 | + | |
296 | +/* { dg-final { scan-assembler "\tvcvtudq2pd" } } */ | |
297 | + | |
298 | +void | |
299 | +test_fix (void) | |
300 | +{ | |
301 | + for (int i = 0; i < 2; i++) | |
302 | + s[i] = r[i]; | |
303 | +} | |
304 | + | |
305 | +/* { dg-final { scan-assembler "\tvcvttpd2dqx" } } */ | |
306 | + | |
307 | +void | |
308 | +test_ufix (void) | |
309 | +{ | |
310 | + for (int i = 0; i < 2; i++) | |
311 | + u[i] = r[i]; | |
312 | +} | |
313 | + | |
314 | +/* { dg-final { scan-assembler "\tvcvttpd2udqx" } } */ | |
315 | -- | |
316 | 2.26.2 | |
317 | ||
318 | ''' | |
319 | ||
320 | EXPECTED5 = '''\ | |
321 | PR target/95046 - Vectorize V2SFmode operations | |
322 | ||
fef084dc ML |
323 | PR target/95046 |
324 | ||
00243d9a ML |
325 | gcc/testsuite/ChangeLog: |
326 | ||
00243d9a ML |
327 | * gcc.target/i386/pr95046-6.c: New test. |
328 | ||
329 | ''' | |
330 | ||
4f85a52c ML |
331 | PATCH6 = '''\ |
332 | diff --git a/gcc/cgraph.h b/gcc/cgraph.h | |
333 | index 5ddeb65269b..cfae6e91da9 100644 | |
334 | --- a/gcc/cgraph.h | |
335 | +++ b/gcc/cgraph.h | |
336 | @@ -937,7 +937,8 @@ struct GTY((tag ("SYMTAB_FUNCTION"))) cgraph_node : public symtab_node | |
337 | split_part (false), indirect_call_target (false), local (false), | |
338 | versionable (false), can_change_signature (false), | |
339 | redefined_extern_inline (false), tm_may_enter_irr (false), | |
340 | - ipcp_clone (false), m_uid (uid), m_summary_id (-1) | |
341 | + ipcp_clone (false), declare_variant_alt (false), | |
342 | + calls_declare_variant_alt (false), m_uid (uid), m_summary_id (-1) | |
343 | {} | |
344 | ||
345 | /* Remove the node from cgraph and all inline clones inlined into it. | |
346 | ||
347 | ''' | |
348 | ||
349 | EXPECTED6 = '''\ | |
350 | gcc/ChangeLog: | |
351 | ||
352 | * cgraph.h (struct cgraph_node): | |
353 | ||
354 | ''' | |
355 | ||
e7c7cdc5 ML |
356 | PATCH7 = '''\ |
357 | diff --git a/gcc/testsuite/g++.dg/DRs/dr2237.C b/gcc/testsuite/g++.dg/DRs/dr2237.C | |
358 | new file mode 100644 | |
359 | index 00000000000..f3d6d11e61e | |
360 | --- /dev/null | |
361 | +++ b/gcc/testsuite/g++.dg/DRs/dr2237.C | |
362 | @@ -0,0 +1,18 @@ | |
363 | +// DR 2237 - Can a template-id name a constructor? | |
364 | + | |
365 | +template<class T> | |
366 | +struct X { | |
367 | + X<T>(); // { dg-error "expected" "" { target c++20 } } | |
368 | + X(int); // OK, injected-class-name used | |
369 | + ~X<T>(); // { dg-error "template-id not allowed for destructor" "" { target c++20 } } | |
370 | +}; | |
371 | + | |
372 | +// ill-formed since DR1435 | |
373 | +template<typename T> X<T>::X<T>() {} // { dg-error "names the constructor|as no template constructors" } | |
374 | +template<typename T> X<T>::~X<T>() {} // { dg-error "template-id not allowed for destructor" "" { target c++20 } } | |
375 | + | |
376 | +struct Q { | |
377 | + // ill-formed since DR1435 | |
378 | + template<typename T> friend X<T>::X<T>(); // { dg-error "names the constructor|as no template constructors" } | |
379 | + template<typename T> friend X<T>::~X<T>(); // { dg-error "template-id not allowed for destructor" "" { target c++20 } } | |
380 | +}; | |
381 | ''' | |
382 | ||
383 | EXPECTED7 = '''\ | |
e7c7cdc5 ML |
384 | |
385 | DR 2237 | |
fef084dc ML |
386 | |
387 | gcc/testsuite/ChangeLog: | |
388 | ||
e7c7cdc5 ML |
389 | * g++.dg/DRs/dr2237.C: New test. |
390 | ||
391 | ''' | |
392 | ||
eb78da45 ML |
393 | PATCH8 = '''\ |
394 | diff --git a/gcc/ipa-icf.c b/gcc/ipa-icf2.c | |
395 | similarity index 100% | |
396 | rename from gcc/ipa-icf.c | |
397 | rename to gcc/ipa-icf2.c | |
398 | ''' | |
399 | ||
400 | EXPECTED8 = '''\ | |
401 | gcc/ChangeLog: | |
402 | ||
403 | * ipa-icf.c: Moved to... | |
404 | * ipa-icf2.c: ...here. | |
405 | ||
406 | ''' | |
407 | ||
a2d04f3d ML |
408 | PATCH9 = '''\ |
409 | diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md | |
410 | index 2a260c1cfbd..7f03fc491c3 100644 | |
411 | --- a/gcc/config/i386/sse.md | |
412 | +++ b/gcc/config/i386/sse.md | |
413 | @@ -17611,6 +17611,23 @@ (define_insn "avx2_<code>v16qiv16hi2<mask_name>" | |
414 | (set_attr "prefix" "maybe_evex") | |
415 | (set_attr "mode" "OI")]) | |
416 | ||
417 | +(define_insn_and_split "*avx2_zero_extendv16qiv16hi2_1" | |
418 | + [(set (match_operand:V32QI 0 "register_operand" "=v") | |
419 | + (vec_select:V32QI | |
420 | + (vec_concat:V64QI | |
421 | + (match_operand:V32QI 1 "nonimmediate_operand" "vm") | |
422 | + (match_operand:V32QI 2 "const0_operand" "C")) | |
423 | + (match_parallel 3 "pmovzx_parallel" | |
424 | + [(match_operand 4 "const_int_operand" "n")])))] | |
425 | + "TARGET_AVX2" | |
426 | + "#" | |
427 | + "&& reload_completed" | |
428 | + [(set (match_dup 0) (zero_extend:V16HI (match_dup 1)))] | |
429 | +{ | |
430 | + operands[0] = lowpart_subreg (V16HImode, operands[0], V32QImode); | |
431 | + operands[1] = lowpart_subreg (V16QImode, operands[1], V32QImode); | |
432 | +}) | |
433 | + | |
434 | (define_expand "<insn>v16qiv16hi2" | |
435 | [(set (match_operand:V16HI 0 "register_operand") | |
436 | (any_extend:V16HI | |
437 | ''' | |
438 | ||
439 | EXPECTED9 = '''\ | |
440 | gcc/ChangeLog: | |
441 | ||
442 | * config/i386/sse.md (*avx2_zero_extendv16qiv16hi2_1): | |
443 | ||
444 | ''' | |
445 | ||
b838641b ML |
446 | PATCH10 = '''\ |
447 | diff --git a/libgomp/doc/the-libgomp-abi/implementing-firstprivate-lastprivate-copyin-and-copyprivate-clauses.rst b/libgomp/doc/the-libgomp-abi/implementing-firstprivate-lastprivate-copyin-and-copyprivate-clauses.rst | |
448 | new file mode 100644 | |
449 | index 00000000000..ad3c6d856fc | |
450 | --- /dev/null | |
451 | +++ b/libgomp/doc/the-libgomp-abi/implementing-firstprivate-lastprivate-copyin-and-copyprivate-clauses.rst | |
452 | @@ -0,0 +1,3 @@ | |
453 | + | |
454 | + | |
455 | + | |
456 | ||
457 | ''' | |
458 | ||
459 | EXPECTED10 = '''\ | |
460 | libgomp/ChangeLog: | |
461 | ||
462 | * doc/the-libgomp-abi/implementing-firstprivate-lastprivate-copyin-and-copyprivate-clauses.rst: | |
463 | New file. | |
464 | ||
465 | ''' | |
466 | ||
00243d9a ML |
467 | class TestMklog(unittest.TestCase): |
468 | def test_macro_definition(self): | |
469 | changelog = generate_changelog(PATCH1) | |
470 | assert changelog == EXPECTED1 | |
471 | ||
472 | def test_changed_argument(self): | |
473 | changelog = generate_changelog(PATCH2) | |
474 | assert changelog == EXPECTED2 | |
475 | ||
476 | def test_enum_and_struct(self): | |
477 | changelog = generate_changelog(PATCH3) | |
478 | assert changelog == EXPECTED3 | |
479 | ||
480 | def test_no_function(self): | |
481 | changelog = generate_changelog(PATCH3, True) | |
482 | assert changelog == EXPECTED3B | |
483 | ||
484 | def test_sorting(self): | |
485 | changelog = generate_changelog(PATCH4) | |
486 | assert changelog == EXPECTED4 | |
487 | ||
488 | def test_pr_bugzilla_download(self): | |
489 | changelog = generate_changelog(PATCH5, fill_pr_titles=True) | |
490 | assert changelog == EXPECTED5 | |
4f85a52c ML |
491 | |
492 | def test_gty_in_struct(self): | |
493 | changelog = generate_changelog(PATCH6, fill_pr_titles=True) | |
494 | assert changelog == EXPECTED6 | |
e7c7cdc5 ML |
495 | |
496 | def test_dr_detection_in_test_case(self): | |
497 | changelog = generate_changelog(PATCH7) | |
498 | assert changelog == EXPECTED7 | |
eb78da45 ML |
499 | |
500 | @unittest.skipIf(not unidiff_supports_renaming, | |
501 | 'Newer version of unidiff is needed (0.6.0+)') | |
502 | def test_renaming(self): | |
503 | changelog = generate_changelog(PATCH8) | |
504 | assert changelog == EXPECTED8 | |
a2d04f3d ML |
505 | |
506 | def test_define_macro_parsing(self): | |
507 | changelog = generate_changelog(PATCH9) | |
508 | assert changelog == EXPECTED9 | |
b838641b ML |
509 | |
510 | def test_long_filenames(self): | |
511 | changelog = generate_changelog(PATCH10) | |
512 | assert changelog == EXPECTED10 |