Commit d12d295
Detect macros with duplicate metavariable bindings
This is imperfect, as invalid macro definitions should be detected
regardless of whether a macro is used or not.
gcc/rust/ChangeLog:
* expand/rust-macro-expand.cc
(MacroExpander::expand_decl_macro): Prevent excess errors.
(MacroExpander::match_matcher): Detect duplicate metavariable
names.
* expand/rust-macro-expand.h (MacroExpander::MacroExpander):
Initialize field had_duplicate_error.
(MacroExpander::had_duplicate_error): New field.
gcc/testsuite/ChangeLog:
* rust/compile/macros/mbe/macro-duplicate-binding.rs: New test.
Signed-off-by: Owen Avery <[email protected]>1 parent b940d2c commit d12d295
File tree
3 files changed
+36
-4
lines changed- gcc
- rust/expand
- testsuite/rust/compile/macros/mbe
3 files changed
+36
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
115 | | - | |
116 | | - | |
117 | | - | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
118 | 122 | | |
119 | 123 | | |
120 | 124 | | |
| |||
535 | 539 | | |
536 | 540 | | |
537 | 541 | | |
| 542 | + | |
| 543 | + | |
538 | 544 | | |
539 | 545 | | |
540 | 546 | | |
| |||
548 | 554 | | |
549 | 555 | | |
550 | 556 | | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
551 | 572 | | |
552 | 573 | | |
553 | 574 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
300 | 300 | | |
301 | 301 | | |
302 | 302 | | |
303 | | - | |
| 303 | + | |
| 304 | + | |
304 | 305 | | |
305 | 306 | | |
306 | 307 | | |
| |||
512 | 513 | | |
513 | 514 | | |
514 | 515 | | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
515 | 519 | | |
516 | 520 | | |
517 | 521 | | |
| |||
Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
0 commit comments