[clang] [-Wunsafe-buffer-usage] Warning Libc functions (PR #101583)

Björn Pettersson via cfe-commits cfe-commits at lists.llvm.org
Sat Sep 7 00:38:52 PDT 2024


bjope wrote:


> > Is that as expected? If so, how should snprintf be used to avoid the warning?
> 
> Yes, this is expected. According to the C++ Safe Buffers programming model, buffer pointers should be changed to std::span.

But this new warning is given also when compiling C code. As in the example from @mikaelholmen. So I doubt that the C++ programming model applies.

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


More information about the cfe-commits mailing list