[vlc-devel] [PATCH 1/2] configure: add an option to turn some dangerous warnings into errors

Steve Lhomme robux4 at ycbcr.xyz
Fri Mar 20 10:20:49 CET 2020


Mismatching pointers are usually a result of using the incorrect pointer and
might trigger crashes.

Missing initializers are useful for structures of callbacks, to make sure a new
callback is not missing by accident. It's always possible to put NULL, on
purpose, knowingly.

Both flags produce no error on win32/win64 with clang or gcc. But they cannot
be set globally outside of the build script as many contribs will likely fail
these tests and we shouldn't refuse/patch a contrib just for that.

I have been compiling with these flags for weeks without issues. It helped find
some issue (48442d3536edae578f1a384e73346d1e2a4c0061) that were pushed
unnoticed without these checks.
---
 configure.ac | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/configure.ac b/configure.ac
index bc1874cb97c..c96b3fe6fac 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4480,6 +4480,12 @@ AS_VAR_IF(with_libfuzzer, no, [], [
     ])
 ])
 
+AC_ARG_ENABLE([extra-checks],
+  AS_HELP_STRING([--enable-extra-checks],
+         [Turn some compilation warnings into errors]), [
+  AX_APPEND_COMPILE_FLAGS([-Werror=incompatible-pointer-types -Werror=missing-field-initializers], [CFLAGS])
+])
+
 dnl
 dnl  Stuff used by the program
 dnl
-- 
2.17.1



More information about the vlc-devel mailing list