diff options
author | Andrey Erokhin <a.erokhin@inango-systems.com> | 2023-03-22 16:27:01 +0100 |
---|---|---|
committer | Christian Marangi <ansuelsmth@gmail.com> | 2023-11-02 18:45:50 +0100 |
commit | de2162d27d811b84fcde022a556c9e31a6d77156 (patch) | |
tree | c7b3dfd254ab88d28c003567e1226102b1b5d28a /config/Config-devel.in | |
parent | 8bc8db9ad26da98ebe2d4f861f03f09ece165694 (diff) | |
download | upstream-de2162d27d811b84fcde022a556c9e31a6d77156.tar.gz upstream-de2162d27d811b84fcde022a556c9e31a6d77156.tar.bz2 upstream-de2162d27d811b84fcde022a556c9e31a6d77156.zip |
toolchain: gcc: backport v11.3.0 fix for false positive VLA params warnings
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]
Diffstat (limited to 'config/Config-devel.in')
0 files changed, 0 insertions, 0 deletions