Commit 51286ec0 authored by Ondřej Surý's avatar Ondřej Surý

Add unreachable.spatch coccinelle recipe and run it in precheck CI phase

parent f6ff0216
@@
@@
INSIST(0);
+ ISC_UNREACHABLE();
... when != ISC_UNREACHABLE();
......@@ -126,6 +126,7 @@
#include <lwres/netdb.h> /* XXX #include <netdb.h> */
#include "assert_p.h"
#include "unreachable_p.h"
#ifndef INADDRSZ
#define INADDRSZ 4
......@@ -1023,6 +1024,7 @@ hostfromaddr(lwres_gnbaresponse_t *addr, int af, const void *src) {
break;
default:
INSIST(0);
ISC_UNREACHABLE();
}
/*
......@@ -1100,6 +1102,7 @@ hostfromname(lwres_gabnresponse_t *name, int af) {
break;
default:
INSIST(0);
ISC_UNREACHABLE();
}
/*
......
......@@ -117,6 +117,7 @@
#include "print_p.h"
#include "assert_p.h"
#include "unreachable_p.h"
#define SUCCESS 0
......@@ -299,6 +300,7 @@ lwres_getnameinfo(const struct sockaddr *sa, size_t salen, char *host,
break;
default:
INSIST(0);
ISC_UNREACHABLE();
}
n = lwres_context_create(&lwrctx, NULL, NULL, NULL, 0);
......
/*
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* See the COPYRIGHT file distributed with this work for additional
* information regarding copyright ownership.
*/
#pragma once
#ifdef HAVE_BUILTIN_UNREACHABLE
#define ISC_UNREACHABLE() __builtin_unreachable();
#else
#define ISC_UNREACHABLE()
#endif
#!/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
......@@ -2627,6 +2627,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
......@@ -4319,6 +4320,7 @@
./lib/lwres/unix/include/Makefile.in MAKE 2001,2004,2007,2012,2016,2018
./lib/lwres/unix/include/lwres/Makefile.in MAKE 2001,2004,2007,2012,2016,2018
./lib/lwres/unix/include/lwres/net.h C 2000,2001,2002,2004,2005,2007,2016,2018
./lib/lwres/unreachable_p.h C 2018
./lib/lwres/version.c C 2000,2001,2004,2005,2007,2016,2018
./lib/lwres/win32/DLLMain.c C 2001,2004,2007,2016,2018
./lib/lwres/win32/Makefile.in MAKE 2001,2004,2007,2012,2016,2018
......@@ -4415,6 +4417,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,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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment