mirror of
https://gitee.com/openharmony/third_party_mesa3d
synced 2025-02-17 08:27:39 +00:00
meson+autotools: get rid of spammy GCC warning -Wformat-truncation
That warning fires every time a string function takes an argument that could possibly be longer than its max output, which triggers all over the place, especially when working with file paths ("what if every file path is MAX_PATH long?" is what GCC is saying, which is really annoying when we *know* that "/dev/dri/cardN" is not gonna be 4096 char long and it's safe to store it in a 32-char array). Anyway, we either add a ton of dead code all over the place to make GCC happy, or we get rid of its spam. I chose the latter. Signed-off-by: Eric Engestrom <eric.engestrom@intel.com> Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
This commit is contained in:
parent
1a37a80bf6
commit
97ae5a858d
@ -307,6 +307,7 @@ AX_CHECK_COMPILE_FLAG([-Werror=missing-prototypes], [CFLAGS="$CFLAGS
|
||||
AX_CHECK_COMPILE_FLAG([-Wmissing-prototypes], [CFLAGS="$CFLAGS -Wmissing-prototypes"])
|
||||
dnl Dylan Baker: gcc and clang always accepr -Wno-*, hence check for the original warning, then set the no-* flag
|
||||
AX_CHECK_COMPILE_FLAG([-Wmissing-field-initializers], [CFLAGS="$CFLAGS -Wno-missing-field-initializers"])
|
||||
AX_CHECK_COMPILE_FLAG([-Wformat-truncation], [CFLAGS="$CFLAGS -Wno-format-truncation"])
|
||||
AX_CHECK_COMPILE_FLAG([-fno-math-errno], [CFLAGS="$CFLAGS -fno-math-errno"])
|
||||
|
||||
AX_CHECK_COMPILE_FLAG([-fno-trapping-math], [CFLAGS="$CFLAGS -fno-trapping-math"])
|
||||
@ -321,6 +322,7 @@ AX_CHECK_COMPILE_FLAG([-fno-math-errno], [CXXFLAGS="$CXXFL
|
||||
AX_CHECK_COMPILE_FLAG([-fno-trapping-math], [CXXFLAGS="$CXXFLAGS -fno-trapping-math"])
|
||||
AX_CHECK_COMPILE_FLAG([-fvisibility=hidden], [VISIBILITY_CXXFLAGS="-fvisibility=hidden"])
|
||||
AX_CHECK_COMPILE_FLAG([-Wmissing-field-initializers], [CXXFLAGS="$CXXFLAGS -Wno-missing-field-initializers"])
|
||||
AX_CHECK_COMPILE_FLAG([-Wformat-truncation], [CXXFLAGS="$CXXFLAGS -Wno-format-truncation"])
|
||||
AC_LANG_POP([C++])
|
||||
|
||||
# Flags to help ensure that certain portions of the code -- and only those
|
||||
|
@ -790,7 +790,7 @@ foreach a : ['-Wall', '-Werror=implicit-function-declaration',
|
||||
endif
|
||||
endforeach
|
||||
|
||||
foreach a : ['missing-field-initializers']
|
||||
foreach a : ['missing-field-initializers', 'format-truncation']
|
||||
if cc.has_argument('-W' + a)
|
||||
c_args += '-Wno-' + a
|
||||
endif
|
||||
@ -813,7 +813,7 @@ endforeach
|
||||
# For some reason, the test for -Wno-foo always succeeds with gcc, even if the
|
||||
# option is not supported. Hence, check for -Wfoo instead.
|
||||
|
||||
foreach a : ['non-virtual-dtor', 'missing-field-initializers']
|
||||
foreach a : ['non-virtual-dtor', 'missing-field-initializers', 'format-truncation']
|
||||
if cpp.has_argument('-W' + a)
|
||||
cpp_args += '-Wno-' + a
|
||||
endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user