[clang-tools-extra] [clang-tidy] New checker: modernize-use-va-opt to replace the `, ##__VAR_ARG__` GNU extension (PR #188474)

via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 25 06:11:20 PDT 2026


serge-sans-paille wrote:

> For reviewers: although I wrote `__VA_OPT__(,)` in the FixIt replacement, and although the fixit is correctly printed, it's applied as `__VA_OPT__()` instead, eating the comma. Is that a known issue?



> For reviewers: although I wrote `__VA_OPT__(,)` in the FixIt replacement, and although the fixit is correctly printed, it's applied as `__VA_OPT__()` instead, eating the comma. Is that a known issue?

The replacement files looks correct:

```
---
MainSourceFile:  '/home/ssp/sources/mozilla-unified-bis/obj-x86_64-pc-linux-gnu/ipc/ipdl/PGMPServiceParent.cpp'
Diagnostics:
  - DiagnosticName:  modernize-use-va-opt
    DiagnosticMessage:
      Message:         Use __VA_OPT__ instead of GNU extension to __VA_ARGS__
      FilePath:        '/home/ssp/sources/mozilla-unified-bis/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ipc/ProtocolUtils.h'
      FileOffset:      12112
      Replacements:
        - FilePath:        '/home/ssp/sources/mozilla-unified-bis/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ipc/ProtocolUtils.h'
          Offset:          12108
          Length:          15
          ReplacementText: ' __VA_OPT__(,) __VA_ARGS__'
    Level:           Warning
    BuildDirectory:  '/home/ssp/sources/mozilla-unified-bis/obj-x86_64-pc-linux-gnu/dom/media/gmp'
...
```

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


More information about the cfe-commits mailing list