From 1615e9ea2a3eff1c0fc755c26f85b2969e065332 Mon Sep 17 00:00:00 2001 From: Rokas Kupstys Date: Mon, 25 Nov 2019 14:02:47 +0200 Subject: [PATCH] CI: Enable extended warnings in example_null builds. CI: Add MinGW build with extra warnings on windows. (cherry picked from commit ebc98c273054d0f9b305a1346db98052616a8b21) --- .github/workflows/build.yml | 11 +++++++---- examples/example_null/Makefile | 15 +++++++++++++++ 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 86f5de6e8..60f8f6428 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -41,6 +41,9 @@ jobs: } # Not using matrix here because it would inflate job count too much. Check out and setup is done for every job and that makes build times way too long. + - name: Build example_null (extra warnings) + run: mingw32-make -C examples/example_null EXTRA_WARNINGS=1 + - name: Build Win32 example_glfw_opengl2 shell: cmd run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_glfw_opengl2/example_glfw_opengl2.vcxproj /p:Platform=Win32 /p:Configuration=Release' @@ -150,8 +153,8 @@ jobs: sudo apt-get update sudo apt-get install -y libglfw3-dev libsdl2-dev - - name: Build example_null - run: make -C examples/example_null + - name: Build example_null (extra warnings) + run: make -C examples/example_null EXTRA_WARNINGS=1 - name: Build example_glfw_opengl2 run: make -C examples/example_glfw_opengl2 @@ -179,8 +182,8 @@ jobs: brew install glfw3 brew install sdl2 - - name: Build example_null - run: make -C examples/example_null + - name: Build example_null (extra warnings) + run: make -C examples/example_null EXTRA_WARNINGS=1 - name: Build example_glfw_opengl2 run: make -C examples/example_glfw_opengl2 diff --git a/examples/example_null/Makefile b/examples/example_null/Makefile index 012758fe2..909f19820 100644 --- a/examples/example_null/Makefile +++ b/examples/example_null/Makefile @@ -8,27 +8,42 @@ SOURCES = main.cpp SOURCES += ../../imgui.cpp ../../imgui_demo.cpp ../../imgui_draw.cpp ../../imgui_widgets.cpp OBJS = $(addsuffix .o, $(basename $(notdir $(SOURCES)))) UNAME_S := $(shell uname -s) +EXTRA_WARNINGS ?= 0 CXXFLAGS = -I../ -I../../ CXXFLAGS += -g -Wall -Wformat LIBS = +# We use the EXTRA_WARNINGS flag on our CI setup to eagerly catch zealous warnings +ifeq ($(EXTRA_WARNINGS), 1) + CXXFLAGS += -Wno-zero-as-null-pointer-constant -Wno-double-promotion -Wno-variadic-macros +endif + ##--------------------------------------------------------------------- ## BUILD FLAGS PER PLATFORM ##--------------------------------------------------------------------- ifeq ($(UNAME_S), Linux) #LINUX ECHO_MESSAGE = "Linux" + ifneq ($(EXTRA_WARNINGS), 0) + CXXFLAGS += -Wextra -pedantic + endif CFLAGS = $(CXXFLAGS) endif ifeq ($(UNAME_S), Darwin) #APPLE ECHO_MESSAGE = "Mac OS X" + ifneq ($(EXTRA_WARNINGS), 0) + CXXFLAGS += -Weverything -Wno-reserved-id-macro -Wno-c++98-compat-pedantic -Wno-padded -Wno-c++11-long-long + endif CFLAGS = $(CXXFLAGS) endif ifeq ($(findstring MINGW,$(UNAME_S)),MINGW) ECHO_MESSAGE = "MinGW" + ifneq ($(EXTRA_WARNINGS), 0) + CXXFLAGS += -Wextra -pedantic + endif CFLAGS = $(CXXFLAGS) endif