mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-27 19:38:55 +02:00
build: Enforce use of C99 flexible arrays and enable bounds checking
This nudges us towards requiring more compile time array bounds checking where it’s supported by the compiler. See https://people.kernel.org/kees/bounded-flexible-arrays-in-c Signed-off-by: Philip Withnall <pwithnall@gnome.org>
This commit is contained in:
@@ -570,6 +570,10 @@ if cc.get_id() == 'gcc' or cc.get_id() == 'clang'
|
||||
]
|
||||
|
||||
warning_c_args = warning_common_args + [
|
||||
# Ensure that any use of flexible arrays is C99-compatible
|
||||
# See https://people.kernel.org/kees/bounded-flexible-arrays-in-c
|
||||
'-fstrict-flex-arrays',
|
||||
'-Werror=array-bounds',
|
||||
'-Wstrict-prototypes',
|
||||
# Due to pervasive use of things like GPOINTER_TO_UINT(), we do not support
|
||||
# building with -Wbad-function-cast.
|
||||
|
Reference in New Issue
Block a user