[clang] [clang][Preprocessor] Improve error message for comma in #if and #embed (PR #246129)

Vlad Serebrennikov via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 25 15:51:58 PST 2026


================
@@ -961,7 +961,11 @@ Preprocessor::EvaluateDirectiveExpression(IdentifierLoc &IfNDefMacro,
     // If we aren't at the tok::eod token, something bad happened, like an extra
     // ')' token.
     if (Tok.isNot(tok::eod)) {
-      Diag(Tok, diag::err_pp_expected_eol);
+      // A top-level comma is left unconsumed because the controlling expression
----------------
Endilll wrote:

The comment says "A top-level comma is left unconsumed", but the next thing we do is discarding this comma and everything until the end of directive

https://github.com/llvm/llvm-project/pull/246129


More information about the cfe-commits mailing list