From 922e2fe23b1ed31aac30422cae7fd6e84cd273f7 Mon Sep 17 00:00:00 2001 From: Miroslav Lichvar Date: Mon, 7 Oct 2013 16:10:25 +0200 Subject: [PATCH] Fix Clang static analyzer warnings about never read values --- cmdmon.c | 3 +-- ntp_core.c | 2 ++ sourcestats.c | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/cmdmon.c b/cmdmon.c index a917f03a..fe63cbd2 100644 --- a/cmdmon.c +++ b/cmdmon.c @@ -1937,8 +1937,6 @@ read_from_cmd_socket(void *anything) /* This should be already handled */ assert(0); } else { - allowed = 0; - /* Check level of authority required to issue the command */ switch(permissions[rx_command]) { case PERMIT_AUTH: @@ -1960,6 +1958,7 @@ read_from_cmd_socket(void *anything) break; default: assert(0); + allowed = 0; } if (allowed) { diff --git a/ntp_core.c b/ntp_core.c index 31f69efb..0db12fd9 100644 --- a/ntp_core.c +++ b/ntp_core.c @@ -1548,6 +1548,8 @@ NCR_SlewTimes(NCR_Instance inst, struct timeval *when, double dfreq, double doff #ifdef TRACEON LOG(LOGS_INFO, LOGF_NtpCore, "rx prev=[%s] new=[%s]", UTI_TimevalToString(&prev), UTI_TimevalToString(&inst->local_rx)); +#else + (void)prev; #endif prev = inst->local_tx; if (inst->local_tx.tv_sec || inst->local_tx.tv_usec) diff --git a/sourcestats.c b/sourcestats.c index 8df77400..bde12619 100644 --- a/sourcestats.c +++ b/sourcestats.c @@ -631,7 +631,7 @@ SST_SlewSamples(SST_Stats inst, struct timeval *when, double dfreq, double doffs i, UTI_TimevalToString(&prev), UTI_TimevalToString(sample), prev_offset, inst->offsets[i]); #else - (void)prev_offset; + (void)prev; (void)prev_offset; #endif } @@ -650,7 +650,7 @@ SST_SlewSamples(SST_Stats inst, struct timeval *when, double dfreq, double doffs prev_offset, inst->estimated_offset, 1.0e6*prev_freq, 1.0e6*inst->estimated_frequency); #else - (void)prev; (void)prev_freq; + (void)prev; (void)prev_offset; (void)prev_freq; #endif } -- 2.47.3