From 896dad922444126e58a53394673bac4b72ae972c Mon Sep 17 00:00:00 2001 From: Miroslav Lichvar Date: Tue, 15 Feb 2011 18:55:34 +0100 Subject: [PATCH] Fix warnings produced by latest gcc --- client.c | 4 ++-- local.c | 3 +-- ntp_core.c | 2 ++ refclock.c | 2 ++ reference.c | 2 +- rtc_linux.c | 6 +++--- sourcestats.c | 15 +++++++++------ 7 files changed, 20 insertions(+), 14 deletions(-) diff --git a/client.c b/client.c index a69f75c..0bee909 100644 --- a/client.c +++ b/client.c @@ -1787,7 +1787,7 @@ process_cmd_sourcestats(char *line) char hostname_buf[50]; unsigned long n_samples, n_runs, span_seconds; - double resid_freq_ppm, skew_ppm, sd, est_offset, est_offset_err; + double resid_freq_ppm, skew_ppm, sd, est_offset; unsigned long ref_id; IPAddr ip_addr; @@ -1827,7 +1827,7 @@ process_cmd_sourcestats(char *line) skew_ppm = UTI_FloatNetworkToHost(reply.data.sourcestats.skew_ppm); sd = UTI_FloatNetworkToHost(reply.data.sourcestats.sd); est_offset = UTI_FloatNetworkToHost(reply.data.sourcestats.est_offset); - est_offset_err = UTI_FloatNetworkToHost(reply.data.sourcestats.est_offset_err); + /* est_offset_err = UTI_FloatNetworkToHost(reply.data.sourcestats.est_offset_err); */ if (ip_addr.family == IPADDR_UNSPEC) snprintf(hostname_buf, sizeof(hostname_buf), "%s", UTI_RefidToString(ref_id)); diff --git a/local.c b/local.c index 7428f00..a48ff87 100644 --- a/local.c +++ b/local.c @@ -103,12 +103,11 @@ static double max_clock_error; static void calculate_sys_precision(void) { - struct timeval tv, old_tv, first_tv; + struct timeval tv, old_tv; int dusec, best_dusec; int iters; gettimeofday(&old_tv, NULL); - first_tv = old_tv; best_dusec = 1000000; /* Assume we must be better than a second */ iters = 0; do { diff --git a/ntp_core.c b/ntp_core.c index 2964e24..639b350 100644 --- a/ntp_core.c +++ b/ntp_core.c @@ -1661,6 +1661,8 @@ NCR_SlewTimes(NCR_Instance inst, struct timeval *when, double dfreq, double doff #ifdef TRACEON LOG(LOGS_INFO, LOGF_NtpCore, "tx prev=[%s] new=[%s]", UTI_TimevalToString(&prev), UTI_TimevalToString(&inst->local_tx)); +#else + (void)prev; #endif } diff --git a/refclock.c b/refclock.c index 5878a0a..3c2c929 100644 --- a/refclock.c +++ b/refclock.c @@ -867,6 +867,8 @@ filter_slew_samples(struct MedianFilter *filter, struct timeval *when, double df #if 0 LOG(LOGS_INFO, LOGF_Refclock, "i=%d old_off=%.9f new_off=%.9f", i, prev_offset, filter->samples[i].offset); +#else + (void)prev_offset; #endif } } diff --git a/reference.c b/reference.c index 146fc87..d12e439 100644 --- a/reference.c +++ b/reference.c @@ -363,7 +363,7 @@ schedule_fb_drift(struct timeval *now) UTI_DiffTimevalsToDouble(&unsynchronised, now, &last_ref_update); - for (c = 0, i = fb_drift_min; i <= fb_drift_max; i++) { + for (c = secs = 0, i = fb_drift_min; i <= fb_drift_max; i++) { secs = 1 << i; if (fb_drifts[i - fb_drift_min].secs < secs) diff --git a/rtc_linux.c b/rtc_linux.c index 5308fb8..5fbcf0c 100644 --- a/rtc_linux.c +++ b/rtc_linux.c @@ -232,14 +232,12 @@ run_regression(int new_sample, { double rtc_rel[MAX_SAMPLES]; /* Relative times on RTC axis */ double offsets[MAX_SAMPLES]; /* How much the RTC is fast of the system clock */ - int i, n; + int i; double est_intercept, est_slope; int best_new_start; if (n_samples > 0) { - n = n_samples - 1; - for (i=0; in_samples, *best_offset, *best_root_delay, *best_root_dispersion, *variance, peer_distance, average_offset, average_ok, *select_ok); +#else + (void)average_ok; #endif return; @@ -585,17 +587,14 @@ SST_GetTrackingData(SST_Stats inst, struct timeval *now, double *accrued_dispersion, double *frequency, double *skew) { - int i, j; - double peer_distance; + int i; double elapsed_offset, elapsed_sample; i = get_runsbuf_index(inst, inst->best_single_sample); - j = get_buf_index(inst, inst->best_single_sample); *frequency = inst->estimated_frequency; *skew = inst->skew; - peer_distance = inst->peer_dispersions[j] + 0.5 * inst->peer_delays[j]; UTI_DiffTimevalsToDouble(&elapsed_offset, now, &(inst->offset_time)); *average_offset = inst->estimated_offset + inst->estimated_frequency * elapsed_offset; *offset_sd = inst->estimated_offset_sd + elapsed_offset * inst->skew; @@ -604,8 +603,8 @@ SST_GetTrackingData(SST_Stats inst, struct timeval *now, *accrued_dispersion = inst->skew * elapsed_sample; #ifdef TRACEON - LOG(LOGS_INFO, LOGF_SourceStats, "n=%d freq=%f (%.3fppm) skew=%f (%.3fppm) pdist=%f avoff=%f offsd=%f accrdis=%f", - inst->n_samples, *frequency, 1.0e6* *frequency, *skew, 1.0e6* *skew, peer_distance, *average_offset, *offset_sd, *accrued_dispersion); + LOG(LOGS_INFO, LOGF_SourceStats, "n=%d freq=%f (%.3fppm) skew=%f (%.3fppm) avoff=%f offsd=%f accrdis=%f", + inst->n_samples, *frequency, 1.0e6* *frequency, *skew, 1.0e6* *skew, *average_offset, *offset_sd, *accrued_dispersion); #endif } @@ -631,6 +630,8 @@ SST_SlewSamples(SST_Stats inst, struct timeval *when, double dfreq, double doffs LOG(LOGS_INFO, LOGF_SourceStats, "i=%d old_st=[%s] new_st=[%s] old_off=%f new_off=%f", i, UTI_TimevalToString(&prev), UTI_TimevalToString(sample), prev_offset, inst->offsets[i]); +#else + (void)prev_offset; #endif } @@ -648,6 +649,8 @@ SST_SlewSamples(SST_Stats inst, struct timeval *when, double dfreq, double doffs UTI_TimevalToString(&prev), UTI_TimevalToString(&(inst->offset_time)), prev_offset, inst->estimated_offset, 1.0e6*prev_freq, 1.0e6*inst->estimated_frequency); +#else + (void)prev; (void)prev_freq; #endif return;