Browse Source

Cleanup compilation warnings (#11810)

* Fix compilation warnings (variables used when debugging is enabled using NETDATA_INTERNAL_CHECKS)
* Fix compilation warning (casting)
Stelios Fragkakis 3 years ago
parent
commit
454387fcf4

+ 1 - 1
aclk/aclk_util.c

@@ -55,7 +55,7 @@ void aclk_env_t_destroy(aclk_env_t *env) {
 
 int aclk_env_has_capa(const char *capa)
 {
-    for (int i = 0; i < aclk_env->capability_count; i++) {
+    for (int i = 0; i < (int) aclk_env->capability_count; i++) {
         if (!strcasecmp(capa, aclk_env->capabilities[i]))
             return 1;
     }

+ 1 - 1
daemon/global_statistics.c

@@ -157,7 +157,7 @@ static inline void global_statistics_copy(struct global_statistics *gs, uint8_t
 
     if(options & GLOBAL_STATS_RESET_WEB_USEC_MAX) {
         uint64_t n = 0;
-        __atomic_compare_exchange(&global_statistics.web_usec_max, &gs->web_usec_max, &n, 1, __ATOMIC_SEQ_CST,
+        __atomic_compare_exchange(&global_statistics.web_usec_max, (uint64_t *) &gs->web_usec_max, &n, 1, __ATOMIC_SEQ_CST,
                                   __ATOMIC_SEQ_CST);
     }
 #else

+ 1 - 1
database/sqlite/sqlite_aclk_alert.c

@@ -374,7 +374,7 @@ void aclk_push_alarm_health_log(struct aclk_database_worker_config *wc, struct a
     wc->alert_sequence_id = last_sequence;
 
     aclk_send_alarm_log_health(&alarm_log);
-    log_access("OG [%s (%s)]: Alarm health log sent, first sequence id %ld, last sequence id %ld.", wc->node_id, wc->host ? wc->host->hostname : "N/A", first_sequence, last_sequence);
+    log_access("OG [%s (%s)]: Alarm health log sent, first sequence id %"PRIu64", last sequence id %"PRIu64, wc->node_id, wc->host ? wc->host->hostname : "N/A", first_sequence, last_sequence);
 
     rc = sqlite3_finalize(res);
     if (unlikely(rc != SQLITE_OK))

+ 2 - 2
database/sqlite/sqlite_aclk_chart.c

@@ -406,7 +406,7 @@ void aclk_send_chart_event(struct aclk_database_worker_config *wc, struct aclk_d
             db_unlock();
 
             aclk_chart_inst_and_dim_update(payload_list, payload_list_size, is_dim, position_list, wc->batch_id);
-            log_access("OG [%s (%s)]: Sending charts and dimensions update, batch_id %ld, first sequence %ld, last sequence %ld", wc->node_id, wc->host ? wc->host->hostname : "N/A", wc->batch_id, first_sequence, last_sequence);
+            log_access("OG [%s (%s)]: Sending charts and dimensions update, batch_id %"PRIu64", first sequence %"PRIu64", last sequence %"PRIu64, wc->node_id, wc->host ? wc->host->hostname : "N/A", wc->batch_id, first_sequence, last_sequence);
             wc->chart_sequence_id = last_sequence;
             wc->chart_timestamp = last_timestamp;
         }
@@ -519,7 +519,7 @@ void aclk_receive_chart_ack(struct aclk_database_worker_config *wc, struct aclk_
     int rc;
     sqlite3_stmt *res = NULL;
 
-    log_access("IN [%s (%s)]: Received ack chart sequence id %ld.", wc->node_id, wc->host ? wc->host->hostname : "N/A", cmd.param1);
+    log_access("IN [%s (%s)]: Received ack chart sequence id %"PRIu64, wc->node_id, wc->host ? wc->host->hostname : "N/A", cmd.param1);
 
     BUFFER *sql = buffer_create(1024);
 

+ 2 - 0
exporting/check_filters.c

@@ -43,7 +43,9 @@ int rrdhost_is_exportable(struct instance *instance, RRDHOST *host)
  */
 int rrdset_is_exportable(struct instance *instance, RRDSET *st)
 {
+#ifdef NETDATA_INTERNAL_CHECKS
     RRDHOST *host = st->rrdhost;
+#endif
 
     if (st->exporting_flags == NULL)
         st->exporting_flags = callocz(instance->engine->instance_num, sizeof(size_t));

+ 2 - 0
exporting/mongodb/mongodb.c

@@ -276,7 +276,9 @@ void mongodb_cleanup(struct instance *instance)
 void mongodb_connector_worker(void *instance_p)
 {
     struct instance *instance = (struct instance *)instance_p;
+#ifdef NETDATA_INTERNAL_CHECKS
     struct mongodb_specific_config *connector_specific_config = instance->config.connector_specific_config;
+#endif
     struct mongodb_specific_data *connector_specific_data =
         (struct mongodb_specific_data *)instance->connector_specific_data;
 

+ 2 - 0
exporting/process_data.c

@@ -70,7 +70,9 @@ calculated_number exporting_calculate_value_from_stored_data(
     time_t *last_timestamp)
 {
     RRDSET *st = rd->rrdset;
+#ifdef NETDATA_INTERNAL_CHECKS
     RRDHOST *host = st->rrdhost;
+#endif
     time_t after = instance->after;
     time_t before = instance->before;
 

+ 2 - 0
exporting/prometheus/prometheus.c

@@ -16,7 +16,9 @@
  */
 inline int can_send_rrdset(struct instance *instance, RRDSET *st)
 {
+#ifdef NETDATA_INTERNAL_CHECKS
     RRDHOST *host = st->rrdhost;
+#endif
 
     if (unlikely(rrdset_flag_check(st, RRDSET_FLAG_EXPORTING_IGNORE)))
         return 0;

+ 1 - 2
streaming/receiver.c

@@ -346,13 +346,12 @@ static int rrdpush_receive(struct receiver_state *rpt)
         netdata_mutex_unlock(&rpt->host->receiver_lock);
     }
 
+#ifdef NETDATA_INTERNAL_CHECKS
     int ssl = 0;
 #ifdef ENABLE_HTTPS
     if (rpt->ssl.conn != NULL)
         ssl = 1;
 #endif
-
-#ifdef NETDATA_INTERNAL_CHECKS
     info("STREAM %s [receive from [%s]:%s]: client willing to stream metrics for host '%s' with machine_guid '%s': update every = %d, history = %ld, memory mode = %s, health %s,%s tags '%s'"
          , rpt->hostname
          , rpt->client_ip

+ 2 - 0
streaming/sender.c

@@ -427,7 +427,9 @@ void attempt_to_send(struct sender_state *s) {
 
     rrdpush_send_labels(s->host);
 
+#ifdef NETDATA_INTERNAL_CHECKS
     struct circular_buffer *cb = s->buffer;
+#endif
 
     netdata_thread_disable_cancelability();
     netdata_mutex_lock(&s->mutex);

Some files were not shown because too many files changed in this diff