]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Add unreachable.spatch coccinelle recipe and run it in precheck CI phase
authorOndřej Surý <ondrej@sury.org>
Thu, 8 Nov 2018 15:38:46 +0000 (22:38 +0700)
committerOndřej Surý <ondrej@isc.org>
Thu, 22 Nov 2018 14:28:00 +0000 (09:28 -0500)
.gitlab-ci.yml
cocci/.gitignore [new file with mode: 0644]
cocci/unreachable.spatch [new file with mode: 0644]
util/check-cocci [new file with mode: 0755]
util/copyrights

index 6d33fed37b2b41b85f8dda0011dd556587c32602..e24f5dc11b0a5ff4a060b10de37d1dc9bdfe0ddc 100644 (file)
@@ -182,6 +182,11 @@ precheck:debian:sid:amd64:
     expire_in: '1 week'
     when: on_failure
 
+precheck:🐞:sid:amd64:
+  <<: *debian_sid_amd64_image
+  stage: precheck
+  script: util/check-cocci
+
 docs:debian:sid:amd64:
   <<: *debian_sid_amd64_image
   stage: test
diff --git a/cocci/.gitignore b/cocci/.gitignore
new file mode 100644 (file)
index 0000000..faacba5
--- /dev/null
@@ -0,0 +1 @@
+/*.patch
diff --git a/cocci/unreachable.spatch b/cocci/unreachable.spatch
new file mode 100644 (file)
index 0000000..0cc368a
--- /dev/null
@@ -0,0 +1,6 @@
+@@
+@@
+
+    INSIST(0);
++   ISC_UNREACHABLE();
+    ... when != ISC_UNREACHABLE();
diff --git a/util/check-cocci b/util/check-cocci
new file mode 100755 (executable)
index 0000000..61792bd
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+ret=0
+for spatch in cocci/*.spatch; do
+    patch="$(dirname "$spatch")/$(basename "$spatch" .spatch).patch"
+    spatch --sp-file="$spatch" --use-gitgrep --dir . --very-quiet > "$patch";
+    if [ "$(< "$patch" wc -l)" -gt "0" ]; then
+       cat "$patch"
+       ret=1
+    else
+       rm "$patch"
+    fi
+done
+
+exit $ret
index e53ed0fc9f65cd33bad018624469b1e072b31329..3d6841dfd0878aae8856cf2f6e984fe332142f08 100644 (file)
 ./bin/win32/BINDInstall/resource.h             X       2001,2005,2009,2018
 ./bind.keys                                    X       2009,2010,2011,2017,2018
 ./bind.keys.h                                  X       2009,2010,2011,2012,2014,2017,2018
+./cocci/unreachable.spatch                     X       2018
 ./config.guess                                 X       1998,1999,2000,2001,2004,2009,2013,2018
 ./config.h.in                                  X       1998,1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018
 ./config.h.win32                               C       1999,2000,2001,2004,2006,2007,2008,2009,2011,2012,2013,2014,2015,2016,2017,2018
 ./util/branchsync.sh                           SH      2013,2016,2018
 ./util/check-categories.sh                     SH      2015,2016,2017,2018
 ./util/check-changes                           PERL    2002,2004,2007,2012,2016,2018
+./util/check-cocci                             X       2018
 ./util/check-includes.pl                       PERL    2000,2001,2004,2007,2012,2016,2017,2018
 ./util/check-instincludes.sh                   SH      2000,2001,2004,2007,2012,2016,2018
 ./util/check-pullups.pl                                PERL    2001,2002,2003,2004,2007,2012,2016,2018