Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make: buildtest with "-Wall -Wextra -Werror" #1121

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions Makefile.buildtests
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,47 @@ endif
info-buildsizes-diff info-build info-boards-supported \
info-features-missing info-boards-features-missing

# Make buildtests more pedantic by supplying "-Wall -Wexta -Werror" by default.
# This can be disabled through "make W_ALL=0 W_EXTRA=0 W_ERROR=0", resp.,
# or with "make W_NONE=1", which disables every extra flag.
# With "make PEDANTIC=1 PEDANTIC_ERRORS=1" you can make the buildtest even more pedantic.

ifeq (, $(filter buildtest, $(MAKECMDGOALS)))
W_NONE ?= 1
else
W_NONE ?= 0
endif

ifeq (1, $(W_NONE))
W_ALL ?= 0
W_EXTRA ?= 0
W_ERROR ?= 0
else
W_ALL ?= 1
W_EXTRA ?= 1
W_ERROR ?= 1
endif
PEDANTIC ?= 0
PEDANTIC_ERRORS ?= 0

ifneq (0, $(W_ALL))
W_FLAGS += -Wall
endif
ifneq (0, $(W_EXTRA))
W_FLAGS += -Wextra
endif
ifneq (0, $(W_ERROR))
W_FLAGS += -Werror
endif
ifneq (0, $(PEDANTIC))
W_FLAGS += -pedantic
endif
ifneq (0, $(PEDANTIC_ERRORS))
W_FLAGS += -pedantic-errors
endif

all: CFLAGS+=${W_FLAGS}

ifeq ($(BUILD_IN_DOCKER),1)
buildtest: ..in-docker-container
else
Expand All @@ -54,6 +95,7 @@ buildtest:
BINDIRBASE=$${BINDIRBASE} \
RIOTNOLINK=$${RIOTNOLINK} \
RIOT_VERSION=$${RIOT_VERSION} \
W_FLAGS="${W_FLAGS}" \
$(MAKE) -j$(NPROC) 2>&1 >/dev/null) ; \
if [ "$${?}" = "0" ]; then \
${COLOR_ECHO} "${COLOR_GREEN}success${COLOR_RESET}"; \
Expand Down