mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-07-21 10:14:41 +00:00
build: add "-Wvla" to warn about uses of variable-length arrays
We don't use them, so add a compiler warning about their use. I think they are annoying, because sizeof(x) and typeof(x) might evaluate at runtime. Especially the typeof() extension is useful for macros, but behaves badly with variable-length arrays due to running code at runtime. But the worst is, G_STATIC_ASSERT() is implemented by declaring an array of negative length. Usually, the checked condition should be a compile time constant, but with VLAs the compiler would not evaluate the static-assert at compile time and instead accept it silently. It's easy to mess up static asserts to wrongly have a non-constant condition, especially when the static-assert is used inside a macro. Just say no.
This commit is contained in:
parent
96ae9309e7
commit
9c3402aa1e
|
@ -79,6 +79,7 @@ if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then
|
|||
-Wshift-negative-value \
|
||||
-Wstrict-prototypes \
|
||||
-Wundef \
|
||||
-Wvla \
|
||||
-Wno-duplicate-decl-specifier \
|
||||
-Wno-format-truncation \
|
||||
-Wno-format-y2k \
|
||||
|
|
Loading…
Reference in a new issue