[clang] [analyzer] Fix security.VAList false positives with C23 va_start (PR #192024)

DonĂ¡t Nagy via cfe-commits cfe-commits at lists.llvm.org
Mon May 4 05:44:34 PDT 2026


https://github.com/NagyDonat commented:

Thanks for the fix!

The code change LGTM, but on the testing side I don't like that this PR introduces a new tests instead of using the same set tests for C23 and older standards. (Especially since the intended behavior is that this checker behaves identically in C23 and older standards.)

Instead of adding new tests files, you should extend `valist-uninitialized.c` and `valist-unterminated.c` with new `RUN:` lines that also execute the analysis in C23 mode. (One new RUN: line for each previously existing one.)

To ensure that each RUN line uses the right the mock system header, you can e.g. add `-DC23` to the C23 RUN lines and then you can write
```c
#ifdef C23
#include <the c23 mock header>
#else
include <the usual mock header>
#endif
```
However, if you can use `__STDC_VERSION__` to select the right include, that's probably even better.

If you want to introduce new testcases that are not available in  `valist-uninitialized.c` and `valist-unterminated.c`, feel free to add them (at a place that's logical for them, or at the end). Naturally, those new tests should work for both C23 and earlier standards.

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


More information about the cfe-commits mailing list