]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
Fix warnings produced by latest gcc
authorMiroslav Lichvar <mlichvar@redhat.com>
Tue, 15 Feb 2011 17:55:34 +0000 (18:55 +0100)
committerMiroslav Lichvar <mlichvar@redhat.com>
Tue, 15 Feb 2011 17:55:34 +0000 (18:55 +0100)
client.c
local.c
ntp_core.c
refclock.c
reference.c
rtc_linux.c
sourcestats.c

index a69f75c4351f0fb5a6441985fdf957a65d3afe45..0bee9092aea0cf84ca8bdefdc2a6bd44ec442196 100644 (file)
--- 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 7428f008a67eb20313e264180756fd4a82266940..a48ff879ceb9485df0728a7fe34930663a7a8909 100644 (file)
--- 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 {
index 2964e242cba5a9b14cc70b98bb51d664b3a321bb..639b350bfb90fb685a7100b3f21348c2432739fe 100644 (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
 }
 
index 5878a0a65fbbcf68746cd647083dcf8a24538cf5..3c2c92950083460a90e104a3954f703e1c6a06d2 100644 (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
   }
 }
index 146fc87a2586cd91d7b5f3ca6be8890ea1a2e5de..d12e439f80a740a5f9bd6622a71424761f1ce84d 100644 (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)
index 5308fb8266e3633264702f6a8ed81bd7472bd1a9..5fbcf0c90a36cf280b456b1f4b295131e7a20a49 100644 (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
 
 }
index 62bc98eb7b582edaa78b4d0f54f09a383e4fee44..7a7d3e80b837757da9fff420f7406060058a66b4 100644 (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;