Compare commits
24 Commits
v9.17.9
...
marka-cppc
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6c7e86aa51 | ||
|
|
5c4917f66e | ||
|
|
b7f9192ff1 | ||
|
|
d9fa5d5a9a | ||
|
|
6ab0b3d51a | ||
|
|
8917d2f9b6 | ||
|
|
1a8b581510 | ||
|
|
2c823cc84f | ||
|
|
e4e753f46a | ||
|
|
228e769d75 | ||
|
|
3590a811a2 | ||
|
|
4de0a36a42 | ||
|
|
bbe83c3b2a | ||
|
|
fe745d238d | ||
|
|
f1326c124a | ||
|
|
05cb183b91 | ||
|
|
b7b62bf0b2 | ||
|
|
2c17edf417 | ||
|
|
feba3113c4 | ||
|
|
18194962f2 | ||
|
|
d3786c0cf1 | ||
|
|
1c2f8ab09f | ||
|
|
2f7613333f | ||
|
|
0ff879f145 |
@@ -29,6 +29,9 @@ variables:
|
||||
TARBALL_COMPRESSOR: xz
|
||||
TARBALL_EXTENSION: xz
|
||||
|
||||
# limit jobs when debugging cppcheck
|
||||
DEBUG_CPPCHECK: 1
|
||||
|
||||
stages:
|
||||
- precheck
|
||||
- build
|
||||
@@ -209,6 +212,9 @@ stages:
|
||||
artifacts:
|
||||
untracked: true
|
||||
expire_in: "1 day"
|
||||
except:
|
||||
variables:
|
||||
- $DEBUG_CPPCHECK == "1"
|
||||
|
||||
.windows_build: &windows_build_job
|
||||
stage: build
|
||||
@@ -239,6 +245,9 @@ stages:
|
||||
artifacts:
|
||||
untracked: true
|
||||
expire_in: "1 day"
|
||||
except:
|
||||
variables:
|
||||
- $DEBUG_CPPCHECK == "1"
|
||||
|
||||
.setup_interfaces: &setup_interfaces |
|
||||
if [ "$(id -u)" -eq "0" ]; then
|
||||
@@ -263,6 +272,9 @@ stages:
|
||||
untracked: true
|
||||
expire_in: "1 day"
|
||||
when: on_failure
|
||||
except:
|
||||
variables:
|
||||
- $DEBUG_CPPCHECK == "1"
|
||||
|
||||
.kyua_report: &kyua_report_html |
|
||||
kyua --logfile /dev/null report-html \
|
||||
@@ -311,12 +323,17 @@ stages:
|
||||
- kyua_html/
|
||||
expire_in: "1 day"
|
||||
when: on_failure
|
||||
except:
|
||||
variables:
|
||||
- $DEBUG_CPPCHECK == "1"
|
||||
|
||||
.cppcheck_args: &run_cppcheck |
|
||||
cppcheck --enable=warning,performance,portability,information,missingInclude \
|
||||
--dump \
|
||||
--include=config.h \
|
||||
--quiet \
|
||||
--std=c11 \
|
||||
--library=std.cfg \
|
||||
--language=c \
|
||||
--project=compile_commands.json \
|
||||
--error-exitcode=2 \
|
||||
@@ -325,6 +342,7 @@ stages:
|
||||
--output-file=cppcheck.results \
|
||||
--relative-paths="$CI_PROJECT_DIR" \
|
||||
--inline-suppr \
|
||||
-U DOXYGEN \
|
||||
--suppressions-list=util/suppressions.txt
|
||||
|
||||
.cppcheck_report: &cppcheck_report_html |
|
||||
@@ -343,6 +361,7 @@ stages:
|
||||
after_script:
|
||||
- *cppcheck_report_html
|
||||
artifacts:
|
||||
untracked: true
|
||||
paths:
|
||||
- compile_commands.json
|
||||
- cppcheck.results
|
||||
@@ -426,6 +445,9 @@ docs:sid:amd64:
|
||||
paths:
|
||||
- doc/arm/
|
||||
expire_in: "1 day"
|
||||
except:
|
||||
variables:
|
||||
- $DEBUG_CPPCHECK == "1"
|
||||
|
||||
push:docs:sid:amd64:
|
||||
<<: *debian_sid_amd64_image
|
||||
@@ -634,6 +656,9 @@ scan-build:buster:amd64:
|
||||
- scan-build.reports/
|
||||
expire_in: "1 day"
|
||||
when: on_failure
|
||||
except:
|
||||
variables:
|
||||
- $DEBUG_CPPCHECK == "1"
|
||||
|
||||
# Jobs for regular GCC builds on Debian Sid (amd64)
|
||||
|
||||
@@ -644,6 +669,7 @@ gcc:sid:amd64:
|
||||
EXTRA_CONFIGURE: "--enable-dnstap --with-libidn2"
|
||||
RUN_MAKE_INSTALL: 1
|
||||
MAKE: bear make
|
||||
DEBUG_CPPCHECK: 0
|
||||
<<: *debian_sid_amd64_image
|
||||
<<: *build_job
|
||||
|
||||
@@ -1129,6 +1155,9 @@ system:msvc:windows:amd64:
|
||||
dependencies:
|
||||
- msvc:windows:amd64
|
||||
needs: ["msvc:windows:amd64"]
|
||||
except:
|
||||
variables:
|
||||
- $DEBUG_CPPCHECK == "1"
|
||||
|
||||
msvc-debug:windows:amd64:
|
||||
<<: *windows_build_job
|
||||
@@ -1146,6 +1175,9 @@ system:msvc-debug:windows:amd64:
|
||||
dependencies:
|
||||
- msvc-debug:windows:amd64
|
||||
needs: ["msvc-debug:windows:amd64"]
|
||||
except:
|
||||
variables:
|
||||
- $DEBUG_CPPCHECK == "1"
|
||||
|
||||
# Job producing a release tarball
|
||||
|
||||
|
||||
@@ -97,7 +97,7 @@ int main(int argc, char **argv)
|
||||
UNUSED(argc);
|
||||
UNUSED(argv);
|
||||
|
||||
target = target ? target + 1 : argv[0];
|
||||
target = (target != NULL) ? target + 1 : argv[0];
|
||||
if (strncmp(target, "lt-", 3) == 0) {
|
||||
target += 3;
|
||||
}
|
||||
|
||||
@@ -1340,13 +1340,7 @@ dns_client_startresolve(dns_client_t *client, const dns_name_t *name,
|
||||
ISC_LIST_INIT(event->answerlist);
|
||||
|
||||
rctx = isc_mem_get(mctx, sizeof(*rctx));
|
||||
if (rctx == NULL)
|
||||
result = ISC_R_NOMEMORY;
|
||||
else {
|
||||
isc_mutex_init(&rctx->lock);
|
||||
}
|
||||
if (result != ISC_R_SUCCESS)
|
||||
goto cleanup;
|
||||
isc_mutex_init(&rctx->lock);
|
||||
|
||||
result = getrdataset(mctx, &rdataset);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
@@ -1748,13 +1742,7 @@ dns_client_startrequest(dns_client_t *client, dns_message_t *qmessage,
|
||||
action, arg, sizeof(*event));
|
||||
|
||||
ctx = isc_mem_get(client->mctx, sizeof(*ctx));
|
||||
if (ctx == NULL)
|
||||
result = ISC_R_NOMEMORY;
|
||||
else {
|
||||
isc_mutex_init(&ctx->lock);
|
||||
}
|
||||
if (result != ISC_R_SUCCESS)
|
||||
goto cleanup;
|
||||
isc_mutex_init(&ctx->lock);
|
||||
|
||||
ctx->client = client;
|
||||
ISC_LINK_INIT(ctx, link);
|
||||
@@ -1787,14 +1775,11 @@ dns_client_startrequest(dns_client_t *client, dns_message_t *qmessage,
|
||||
|
||||
isc_refcount_decrement(&client->references);
|
||||
|
||||
cleanup:
|
||||
if (ctx != NULL) {
|
||||
LOCK(&client->lock);
|
||||
ISC_LIST_UNLINK(client->reqctxs, ctx, link);
|
||||
UNLOCK(&client->lock);
|
||||
isc_mutex_destroy(&ctx->lock);
|
||||
isc_mem_put(client->mctx, ctx, sizeof(*ctx));
|
||||
}
|
||||
LOCK(&client->lock);
|
||||
ISC_LIST_UNLINK(client->reqctxs, ctx, link);
|
||||
UNLOCK(&client->lock);
|
||||
isc_mutex_destroy(&ctx->lock);
|
||||
isc_mem_put(client->mctx, ctx, sizeof(*ctx));
|
||||
if (event != NULL)
|
||||
isc_event_free(ISC_EVENT_PTR(&event));
|
||||
isc_task_detach(&tclone);
|
||||
|
||||
@@ -130,7 +130,7 @@ static isc_result_t
|
||||
write_data(FILE *file, unsigned char *datap, void *arg, uint64_t *crc) {
|
||||
isc_result_t result;
|
||||
size_t ret = 0;
|
||||
data_holder_t *data = (data_holder_t *)datap;
|
||||
data_holder_t *data;
|
||||
data_holder_t temp;
|
||||
off_t where;
|
||||
|
||||
@@ -138,7 +138,8 @@ write_data(FILE *file, unsigned char *datap, void *arg, uint64_t *crc) {
|
||||
|
||||
REQUIRE(file != NULL);
|
||||
REQUIRE(crc != NULL);
|
||||
REQUIRE(data != NULL);
|
||||
REQUIRE(datap != NULL);
|
||||
data = (data_holder_t *)datap;
|
||||
REQUIRE((data->len == 0 && data->data == NULL) ||
|
||||
(data->len != 0 && data->data != NULL));
|
||||
|
||||
|
||||
@@ -1215,15 +1215,15 @@ verify_nsec3_chains(const vctx_t *vctx, isc_mem_t *mctx) {
|
||||
result = ISC_R_FAILURE;
|
||||
}
|
||||
if (first == NULL || newchain(first, e)) {
|
||||
if (prev != NULL) {
|
||||
if (!checknext(vctx, prev, first)) {
|
||||
result = ISC_R_FAILURE;
|
||||
}
|
||||
if (prev != first) {
|
||||
free_element(mctx, prev);
|
||||
}
|
||||
}
|
||||
if (first != NULL) {
|
||||
if (prev != NULL) {
|
||||
if (!checknext(vctx, prev, first)) {
|
||||
result = ISC_R_FAILURE;
|
||||
}
|
||||
if (prev != first) {
|
||||
free_element(mctx, prev);
|
||||
}
|
||||
}
|
||||
free_element(mctx, first);
|
||||
}
|
||||
prev = first = e;
|
||||
|
||||
@@ -15,6 +15,10 @@
|
||||
/*%
|
||||
* Performance
|
||||
*/
|
||||
#ifdef CPPCHECK
|
||||
#define ISC_LIKELY(x) (x)
|
||||
#define ISC_UNLIKELY(x) (x)
|
||||
#else
|
||||
#ifdef HAVE_BUILTIN_EXPECT
|
||||
#define ISC_LIKELY(x) __builtin_expect(!!(x), 1)
|
||||
#define ISC_UNLIKELY(x) __builtin_expect(!!(x), 0)
|
||||
@@ -22,5 +26,6 @@
|
||||
#define ISC_LIKELY(x) (x)
|
||||
#define ISC_UNLIKELY(x) (x)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* ISC_LIKELY_H */
|
||||
|
||||
@@ -285,12 +285,17 @@ extern void mock_assert(const int result, const char* const expression,
|
||||
#ifdef UNIT_TESTING
|
||||
|
||||
#define RUNTIME_CHECK(expression) \
|
||||
mock_assert((int)(expression), #expression, __FILE__, __LINE__)
|
||||
((!(expression)) ? \
|
||||
(mock_assert(0, #expression, __FILE__, __LINE__), abort()) : (void)0)
|
||||
|
||||
#else /* UNIT_TESTING */
|
||||
|
||||
#ifndef CPPCHECK
|
||||
/*% Runtime Check */
|
||||
#define RUNTIME_CHECK(cond) ISC_ERROR_RUNTIMECHECK(cond)
|
||||
#else
|
||||
#define RUNTIME_CHECK(e) if (!(e)) abort()
|
||||
#endif
|
||||
|
||||
#endif /* UNIT_TESTING */
|
||||
|
||||
|
||||
@@ -103,10 +103,10 @@ void isc__mutex_init(isc_mutex_t *mp, const char *file, unsigned int line);
|
||||
|
||||
#if ISC_MUTEX_PROFILE
|
||||
#define isc_mutex_destroy(mp) \
|
||||
(RUNTIME_CHECK(pthread_mutex_destroy((&(mp)->mutex)) == 0))
|
||||
RUNTIME_CHECK(pthread_mutex_destroy((&(mp)->mutex)) == 0)
|
||||
#else
|
||||
#define isc_mutex_destroy(mp) \
|
||||
(RUNTIME_CHECK(pthread_mutex_destroy((mp)) == 0))
|
||||
RUNTIME_CHECK(pthread_mutex_destroy((mp)) == 0)
|
||||
#endif
|
||||
|
||||
#if ISC_MUTEX_PROFILE
|
||||
|
||||
@@ -239,7 +239,7 @@ isc_timer_create(isc_timermgr_t *manager0, isc_timertype_t type,
|
||||
isc_task_t *task, isc_taskaction_t action, void *arg,
|
||||
isc_timer_t **timerp)
|
||||
{
|
||||
isc__timermgr_t *manager = (isc__timermgr_t *)manager0;
|
||||
isc__timermgr_t *manager;
|
||||
isc__timer_t *timer;
|
||||
isc_result_t result;
|
||||
isc_time_t now;
|
||||
@@ -252,7 +252,8 @@ isc_timer_create(isc_timermgr_t *manager0, isc_timertype_t type,
|
||||
* in 'timerp'.
|
||||
*/
|
||||
|
||||
REQUIRE(VALID_MANAGER(manager));
|
||||
REQUIRE(VALID_MANAGER(manager0));
|
||||
manager = (isc__timermgr_t *)manager0;
|
||||
REQUIRE(task != NULL);
|
||||
REQUIRE(action != NULL);
|
||||
if (expires == NULL)
|
||||
@@ -352,7 +353,7 @@ isc_timer_reset(isc_timer_t *timer0, isc_timertype_t type,
|
||||
const isc_time_t *expires, const isc_interval_t *interval,
|
||||
bool purge)
|
||||
{
|
||||
isc__timer_t *timer = (isc__timer_t *)timer0;
|
||||
isc__timer_t *timer;
|
||||
isc_time_t now;
|
||||
isc__timermgr_t *manager;
|
||||
isc_result_t result;
|
||||
@@ -363,7 +364,8 @@ isc_timer_reset(isc_timer_t *timer0, isc_timertype_t type,
|
||||
* are purged from its task's event queue.
|
||||
*/
|
||||
|
||||
REQUIRE(VALID_TIMER(timer));
|
||||
REQUIRE(VALID_TIMER(timer0));
|
||||
timer = (isc__timer_t *)timer0;
|
||||
manager = timer->manager;
|
||||
REQUIRE(VALID_MANAGER(manager));
|
||||
|
||||
@@ -425,10 +427,11 @@ isc_timer_reset(isc_timer_t *timer0, isc_timertype_t type,
|
||||
|
||||
isc_timertype_t
|
||||
isc_timer_gettype(isc_timer_t *timer0) {
|
||||
isc__timer_t *timer = (isc__timer_t *)timer0;
|
||||
isc__timer_t *timer;
|
||||
isc_timertype_t t;
|
||||
|
||||
REQUIRE(VALID_TIMER(timer));
|
||||
REQUIRE(VALID_TIMER(timer0));
|
||||
timer = (isc__timer_t *)timer0;
|
||||
|
||||
LOCK(&timer->lock);
|
||||
t = timer->type;
|
||||
@@ -439,7 +442,7 @@ isc_timer_gettype(isc_timer_t *timer0) {
|
||||
|
||||
isc_result_t
|
||||
isc_timer_touch(isc_timer_t *timer0) {
|
||||
isc__timer_t *timer = (isc__timer_t *)timer0;
|
||||
isc__timer_t *timer;
|
||||
isc_result_t result;
|
||||
isc_time_t now;
|
||||
|
||||
@@ -447,7 +450,8 @@ isc_timer_touch(isc_timer_t *timer0) {
|
||||
* Set the last-touched time of 'timer' to the current time.
|
||||
*/
|
||||
|
||||
REQUIRE(VALID_TIMER(timer));
|
||||
REQUIRE(VALID_TIMER(timer0));
|
||||
timer = (isc__timer_t *)timer0;
|
||||
|
||||
LOCK(&timer->lock);
|
||||
|
||||
@@ -470,13 +474,14 @@ isc_timer_touch(isc_timer_t *timer0) {
|
||||
|
||||
void
|
||||
isc_timer_attach(isc_timer_t *timer0, isc_timer_t **timerp) {
|
||||
isc__timer_t *timer = (isc__timer_t *)timer0;
|
||||
isc__timer_t *timer;
|
||||
|
||||
/*
|
||||
* Attach *timerp to timer.
|
||||
*/
|
||||
|
||||
REQUIRE(VALID_TIMER(timer));
|
||||
REQUIRE(VALID_TIMER(timer0));
|
||||
timer = (isc__timer_t *)timer0;
|
||||
REQUIRE(timerp != NULL && *timerp == NULL);
|
||||
isc_refcount_increment(&timer->references);
|
||||
|
||||
@@ -661,8 +666,8 @@ static void
|
||||
set_index(void *what, unsigned int index) {
|
||||
isc__timer_t *timer;
|
||||
|
||||
REQUIRE(VALID_TIMER(what));
|
||||
timer = what;
|
||||
REQUIRE(VALID_TIMER(timer));
|
||||
|
||||
timer->index = index;
|
||||
}
|
||||
@@ -707,9 +712,10 @@ isc_timermgr_create(isc_mem_t *mctx, isc_timermgr_t **managerp) {
|
||||
|
||||
void
|
||||
isc_timermgr_poke(isc_timermgr_t *manager0) {
|
||||
isc__timermgr_t *manager = (isc__timermgr_t *)manager0;
|
||||
isc__timermgr_t *manager;
|
||||
|
||||
REQUIRE(VALID_MANAGER(manager));
|
||||
REQUIRE(VALID_MANAGER(manager0));
|
||||
manager = (isc__timermgr_t *)manager0;
|
||||
|
||||
SIGNAL(&manager->wakeup);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user