Commit ff3b1ff
committed
[cc] unterminated macro updates
Added EOF/unterminated macro detection to collect_macro_args in cc/token/preprocess.rs:
1. Extended function signature to take macro_pos: &Position and macro_name: &str for error reporting
2. Added tracking variable found_closing_paren to detect if we exited normally vs ran out of tokens
3. Added error reporting when the loop exits without finding the closing ):
if !found_closing_paren {
crate::diag::error(
*macro_pos,
&format!(
"unterminated argument list invoking macro \"{}\"",
macro_name
),
);
}
4. Updated all 4 call sites to pass the position and macro name
This now matches sparse's behavior - reporting "unterminated argument list invoking macro X" when EOF is reached before finding the closing ), while correctly allowing multiline macro calls (no newline-based breaking).1 parent e743ea1 commit ff3b1ff
1 file changed
+25
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
679 | 679 | | |
680 | 680 | | |
681 | 681 | | |
682 | | - | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
683 | 688 | | |
684 | 689 | | |
685 | 690 | | |
| |||
1715 | 1720 | | |
1716 | 1721 | | |
1717 | 1722 | | |
1718 | | - | |
| 1723 | + | |
1719 | 1724 | | |
1720 | 1725 | | |
1721 | 1726 | | |
| |||
1733 | 1738 | | |
1734 | 1739 | | |
1735 | 1740 | | |
| 1741 | + | |
| 1742 | + | |
1736 | 1743 | | |
1737 | 1744 | | |
1738 | 1745 | | |
| |||
1742 | 1749 | | |
1743 | 1750 | | |
1744 | 1751 | | |
| 1752 | + | |
1745 | 1753 | | |
1746 | 1754 | | |
1747 | 1755 | | |
| |||
1756 | 1764 | | |
1757 | 1765 | | |
1758 | 1766 | | |
| 1767 | + | |
1759 | 1768 | | |
1760 | 1769 | | |
1761 | 1770 | | |
| |||
1774 | 1783 | | |
1775 | 1784 | | |
1776 | 1785 | | |
| 1786 | + | |
| 1787 | + | |
| 1788 | + | |
| 1789 | + | |
| 1790 | + | |
| 1791 | + | |
| 1792 | + | |
| 1793 | + | |
| 1794 | + | |
| 1795 | + | |
| 1796 | + | |
1777 | 1797 | | |
1778 | 1798 | | |
1779 | 1799 | | |
| |||
2049 | 2069 | | |
2050 | 2070 | | |
2051 | 2071 | | |
2052 | | - | |
| 2072 | + | |
2053 | 2073 | | |
2054 | 2074 | | |
2055 | 2075 | | |
| |||
2105 | 2125 | | |
2106 | 2126 | | |
2107 | 2127 | | |
2108 | | - | |
| 2128 | + | |
2109 | 2129 | | |
2110 | 2130 | | |
2111 | 2131 | | |
| |||
2127 | 2147 | | |
2128 | 2148 | | |
2129 | 2149 | | |
2130 | | - | |
| 2150 | + | |
2131 | 2151 | | |
2132 | 2152 | | |
2133 | 2153 | | |
| |||
0 commit comments