[clang] Diagnose the code with trailing comma in the function call. (PR #125232)

2025-02-17 Thread Björn Pettersson via cfe-commits
bjope wrote: Thanks. I see now that it did not work with older clang (at least not 19.1.0). It did however work with our downstream fork before this patch. I haven't figured out how we avoided the error in the past. I guess we must have something downstream that avoided the error in the past,

[clang] Diagnose the code with trailing comma in the function call. (PR #125232)

2025-02-17 Thread Haojian Wu via cfe-commits
hokein wrote: clang19 rejects this code as well, https://godbolt.org/z/Yf96W8KWv. To make this case work, I think we should use the `__VA_OPT__`. `#define debug_nok(...) fprintf(stderr, "qwerty" __VA_OPT__(,) ## __VA_ARGS__)` https://github.com/llvm/llvm-project/pull/125232 __

[clang] Diagnose the code with trailing comma in the function call. (PR #125232)

2025-02-17 Thread Björn Pettersson via cfe-commits
bjope wrote: This seems to break something with variadic args and the gcc hack with ## to ignore the trailing comma error: ``` #include #define debug_ok(format, ...) fprintf(stderr, format, ## __VA_ARGS__) void foo() { debug_ok("qwerty"); } #define debug_nok(...) fprintf(stderr, "qwerty",

[clang] Diagnose the code with trailing comma in the function call. (PR #125232)

2025-02-14 Thread via cfe-commits
llvmbot wrote: /pull-request llvm/llvm-project#127215 https://github.com/llvm/llvm-project/pull/125232 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Diagnose the code with trailing comma in the function call. (PR #125232)

2025-02-14 Thread LLVM Continuous Integration via cfe-commits
llvm-ci wrote: LLVM Buildbot has detected a new failure on builder `lldb-x86_64-debian` running on `lldb-x86_64-debian` while building `clang` at step 6 "test". Full details are available at: https://lab.llvm.org/buildbot/#/builders/162/builds/16226 Here is the relevant piece of the build lo

[clang] Diagnose the code with trailing comma in the function call. (PR #125232)

2025-02-14 Thread Haojian Wu via cfe-commits
hokein wrote: /cherry-pick https://github.com/llvm/llvm-project/commit/922f339c4ef3631f66dc4b8caa4c356103dbf69d https://github.com/llvm/llvm-project/pull/125232 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mai

[clang] Diagnose the code with trailing comma in the function call. (PR #125232)

2025-02-14 Thread Haojian Wu via cfe-commits
https://github.com/hokein milestoned https://github.com/llvm/llvm-project/pull/125232 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Diagnose the code with trailing comma in the function call. (PR #125232)

2025-02-14 Thread Haojian Wu via cfe-commits
https://github.com/hokein closed https://github.com/llvm/llvm-project/pull/125232 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Diagnose the code with trailing comma in the function call. (PR #125232)

2025-02-04 Thread Haojian Wu via cfe-commits
hokein wrote: > @hokein feel free to merge :) Thanks for the ping. We have several instances of `func(1,);` in our internal codebase, and the number is not small unfortunately. I'm currently working on a cleanup, which will take some time. I plan to merge this patch as soon as the cleanup is

[clang] Diagnose the code with trailing comma in the function call. (PR #125232)

2025-01-31 Thread Oleksandr T. via cfe-commits
https://github.com/a-tarasyuk approved this pull request. https://github.com/llvm/llvm-project/pull/125232 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Diagnose the code with trailing comma in the function call. (PR #125232)

2025-01-31 Thread via cfe-commits
https://github.com/cor3ntin approved this pull request. https://github.com/llvm/llvm-project/pull/125232 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Diagnose the code with trailing comma in the function call. (PR #125232)

2025-01-31 Thread Haojian Wu via cfe-commits
https://github.com/hokein updated https://github.com/llvm/llvm-project/pull/125232 >From 5ecb2de4ba92619dc0bee89e06db5203e256ea42 Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Fri, 31 Jan 2025 14:59:39 +0100 Subject: [PATCH 1/2] Diagnose the code with trailing comma in the function call. --

[clang] Diagnose the code with trailing comma in the function call. (PR #125232)

2025-01-31 Thread Haojian Wu via cfe-commits
hokein wrote: > Can you add a release note and a more detailed description? Thanks Done. I think we don't need a release note, this is a regression fix, and https://github.com/llvm/llvm-project/pull/114684 is not released yet. https://github.com/llvm/llvm-project/pull/125232 __

[clang] Diagnose the code with trailing comma in the function call. (PR #125232)

2025-01-31 Thread Haojian Wu via cfe-commits
https://github.com/hokein edited https://github.com/llvm/llvm-project/pull/125232 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Diagnose the code with trailing comma in the function call. (PR #125232)

2025-01-31 Thread Haojian Wu via cfe-commits
@@ -2237,6 +2237,9 @@ Parser::ParsePostfixExpressionSuffix(ExprResult LHS) { if (PP.isCodeCompletionReached() && !CalledSignatureHelp) RunSignatureHelp(); LHS = ExprError(); + } else if (!HasError && HasTrailingComma) { +

[clang] Diagnose the code with trailing comma in the function call. (PR #125232)

2025-01-31 Thread Haojian Wu via cfe-commits
https://github.com/hokein updated https://github.com/llvm/llvm-project/pull/125232 >From 5ecb2de4ba92619dc0bee89e06db5203e256ea42 Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Fri, 31 Jan 2025 14:59:39 +0100 Subject: [PATCH 1/2] Diagnose the code with trailing comma in the function call. --

[clang] Diagnose the code with trailing comma in the function call. (PR #125232)

2025-01-31 Thread via cfe-commits
cor3ntin wrote: Can you add a release note and a more detailed description? Thanks https://github.com/llvm/llvm-project/pull/125232 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Diagnose the code with trailing comma in the function call. (PR #125232)

2025-01-31 Thread via cfe-commits
https://github.com/cor3ntin edited https://github.com/llvm/llvm-project/pull/125232 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Diagnose the code with trailing comma in the function call. (PR #125232)

2025-01-31 Thread via cfe-commits
@@ -2237,6 +2237,9 @@ Parser::ParsePostfixExpressionSuffix(ExprResult LHS) { if (PP.isCodeCompletionReached() && !CalledSignatureHelp) RunSignatureHelp(); LHS = ExprError(); + } else if (!HasError && HasTrailingComma) { +

[clang] Diagnose the code with trailing comma in the function call. (PR #125232)

2025-01-31 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang Author: Haojian Wu (hokein) Changes Fixes #125225 --- Full diff: https://github.com/llvm/llvm-project/pull/125232.diff 3 Files Affected: - (modified) clang/include/clang/Basic/DiagnosticParseKinds.td (+2) - (modified) clang/lib/Parse/ParseExp

[clang] Diagnose the code with trailing comma in the function call. (PR #125232)

2025-01-31 Thread Haojian Wu via cfe-commits
https://github.com/hokein created https://github.com/llvm/llvm-project/pull/125232 Fixes #125225 >From 5ecb2de4ba92619dc0bee89e06db5203e256ea42 Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Fri, 31 Jan 2025 14:59:39 +0100 Subject: [PATCH] Diagnose the code with trailing comma in the functio