mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-20 06:08:08 +00:00
de2162d27d
If the vla parameter has a const specifier, the compiler will warn about mismatched bounds: $ cat mwe.c extern void mwe(const int len, char buf[len]); void mwe(const int len, char buf[len]) {} $ make CFLAGS=-Wvla-parameter mwe.o cc -Wvla-parameter -c -o mwe.o mwe.c mwe.c:2:30: warning: argument 2 of type ‘char[len]’ declared with mismatched bound ‘len’ [-Wvla-parameter] 2 | void mwe(const int len, char buf[len]) {} | ~~~~~^~~~~~~~ mwe.c:1:37: note: previously declared as ‘char[len]’ with bound ‘len’ 1 | extern void mwe(const int len, char buf[len]); | ~~~~~^~~~~~~~ On some code bases it might result in a lot of false positive warnings, which can indeed be easily disabled, but on the other this workaround might hide some real issues, so lets rather fix the compiler and make it more reliable. References: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101289 Signed-off-by: Andrey Erokhin <a.erokhin@inango-systems.com> Signed-off-by: Petr Štetiar <ynezz@true.cz> [commit message] |
||
---|---|---|
.. | ||
binutils | ||
fortify-headers | ||
gcc | ||
gdb | ||
glibc | ||
kernel-headers | ||
musl | ||
nasm | ||
wrapper | ||
build_version | ||
Config.in | ||
info.mk | ||
Makefile |