mirror of
https://github.com/isc-projects/bind9.git
synced 2026-05-28 04:34:54 -04:00
Merge branch 'ondrej/scan-build-10-fixes-v9_14-2' into 'v9_14'
Fix new warnings reported by scan-build from LLVM/Clang 10 (v9.14) v2 See merge request isc-projects/bind9!3297
This commit is contained in:
commit
2650ff19c7
6 changed files with 120 additions and 1 deletions
|
|
@ -788,6 +788,8 @@ ds_from_cds(dns_rdatalist_t *dslist, isc_buffer_t *buf, dns_rdata_t *cds) {
|
|||
dns_rdata_ds_t ds;
|
||||
dns_rdata_t *rdata;
|
||||
|
||||
REQUIRE(buf != NULL);
|
||||
|
||||
rdata = rdata_get();
|
||||
|
||||
result = dns_rdata_tostruct(cds, &ds, NULL);
|
||||
|
|
@ -807,6 +809,8 @@ ds_from_cdnskey(dns_rdatalist_t *dslist, isc_buffer_t *buf,
|
|||
isc_result_t result;
|
||||
unsigned i, n;
|
||||
|
||||
REQUIRE(buf != NULL);
|
||||
|
||||
n = sizeof(dtype)/sizeof(dtype[0]);
|
||||
for (i = 0; i < n; i++) {
|
||||
if (dtype[i] != 0) {
|
||||
|
|
|
|||
|
|
@ -1229,6 +1229,7 @@ setup(void) {
|
|||
#endif
|
||||
|
||||
named_server_create(named_g_mctx, &named_g_server);
|
||||
ENSURE(named_g_server != NULL);
|
||||
sctx = named_g_server->sctx;
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -842,7 +842,7 @@ named_os_shutdownmsg(char *command, isc_buffer_t *text) {
|
|||
|
||||
|
||||
/* Skip the command name. */
|
||||
if ((ptr = strtok_r(command, " \t", &last)) == NULL) {
|
||||
if (strtok_r(command, " \t", &last) == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
|
||||
#if HAVE_CMOCKA
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <stdarg.h>
|
||||
#include <stddef.h>
|
||||
#include <setjmp.h>
|
||||
|
|
|
|||
|
|
@ -2642,6 +2642,7 @@
|
|||
./util/nanny.pl PERL 2000,2001,2004,2007,2012,2016,2018,2019,2020
|
||||
./util/new-func PERL 2005,2007,2012,2016,2018,2019,2020
|
||||
./util/nt-kit SH 1999,2000,2001,2004,2007,2012,2016,2018,2019,2020
|
||||
./util/parse_tsan.py PYTHON-BIN 2020
|
||||
./util/spacewhack.pl PERL 2000,2001,2004,2007,2012,2016,2018,2019,2020
|
||||
./util/tabify-changes SH 2004,2007,2012,2016,2018,2019,2020
|
||||
./util/update-drafts.pl PERL 2000,2001,2004,2007,2012,2016,2018,2019,2020
|
||||
|
|
|
|||
112
util/parse_tsan.py
Executable file
112
util/parse_tsan.py
Executable file
|
|
@ -0,0 +1,112 @@
|
|||
#!/usr/bin/env python3
|
||||
############################################################################
|
||||
# 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.
|
||||
############################################################################
|
||||
|
||||
import sys, os, os.path, re
|
||||
from hashlib import sha256
|
||||
|
||||
class State:
|
||||
inside = False
|
||||
block = ""
|
||||
last_line = None
|
||||
|
||||
mutexes = {}
|
||||
m_index = 1
|
||||
threads = {}
|
||||
t_index = 1
|
||||
pointers = {}
|
||||
p_index = 1
|
||||
|
||||
def init(self):
|
||||
self.reset()
|
||||
|
||||
def reset(self):
|
||||
self.inside = False
|
||||
self.block = ""
|
||||
|
||||
self.mutexes = {}
|
||||
self.threads = {}
|
||||
self.pointers = {}
|
||||
self.pointers["0x000000000000"] = 0
|
||||
|
||||
self.m_index = 1
|
||||
self.t_index = 1
|
||||
self.p_index = 1
|
||||
|
||||
top = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
|
||||
|
||||
out = os.path.join(top, "tsan")
|
||||
|
||||
if not os.path.isdir(out):
|
||||
os.mkdir(out)
|
||||
|
||||
# Regular Expressions
|
||||
mutex = re.compile(r"M\d+")
|
||||
thread = re.compile(r"T\d+")
|
||||
stack = re.compile(r"\s\(\S+\+0x\S+\)")
|
||||
pointer = re.compile(r"0x[0-9a-f]+")
|
||||
pid = re.compile(r"\(pid=\d+,?\)")
|
||||
tid = re.compile(r"tid=\d+,?\s*")
|
||||
worker = re.compile(r"\s+'(isc-worker|isc-net-)\d+'")
|
||||
path = re.compile(top + "/")
|
||||
|
||||
s = State()
|
||||
|
||||
|
||||
with open(sys.argv[1], "r", encoding='utf-8') as f:
|
||||
lines = f.readlines()
|
||||
for line in lines:
|
||||
if line == "==================\n":
|
||||
if not s.inside:
|
||||
s.inside = True
|
||||
else:
|
||||
dname = os.path.join(out, sha256(s.last_line.encode('utf-8')).hexdigest())
|
||||
if not os.path.isdir(dname):
|
||||
os.mkdir(dname)
|
||||
fname = os.path.join(dname, sha256(s.block.encode('utf-8')).hexdigest() + ".tsan")
|
||||
if not os.path.isfile(fname):
|
||||
with open(fname, "w", encoding='utf-8') as w:
|
||||
w.write(s.block)
|
||||
s.reset()
|
||||
else:
|
||||
for m in mutex.finditer(line):
|
||||
k = m.group()
|
||||
if k not in s.mutexes:
|
||||
s.mutexes[k] = s.m_index
|
||||
s.m_index += 1
|
||||
for m in thread.finditer(line):
|
||||
k = m.group()
|
||||
if k not in s.threads:
|
||||
s.threads[k] = s.t_index
|
||||
s.t_index += 1
|
||||
for m in pointer.finditer(line):
|
||||
k = m.group()
|
||||
if k not in s.pointers:
|
||||
s.pointers[k] = s.p_index
|
||||
s.p_index += 1
|
||||
for k, v in s.mutexes.items():
|
||||
r = re.compile(k)
|
||||
line = r.sub("M%s" % v, line)
|
||||
for k, v in s.threads.items():
|
||||
r = re.compile(k)
|
||||
line = r.sub("T%s" % v, line)
|
||||
for k, v in s.pointers.items():
|
||||
r = re.compile(k)
|
||||
line = r.sub("0x%s" % str(v).zfill(12), line)
|
||||
|
||||
line = stack.sub("", line)
|
||||
line = pid.sub("", line)
|
||||
line = tid.sub("", line)
|
||||
line = worker.sub("", line)
|
||||
line = path.sub("", line)
|
||||
|
||||
s.block += line
|
||||
s.last_line = line
|
||||
Loading…
Reference in a new issue