[vlc-devel] [PATCH v3] package/win32: build.sh: add option to do more checks during VLC compilation

Steve Lhomme robux4 at ycbcr.xyz
Wed Mar 18 11:27:59 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.
---
 extras/package/win32/build.sh | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/extras/package/win32/build.sh b/extras/package/win32/build.sh
index 08f69519b01..8901b21bbc5 100755
--- a/extras/package/win32/build.sh
+++ b/extras/package/win32/build.sh
@@ -28,11 +28,12 @@ OPTIONS:
    -s            Interactive shell (get correct environment variables for build)
    -b <url>      Enable breakpad support and send crash reports to this URL
    -d            Create PDB files during the build
+   -x            Add extra checks when compiling
 EOF
 }
 
 ARCH="x86_64"
-while getopts "hra:pcli:sb:d" OPTION
+while getopts "hra:pcli:sb:dx" OPTION
 do
      case $OPTION in
          h)
@@ -67,6 +68,9 @@ do
          d)
              WITH_PDB="yes"
          ;;
+         x)
+             EXTRA_CHECKS="yes"
+         ;;
      esac
 done
 shift $(($OPTIND - 1))
@@ -223,6 +227,9 @@ fi
 if [ ! -z "$WITH_PDB" ]; then
     CONFIGFLAGS="$CONFIGFLAGS --enable-pdb"
 fi
+if [ ! -z "$EXTRA_CHECKS" ]; then
+    CFLAGS="$CFLAGS -Werror=incompatible-pointer-types -Werror=missing-field-initializers"
+fi
 
 ${SCRIPT_PATH}/configure.sh --host=$TRIPLET --with-contrib=../contrib/$TRIPLET $CONFIGFLAGS
 
-- 
2.17.1



More information about the vlc-devel mailing list