[Parse] Improve macro expansion parsing

* Unify macro expansion parsing logic between MacroExpansionExpr and
  MacroExpansionDecl
* Diagnose whitespace between '#' and the macro name
* Diagnose keyword as a macro name
This commit is contained in:
Rintaro Ishizaki
2023-05-15 13:30:55 -07:00
parent 23c19333df
commit e3a0f24cfe
9 changed files with 198 additions and 86 deletions

View File

@@ -2057,6 +2057,8 @@ ERROR(macro_expansion_expr_expected_macro_identifier,PointsToFirstBadToken,
"expected a macro identifier for a pound literal expression", ())
ERROR(macro_expansion_decl_expected_macro_identifier,PointsToFirstBadToken,
"expected a macro identifier for a pound literal declaration", ())
ERROR(extra_whitespace_macro_expansion_identifier,PointsToFirstBadToken,
"extraneous whitespace between '#' and macro name is not permitted", ())
ERROR(macro_role_attr_expected_kind,PointsToFirstBadToken,
"expected %select{a freestanding|an attached}0 macro role such as "