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

Steve Lhomme git at videolan.org
Thu Jun 18 14:54:23 CEST 2020


vlc/vlc-3.0 | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Mon Feb 10 08:49:07 2020 +0100| [d600c748a648d9a7b1942f79cc523c920823afab] | committer: Steve Lhomme

package/win32: build.sh: add option to do more checks during VLC compilation

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.

(cherry picked from commit 994e5cbc7dc66509996fddab43b9f3b5b0ae98ec)

Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=d600c748a648d9a7b1942f79cc523c920823afab
---

 extras/package/win32/build.sh | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/extras/package/win32/build.sh b/extras/package/win32/build.sh
index fdfb3afa01..aea78b350f 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))
@@ -189,6 +193,10 @@ 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"
+    CXXFLAGS="$CXXFLAGS -Werror=missing-field-initializers"
+fi
 
 ${SCRIPT_PATH}/configure.sh --host=$TRIPLET --with-contrib=../contrib/$TRIPLET $CONFIGFLAGS
 



More information about the vlc-commits mailing list