[tor-commits] [tor/master] Resolve some warnings from OSX clang.

nickm at torproject.org nickm at torproject.org
Sat Jun 11 14:16:58 UTC 2016


commit c3adbf755b0bb6f77488a268dbc4f2bdc0e59b01
Author: Nick Mathewson <nickm at torproject.org>
Date:   Wed Jun 1 16:35:00 2016 -0400

    Resolve some warnings from OSX clang.
---
 acinclude.m4            | 2 +-
 src/or/channeltls.c     | 2 +-
 src/test/test_channel.c | 2 +-
 src/test/test_util.c    | 9 ++++++---
 4 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/acinclude.m4 b/acinclude.m4
index 4b9f095..ab12317 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -75,7 +75,7 @@ dnl 1:flags
 dnl 2:also try to link (yes: non-empty string)
 dnl   will set yes or no in $tor_can_link_$1 (as modified by AS_VAR_PUSHDEF)
 AC_DEFUN([TOR_CHECK_CFLAGS], [
-  TOR_TRY_COMPILE_WITH_CFLAGS($1, $2, CFLAGS="$CFLAGS $1", /bin/true)
+  TOR_TRY_COMPILE_WITH_CFLAGS($1, $2, CFLAGS="$CFLAGS $1", true)
 ])
 
 dnl 1:flags
diff --git a/src/or/channeltls.c b/src/or/channeltls.c
index a7de986..5833b2a 100644
--- a/src/or/channeltls.c
+++ b/src/or/channeltls.c
@@ -445,7 +445,7 @@ channel_tls_free_method(channel_t *chan)
 static double
 channel_tls_get_overhead_estimate_method(channel_t *chan)
 {
-  double overhead = 1.0f;
+  double overhead = 1.0;
   channel_tls_t *tlschan = BASE_CHAN_TO_TLS(chan);
 
   tor_assert(tlschan);
diff --git a/src/test/test_channel.c b/src/test/test_channel.c
index 79bc5ac..f37e718 100644
--- a/src/test/test_channel.c
+++ b/src/test/test_channel.c
@@ -1584,7 +1584,7 @@ test_channel_queue_size(void *arg)
   /* One cell, times an overhead factor of 1.0 */
   tt_u64_op(ch->bytes_queued_for_xmit, ==, 512);
   /* Try a different overhead factor */
-  test_overhead_estimate = 0.5f;
+  test_overhead_estimate = 0.5;
   /* This one should be ignored since it's below 1.0 */
   channel_update_xmit_queue_size(ch);
   tt_u64_op(ch->bytes_queued_for_xmit, ==, 512);
diff --git a/src/test/test_util.c b/src/test/test_util.c
index 05c7d60..a09bb21 100644
--- a/src/test/test_util.c
+++ b/src/test/test_util.c
@@ -30,6 +30,9 @@
 #include <ctype.h>
 #include <float.h>
 
+#define INFINITY_DBL ((double)INFINITY)
+#define NAN_DBL ((double)NAN)
+
 /* XXXX this is a minimal wrapper to make the unit tests compile with the
  * changed tor_timegm interface. */
 static time_t
@@ -4392,7 +4395,7 @@ test_util_clamp_double_to_int64(void *arg)
 {
   (void)arg;
 
-  tt_i64_op(INT64_MIN, ==, clamp_double_to_int64(-INFINITY));
+  tt_i64_op(INT64_MIN, ==, clamp_double_to_int64(-INFINITY_DBL));
   tt_i64_op(INT64_MIN, ==,
             clamp_double_to_int64(-1.0 * pow(2.0, 64.0) - 1.0));
   tt_i64_op(INT64_MIN, ==,
@@ -4405,7 +4408,7 @@ test_util_clamp_double_to_int64(void *arg)
   tt_i64_op(0, ==, clamp_double_to_int64(-0.9));
   tt_i64_op(0, ==, clamp_double_to_int64(-0.1));
   tt_i64_op(0, ==, clamp_double_to_int64(0.0));
-  tt_i64_op(0, ==, clamp_double_to_int64(NAN));
+  tt_i64_op(0, ==, clamp_double_to_int64(NAN_DBL));
   tt_i64_op(0, ==, clamp_double_to_int64(0.1));
   tt_i64_op(0, ==, clamp_double_to_int64(0.9));
   tt_i64_op(1, ==, clamp_double_to_int64(1.0));
@@ -4417,7 +4420,7 @@ test_util_clamp_double_to_int64(void *arg)
             clamp_double_to_int64(pow(2.0, 63.0)));
   tt_i64_op(INT64_MAX, ==,
             clamp_double_to_int64(pow(2.0, 64.0)));
-  tt_i64_op(INT64_MAX, ==, clamp_double_to_int64(INFINITY));
+  tt_i64_op(INT64_MAX, ==, clamp_double_to_int64(INFINITY_DBL));
 
  done:
   ;





More information about the tor-commits mailing list