Fix warnings produced by latest gcc

This commit is contained in:
Miroslav Lichvar 2011-02-15 18:55:34 +01:00
parent 680612cf09
commit 896dad9224
7 changed files with 20 additions and 14 deletions

View file

@ -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));

View file

@ -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 {

View file

@ -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
}

View file

@ -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
}
}

View file

@ -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)

View file

@ -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; i<n_samples; i++) {
rtc_rel[i] = rtc_trim[i] + (double)(rtc_sec[i] - rtc_ref);
offsets[i] = ((double) (rtc_ref - system_times[i].tv_sec) -
@ -307,6 +305,8 @@ slew_samples
dfreq, doffset,
old_seconds_fast, 1.0e6 * old_gain_rate,
coef_seconds_fast, 1.0e6 * coef_gain_rate);
#else
(void)old_seconds_fast; (void)old_gain_rate;
#endif
}

View file

@ -572,6 +572,8 @@ SST_GetSelectionData(SST_Stats inst, struct timeval *now,
LOG(LOGS_INFO, LOGF_SourceStats, "n=%d off=%f del=%f dis=%f var=%f pdist=%f avoff=%f avok=%d selok=%d",
inst->n_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;