From e7e9509cf9fd05f24c769435f372070a1e415533 Mon Sep 17 00:00:00 2001 From: Kirill Gavrilov Date: Sat, 12 Jan 2019 10:47:24 +0300 Subject: [PATCH] Continuous Integration - add option -Werror to detect new compiler warnings when using Travis CI when targeting Android, Linux and macOS. --- Makefile | 6 ++++++ StMoviePlayer/StVideo/StAudioQueue.cpp | 2 ++ StShared/StWebPImage.cpp | 8 ++++++-- contentiousIntegration/build_sview_android.sh | 2 +- contentiousIntegration/build_sview_linux.sh | 2 +- contentiousIntegration/build_sview_osx.sh | 2 +- 6 files changed, 17 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 3a7a5dca..1f37e400 100644 --- a/Makefile +++ b/Makefile @@ -215,6 +215,12 @@ ifeq ($(TARGET_OS),linux) EXTRA_CXXFLAGS += `pkg-config gtk+-2.0 --cflags` endif +# optionally fail on any compiler warning except #warning and deprecations +WERROR_LEVEL = 0 +ifeq ($(WERROR_LEVEL),1) +EXTRA_CXXFLAGS += -Werror -Wno-error=cpp -Wno-error=deprecated-declarations +endif + INC = -I$(SRCDIR)/3rdparty/include -I$(SRCDIR)/include CFLAGS = -fPIC $(HAVE_MONGOOSE) $(INC) $(EXTRA_CFLAGS) CXXFLAGS = -O3 -std=c++0x -Wall -fPIC $(HAVE_MONGOOSE) $(INC) $(EXTRA_CXXFLAGS) diff --git a/StMoviePlayer/StVideo/StAudioQueue.cpp b/StMoviePlayer/StVideo/StAudioQueue.cpp index be4a9de7..0ccd2889 100644 --- a/StMoviePlayer/StVideo/StAudioQueue.cpp +++ b/StMoviePlayer/StVideo/StAudioQueue.cpp @@ -923,6 +923,8 @@ bool StAudioQueue::stalQueue(const double thePts) { ); } myDbgPrevQueued = aQueued; +#else + (void )myDbgPrevQueued; #endif if((aState == AL_PLAYING diff --git a/StShared/StWebPImage.cpp b/StShared/StWebPImage.cpp index 81d1f1fa..92248c00 100644 --- a/StShared/StWebPImage.cpp +++ b/StShared/StWebPImage.cpp @@ -28,6 +28,7 @@ extern "C" { VP8_STATUS_NOT_ENOUGH_DATA } VP8StatusCode; +#ifdef ST_HAVE_WEBP static const char* const WebPStatusMessages[] = { "OK", // VP8_STATUS_OK "OUT_OF_MEMORY", // VP8_STATUS_OUT_OF_MEMORY @@ -38,6 +39,7 @@ extern "C" { "USER_ABORT", // VP8_STATUS_USER_ABORT "NOT_ENOUGH_DATA" // VP8_STATUS_NOT_ENOUGH_DATA }; +#endif extern int WebPInitDecoderConfigInternal(StWebPImage::WebPDecoderConfig* theConfig, int theVersion); @@ -70,8 +72,7 @@ bool StWebPImage::init() { } StWebPImage::StWebPImage() -: StImageFile(), - myIsCompat(false) { +: myIsCompat(false) { #ifdef ST_HAVE_WEBP myIsCompat = WebPInitDecoderConfig(&myConfig) != 0; #endif @@ -86,6 +87,9 @@ void StWebPImage::close() { if(myIsCompat) { WebPFreeDecBuffer(&myConfig.output); } +#else + (void )myConfig; + (void )myIsCompat; #endif } diff --git a/contentiousIntegration/build_sview_android.sh b/contentiousIntegration/build_sview_android.sh index efa2399f..b480ff21 100755 --- a/contentiousIntegration/build_sview_android.sh +++ b/contentiousIntegration/build_sview_android.sh @@ -22,4 +22,4 @@ aNbJobs="$(getconf _NPROCESSORS_ONLN)" # perform building itself make --directory=$aScriptPath/.. clean make --directory=$aScriptPath/.. -j $aNbJobs android ANDROID_NDK=$SVIEW_NDK ANDROID_BUILD_TOOLS=$SVIEW_BUILD_TOOLS ANDROID_PLATFORM=$SVIEW_PLATFORM \ - FFMPEG_ROOT=$SVIEW_FFMPEG FREETYPE_ROOT=$SVIEW_FREETYPE OPENAL_ROOT=$SVIEW_OPENAL LIBCONFIG_ROOT=$SVIEW_LIBCONFIG + FFMPEG_ROOT=$SVIEW_FFMPEG FREETYPE_ROOT=$SVIEW_FREETYPE OPENAL_ROOT=$SVIEW_OPENAL LIBCONFIG_ROOT=$SVIEW_LIBCONFIG WERROR_LEVEL=1 diff --git a/contentiousIntegration/build_sview_linux.sh b/contentiousIntegration/build_sview_linux.sh index d5d30abe..d145f981 100755 --- a/contentiousIntegration/build_sview_linux.sh +++ b/contentiousIntegration/build_sview_linux.sh @@ -10,4 +10,4 @@ aNbJobs="$(getconf _NPROCESSORS_ONLN)" # perform building itself make --directory=$aScriptPath/.. clean -make --directory=$aScriptPath/.. -j $aNbJobs +make --directory=$aScriptPath/.. -j $aNbJobs WERROR_LEVEL=1 diff --git a/contentiousIntegration/build_sview_osx.sh b/contentiousIntegration/build_sview_osx.sh index 2a7ce5da..216d09f1 100755 --- a/contentiousIntegration/build_sview_osx.sh +++ b/contentiousIntegration/build_sview_osx.sh @@ -10,4 +10,4 @@ aNbJobs="$(getconf _NPROCESSORS_ONLN)" # perform building itself make --directory=$aScriptPath/.. clean -make --directory=$aScriptPath/.. -j $aNbJobs +make --directory=$aScriptPath/.. -j $aNbJobs WERROR_LEVEL=1