]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
CI: enforce -Wpedantic and -Wshadow
authorVladimír Čunát <vladimir.cunat@nic.cz>
Mon, 10 Dec 2018 18:05:24 +0000 (19:05 +0100)
committerTomas Krizek <tomas.krizek@nic.cz>
Tue, 8 Jan 2019 12:06:32 +0000 (12:06 +0000)
-Wpedantic is only enforced in CI, as we only have it fixed with c11
standard, and I didn't want to force c11 dependency for everyone yet.

.gitlab-ci.yml
config.mk

index c5279b42ecbc77de6e579285e67814b48e32396a..acc4caeef466987b0b07eb01e7b145bafd483829 100644 (file)
@@ -41,20 +41,30 @@ stages:
 build:linux:amd64:
   <<: *build
 
-build:clang:linux:amd64:
-  <<: *build
-  variables:
-    CFLAGS: -Werror -Wno-error=unused-command-line-argument -ggdb
-    CXX: clang++
-    CC: clang
-  image: $CI_REGISTRY/knot/knot-resolver/ci/debian-unstable:knot-2.7  # newer Debian for newer Clang
-  artifacts:
 
 build:asan:linux:amd64:
   <<: *build
   variables:
     CFLAGS: -Werror -ggdb3 -O0 -fsanitize=address -fno-omit-frame-pointer
 
+lint:pedantic:
+  stage: test  # could be in build already, but let's not block the test stage if this fails
+  dependencies: []  # do not download build artifacts
+  except:
+    - master
+  image: $CI_REGISTRY/knot/knot-resolver/ci/debian-unstable:knot-2.7  # newer Debian for newer compilers
+  variables:
+    CFLAGS: -Werror -Wall -Wpedantic -ggdb -std=gnu11
+  script:
+    - make -k all
+    - make clean
+    - make -k all CC=clang CXX=clang++ \
+        CFLAGS="$CFLAGS -Wno-newline-eof -Wno-gnu-zero-variadic-macro-arguments -Wno-gnu-folding-constant"
+  tags:
+    - docker
+    - linux
+    - amd64
+
 srpm:
   stage: build
   except:
index 5825628550b4bb5a476ec25dc112855a8ab9f594..c234ba9c0fd1cfa8c0a036091ba60036518df555 100644 (file)
--- a/config.mk
+++ b/config.mk
@@ -34,8 +34,8 @@ INSTALL := install
 
 # Flags
 BUILD_LDFLAGS += $(LDFLAGS)
-BUILD_CFLAGS := $(CFLAGS) $(CPPFLAGS) -std=c99 -D_GNU_SOURCE
-BUILD_CFLAGS += -Wno-unused -Wtype-limits -Wformat -Wformat-security -Wall
+BUILD_CFLAGS := -std=c99 -D_GNU_SOURCE $(CFLAGS) $(CPPFLAGS)
+BUILD_CFLAGS += -Wtype-limits -Wformat -Wformat-security -Wshadow -Wall
 BUILD_CFLAGS += -I$(abspath .) -I$(abspath lib/generic) -I$(abspath contrib)
 BUILD_CFLAGS += -DPACKAGE_VERSION="\"$(VERSION)\"" -DPREFIX="\"$(PREFIX)\"" -DMODULEDIR="\"$(MODULEDIR)\""
 BUILD_CFLAGS += -fvisibility=hidden