2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-29 21:47:59 +00:00

Merge branch '670-add-coccinelle-unreachable-spatch' into 'master'

Add first coccinelle based precheck test to the GitLab CI

See merge request isc-projects/bind9!1042
This commit is contained in:
Ondřej Surý 2018-11-22 09:28:15 -05:00
commit 259a4947e6
7 changed files with 33 additions and 4 deletions

View 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

1
cocci/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/*.patch

6
cocci/unreachable.spatch Normal file
View File

@ -0,0 +1,6 @@
@@
@@
INSIST(0);
+ ISC_UNREACHABLE();
... when != ISC_UNREACHABLE();

View File

@ -810,7 +810,7 @@ dns_geoip_match(const isc_netaddr_t *reqaddr,
default:
INSIST(0);
ISC_UNREACHABLE()
ISC_UNREACHABLE();
}
return (false);

View File

@ -334,7 +334,7 @@ make_addr_set(dns_rpz_addr_zbits_t *tgt_set, dns_rpz_zbits_t zbits,
break;
default:
INSIST(0);
break;
ISC_UNREACHABLE();
}
}
@ -353,7 +353,7 @@ make_nm_set(dns_rpz_nm_zbits_t *tgt_set,
break;
default:
INSIST(0);
break;
ISC_UNREACHABLE();
}
}
@ -2564,7 +2564,7 @@ dns_rpz_find_ip(dns_rpz_zones_t *rpzs, dns_rpz_type_t rpz_type,
break;
default:
INSIST(0);
break;
ISC_UNREACHABLE();
}
result = ip2name(&found->ip, found->prefix, dns_rootname, ip_name);
RWUNLOCK(&rpzs->search_lock, isc_rwlocktype_read);

15
util/check-cocci Executable file
View File

@ -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

View File

@ -1285,6 +1285,7 @@
./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
@ -2568,6 +2569,7 @@
./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