[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/master] Return U64_PRINTF_ARG and U64_FORMAT



commit 9568c0ce3d3885a41ca44ac030b04d089ac56a40
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date:   Tue Jul 3 10:40:59 2018 -0400

    Return U64_PRINTF_ARG and U64_FORMAT
    
    The standard is printf("%"PRIu64, x);
---
 src/lib/cc/compat_compiler.h |   5 -
 src/lib/time/tvdiff.c        |  20 +--
 src/lib/wallclock/tm_cvt.c   |   4 +-
 src/or/channel.c             | 290 +++++++++++++++++++++----------------------
 src/or/channelpadding.c      |  26 ++--
 src/or/channeltls.c          |  72 +++++------
 src/or/circuitbuild.c        |  16 +--
 src/or/circuitlist.c         |  17 ++-
 src/or/circuitmux.c          |  58 ++++-----
 src/or/circuitstats.c        |   4 +-
 src/or/circuituse.c          |  11 +-
 src/or/command.c             |   4 +-
 src/or/config.c              |   8 +-
 src/or/confparse.c           |   4 +-
 src/or/connection.c          |  12 +-
 src/or/connection_edge.c     |   4 +-
 src/or/connection_or.c       |   4 +-
 src/or/control.c             |  40 +++---
 src/or/dirauth/dirvote.c     |  56 ++++-----
 src/or/directory.c           |  12 +-
 src/or/geoip.c               |   8 +-
 src/or/hibernate.c           |  30 ++---
 src/or/main.c                |  44 +++----
 src/or/microdesc.c           |   6 +-
 src/or/rephist.c             | 128 +++++++++----------
 src/or/router.c              |   4 +-
 src/or/routerlist.c          |   8 +-
 src/or/routerparse.c         | 168 ++++++++++++-------------
 src/or/scheduler_vanilla.c   |  16 +--
 src/or/status.c              |  14 +--
 src/test/test-timers.c       |   4 +-
 src/test/test_util.c         |   6 +-
 32 files changed, 548 insertions(+), 555 deletions(-)

diff --git a/src/lib/cc/compat_compiler.h b/src/lib/cc/compat_compiler.h
index f14e48813..42ceeadd3 100644
--- a/src/lib/cc/compat_compiler.h
+++ b/src/lib/cc/compat_compiler.h
@@ -188,11 +188,6 @@
 #define MINGW_ANY
 #endif
 
-#define U64_PRINTF_ARG(a) ((uint64_t)a)
-#define I64_PRINTF_ARG(a) ((int64_t)a)
-#define U64_FORMAT "%"PRIu64
-#define I64_FORMAT "%"PRId64
-
 /** Macro: yield a pointer to the field at position <b>off</b> within the
  * structure <b>st</b>.  Example:
  * <pre>
diff --git a/src/lib/time/tvdiff.c b/src/lib/time/tvdiff.c
index 5dbc0fd19..0af45a208 100644
--- a/src/lib/time/tvdiff.c
+++ b/src/lib/time/tvdiff.c
@@ -51,15 +51,15 @@ tv_udiff(const struct timeval *start, const struct timeval *end)
   /* Sanity check tv_usec */
   if (start->tv_usec > TOR_USEC_PER_SEC || start->tv_usec < 0) {
     log_warn(LD_GENERAL, "comparing times on microsecond detail with bad "
-             "start tv_usec: " I64_FORMAT " microseconds",
-             I64_PRINTF_ARG(start->tv_usec));
+             "start tv_usec: %"PRId64 " microseconds",
+             (start->tv_usec));
     return LONG_MAX;
   }
 
   if (end->tv_usec > TOR_USEC_PER_SEC || end->tv_usec < 0) {
     log_warn(LD_GENERAL, "comparing times on microsecond detail with bad "
-             "end tv_usec: " I64_FORMAT " microseconds",
-             I64_PRINTF_ARG(end->tv_usec));
+             "end tv_usec: %"PRId64 " microseconds",
+             (end->tv_usec));
     return LONG_MAX;
   }
 
@@ -72,7 +72,7 @@ tv_udiff(const struct timeval *start, const struct timeval *end)
   if (secdiff > (int64_t)(LONG_MAX/1000000 - 1) ||
       secdiff < (int64_t)(LONG_MIN/1000000 + 1)) {
     log_warn(LD_GENERAL, "comparing times on microsecond detail too far "
-             "apart: " I64_FORMAT " seconds", I64_PRINTF_ARG(secdiff));
+             "apart: %"PRId64 " seconds", (secdiff));
     return LONG_MAX;
   }
 
@@ -100,15 +100,15 @@ tv_mdiff(const struct timeval *start, const struct timeval *end)
   /* Sanity check tv_usec */
   if (start->tv_usec > TOR_USEC_PER_SEC || start->tv_usec < 0) {
     log_warn(LD_GENERAL, "comparing times on millisecond detail with bad "
-             "start tv_usec: " I64_FORMAT " microseconds",
-             I64_PRINTF_ARG(start->tv_usec));
+             "start tv_usec: %"PRId64 " microseconds",
+             (start->tv_usec));
     return LONG_MAX;
   }
 
   if (end->tv_usec > TOR_USEC_PER_SEC || end->tv_usec < 0) {
     log_warn(LD_GENERAL, "comparing times on millisecond detail with bad "
-             "end tv_usec: " I64_FORMAT " microseconds",
-             I64_PRINTF_ARG(end->tv_usec));
+             "end tv_usec: %"PRId64 " microseconds",
+             (end->tv_usec));
     return LONG_MAX;
   }
 
@@ -124,7 +124,7 @@ tv_mdiff(const struct timeval *start, const struct timeval *end)
   if (secdiff > (int64_t)(LONG_MAX/1000 - 2) ||
       secdiff < (int64_t)(LONG_MIN/1000 + 1)) {
     log_warn(LD_GENERAL, "comparing times on millisecond detail too far "
-             "apart: " I64_FORMAT " seconds", I64_PRINTF_ARG(secdiff));
+             "apart: %"PRId64 " seconds", (secdiff));
     return LONG_MAX;
   }
 
diff --git a/src/lib/wallclock/tm_cvt.c b/src/lib/wallclock/tm_cvt.c
index 987b0ffeb..0a1a1cd43 100644
--- a/src/lib/wallclock/tm_cvt.c
+++ b/src/lib/wallclock/tm_cvt.c
@@ -100,9 +100,9 @@ correct_tm(int islocal, const time_t *timep, struct tm *resultbuf,
   /* LCOV_EXCL_STOP */
  done:
   if (err_out) {
-    tor_asprintf(err_out, "%s("I64_FORMAT") failed with error %s: %s",
+    tor_asprintf(err_out, "%s(%"PRId64") failed with error %s: %s",
                  islocal?"localtime":"gmtime",
-                 timep?I64_PRINTF_ARG(*timep):0,
+                 timep?(*timep):0,
                  strerror(errno),
                  outcome);
   }
diff --git a/src/or/channel.c b/src/or/channel.c
index ac1960ae0..9b57eccd7 100644
--- a/src/or/channel.c
+++ b/src/or/channel.c
@@ -390,9 +390,9 @@ channel_register(channel_t *chan)
   if (chan->registered) return;
 
   log_debug(LD_CHANNEL,
-            "Registering channel %p (ID " U64_FORMAT ") "
+            "Registering channel %p (ID %"PRIu64 ") "
             "in state %s (%d) with digest %s",
-            chan, U64_PRINTF_ARG(chan->global_identifier),
+            chan, (chan->global_identifier),
             channel_state_to_string(chan->state), chan->state,
             hex_str(chan->identity_digest, DIGEST_LEN));
 
@@ -420,9 +420,9 @@ channel_register(channel_t *chan)
         channel_add_to_digest_map(chan);
       } else {
         log_info(LD_CHANNEL,
-                "Channel %p (global ID " U64_FORMAT ") "
+                "Channel %p (global ID %"PRIu64 ") "
                 "in state %s (%d) registered with no identity digest",
-                chan, U64_PRINTF_ARG(chan->global_identifier),
+                chan, (chan->global_identifier),
                 channel_state_to_string(chan->state), chan->state);
       }
     }
@@ -486,9 +486,9 @@ channel_listener_register(channel_listener_t *chan_l)
   if (chan_l->registered) return;
 
   log_debug(LD_CHANNEL,
-            "Registering channel listener %p (ID " U64_FORMAT ") "
+            "Registering channel listener %p (ID %"PRIu64 ") "
             "in state %s (%d)",
-            chan_l, U64_PRINTF_ARG(chan_l->global_identifier),
+            chan_l, (chan_l->global_identifier),
             channel_listener_state_to_string(chan_l->state),
             chan_l->state);
 
@@ -578,9 +578,9 @@ channel_add_to_digest_map(channel_t *chan)
   TOR_LIST_INSERT_HEAD(&ent->channel_list, chan, next_with_same_id);
 
   log_debug(LD_CHANNEL,
-            "Added channel %p (global ID " U64_FORMAT ") "
+            "Added channel %p (global ID %"PRIu64 ") "
             "to identity map in state %s (%d) with digest %s",
-            chan, U64_PRINTF_ARG(chan->global_identifier),
+            chan, (chan->global_identifier),
             channel_state_to_string(chan->state), chan->state,
             hex_str(chan->identity_digest, DIGEST_LEN));
 }
@@ -617,18 +617,18 @@ channel_remove_from_digest_map(channel_t *chan)
     }
 
     log_debug(LD_CHANNEL,
-              "Removed channel %p (global ID " U64_FORMAT ") from "
+              "Removed channel %p (global ID %"PRIu64 ") from "
               "identity map in state %s (%d) with digest %s",
-              chan, U64_PRINTF_ARG(chan->global_identifier),
+              chan, (chan->global_identifier),
               channel_state_to_string(chan->state), chan->state,
               hex_str(chan->identity_digest, DIGEST_LEN));
   } else {
     /* Shouldn't happen */
     log_warn(LD_BUG,
-             "Trying to remove channel %p (global ID " U64_FORMAT ") with "
+             "Trying to remove channel %p (global ID %"PRIu64 ") with "
              "digest %s from identity map, but couldn't find any with "
              "that digest",
-             chan, U64_PRINTF_ARG(chan->global_identifier),
+             chan, (chan->global_identifier),
              hex_str(chan->identity_digest, DIGEST_LEN));
   }
 }
@@ -882,8 +882,8 @@ channel_free_(channel_t *chan)
   tor_assert(!(chan->registered));
 
   log_debug(LD_CHANNEL,
-            "Freeing channel " U64_FORMAT " at %p",
-            U64_PRINTF_ARG(chan->global_identifier), chan);
+            "Freeing channel %"PRIu64 " at %p",
+            (chan->global_identifier), chan);
 
   /* Get this one out of the scheduler */
   scheduler_release_channel(chan);
@@ -928,8 +928,8 @@ channel_listener_free_(channel_listener_t *chan_l)
   if (!chan_l) return;
 
   log_debug(LD_CHANNEL,
-            "Freeing channel_listener_t " U64_FORMAT " at %p",
-            U64_PRINTF_ARG(chan_l->global_identifier),
+            "Freeing channel_listener_t %"PRIu64 " at %p",
+            (chan_l->global_identifier),
             chan_l);
 
   /* It must be closed or errored */
@@ -955,8 +955,8 @@ channel_force_xfree(channel_t *chan)
   tor_assert(chan);
 
   log_debug(LD_CHANNEL,
-            "Force-freeing channel " U64_FORMAT " at %p",
-            U64_PRINTF_ARG(chan->global_identifier), chan);
+            "Force-freeing channel %"PRIu64 " at %p",
+            (chan->global_identifier), chan);
 
   /* Get this one out of the scheduler */
   scheduler_release_channel(chan);
@@ -999,8 +999,8 @@ channel_listener_force_xfree(channel_listener_t *chan_l)
   tor_assert(chan_l);
 
   log_debug(LD_CHANNEL,
-            "Force-freeing channel_listener_t " U64_FORMAT " at %p",
-            U64_PRINTF_ARG(chan_l->global_identifier),
+            "Force-freeing channel_listener_t %"PRIu64 " at %p",
+            (chan_l->global_identifier),
             chan_l);
 
   /* Call a free method if there is one */
@@ -1039,8 +1039,8 @@ channel_listener_set_listener_fn(channel_listener_t *chan_l,
 
   log_debug(LD_CHANNEL,
            "Setting listener callback for channel listener %p "
-           "(global ID " U64_FORMAT ") to %p",
-           chan_l, U64_PRINTF_ARG(chan_l->global_identifier),
+           "(global ID %"PRIu64 ") to %p",
+           chan_l, (chan_l->global_identifier),
            listener);
 
   chan_l->listener = listener;
@@ -1139,9 +1139,9 @@ channel_mark_for_close(channel_t *chan)
     return;
 
   log_debug(LD_CHANNEL,
-            "Closing channel %p (global ID " U64_FORMAT ") "
+            "Closing channel %p (global ID %"PRIu64 ") "
             "by request",
-            chan, U64_PRINTF_ARG(chan->global_identifier));
+            chan, (chan->global_identifier));
 
   /* Note closing by request from above */
   chan->reason_for_closing = CHANNEL_CLOSE_REQUESTED;
@@ -1179,9 +1179,9 @@ channel_listener_mark_for_close(channel_listener_t *chan_l)
       chan_l->state == CHANNEL_LISTENER_STATE_ERROR) return;
 
   log_debug(LD_CHANNEL,
-            "Closing channel listener %p (global ID " U64_FORMAT ") "
+            "Closing channel listener %p (global ID %"PRIu64 ") "
             "by request",
-            chan_l, U64_PRINTF_ARG(chan_l->global_identifier));
+            chan_l, (chan_l->global_identifier));
 
   /* Note closing by request from above */
   chan_l->reason_for_closing = CHANNEL_LISTENER_CLOSE_REQUESTED;
@@ -1217,9 +1217,9 @@ channel_close_from_lower_layer(channel_t *chan)
     return;
 
   log_debug(LD_CHANNEL,
-            "Closing channel %p (global ID " U64_FORMAT ") "
+            "Closing channel %p (global ID %"PRIu64 ") "
             "due to lower-layer event",
-            chan, U64_PRINTF_ARG(chan->global_identifier));
+            chan, (chan->global_identifier));
 
   /* Note closing by event from below */
   chan->reason_for_closing = CHANNEL_CLOSE_FROM_BELOW;
@@ -1302,8 +1302,8 @@ channel_clear_identity_digest(channel_t *chan)
 
   log_debug(LD_CHANNEL,
             "Clearing remote endpoint digest on channel %p with "
-            "global ID " U64_FORMAT,
-            chan, U64_PRINTF_ARG(chan->global_identifier));
+            "global ID %"PRIu64,
+            chan, (chan->global_identifier));
 
   state_not_in_map = CHANNEL_CONDEMNED(chan);
 
@@ -1333,8 +1333,8 @@ channel_set_identity_digest(channel_t *chan,
 
   log_debug(LD_CHANNEL,
             "Setting remote endpoint digest on channel %p with "
-            "global ID " U64_FORMAT " to digest %s",
-            chan, U64_PRINTF_ARG(chan->global_identifier),
+            "global ID %"PRIu64 " to digest %s",
+            chan, (chan->global_identifier),
             identity_digest ?
               hex_str(identity_digest, DIGEST_LEN) : "(null)");
 
@@ -1390,8 +1390,8 @@ channel_clear_remote_end(channel_t *chan)
 
   log_debug(LD_CHANNEL,
             "Clearing remote endpoint identity on channel %p with "
-            "global ID " U64_FORMAT,
-            chan, U64_PRINTF_ARG(chan->global_identifier));
+            "global ID %"PRIu64,
+            chan, (chan->global_identifier));
 
   state_not_in_map = CHANNEL_CONDEMNED(chan);
 
@@ -1474,13 +1474,13 @@ channel_write_packed_cell(channel_t *chan, packed_cell_t *cell)
 
   if (CHANNEL_IS_CLOSING(chan)) {
     log_debug(LD_CHANNEL, "Discarding %p on closing channel %p with "
-              "global ID "U64_FORMAT, cell, chan,
-              U64_PRINTF_ARG(chan->global_identifier));
+              "global ID %"PRIu64, cell, chan,
+              (chan->global_identifier));
     goto end;
   }
   log_debug(LD_CHANNEL,
             "Writing %p to channel %p with global ID "
-            U64_FORMAT, cell, chan, U64_PRINTF_ARG(chan->global_identifier));
+            "%"PRIu64, cell, chan, (chan->global_identifier));
 
   ret = write_packed_cell(chan, cell);
 
@@ -1517,9 +1517,9 @@ channel_change_state_(channel_t *chan, channel_state_t to_state)
   if (from_state == to_state) {
     log_debug(LD_CHANNEL,
               "Got no-op transition from \"%s\" to itself on channel %p"
-              "(global ID " U64_FORMAT ")",
+              "(global ID %"PRIu64 ")",
               channel_state_to_string(to_state),
-              chan, U64_PRINTF_ARG(chan->global_identifier));
+              chan, (chan->global_identifier));
     return;
   }
 
@@ -1531,10 +1531,10 @@ channel_change_state_(channel_t *chan, channel_state_t to_state)
   }
 
   log_debug(LD_CHANNEL,
-            "Changing state of channel %p (global ID " U64_FORMAT
+            "Changing state of channel %p (global ID %"PRIu64
             ") from \"%s\" to \"%s\"",
             chan,
-            U64_PRINTF_ARG(chan->global_identifier),
+            (chan->global_identifier),
             channel_state_to_string(chan->state),
             channel_state_to_string(to_state));
 
@@ -1637,9 +1637,9 @@ channel_listener_change_state(channel_listener_t *chan_l,
   if (from_state == to_state) {
     log_debug(LD_CHANNEL,
               "Got no-op transition from \"%s\" to itself on channel "
-              "listener %p (global ID " U64_FORMAT ")",
+              "listener %p (global ID %"PRIu64 ")",
               channel_listener_state_to_string(to_state),
-              chan_l, U64_PRINTF_ARG(chan_l->global_identifier));
+              chan_l, (chan_l->global_identifier));
     return;
   }
 
@@ -1651,9 +1651,9 @@ channel_listener_change_state(channel_listener_t *chan_l,
   }
 
   log_debug(LD_CHANNEL,
-            "Changing state of channel listener %p (global ID " U64_FORMAT
+            "Changing state of channel listener %p (global ID %"PRIu64
             "from \"%s\" to \"%s\"",
-            chan_l, U64_PRINTF_ARG(chan_l->global_identifier),
+            chan_l, (chan_l->global_identifier),
             channel_listener_state_to_string(chan_l->state),
             channel_listener_state_to_string(to_state));
 
@@ -1802,8 +1802,8 @@ channel_listener_process_incoming(channel_listener_t *listener)
 
   log_debug(LD_CHANNEL,
             "Processing queue of incoming connections for channel "
-            "listener %p (global ID " U64_FORMAT ")",
-            listener, U64_PRINTF_ARG(listener->global_identifier));
+            "listener %p (global ID %"PRIu64 ")",
+            listener, (listener->global_identifier));
 
   if (!(listener->incoming_list)) return;
 
@@ -1812,12 +1812,12 @@ channel_listener_process_incoming(channel_listener_t *listener)
     tor_assert(chan);
 
     log_debug(LD_CHANNEL,
-              "Handling incoming channel %p (" U64_FORMAT ") "
-              "for listener %p (" U64_FORMAT ")",
+              "Handling incoming channel %p (%"PRIu64 ") "
+              "for listener %p (%"PRIu64 ")",
               chan,
-              U64_PRINTF_ARG(chan->global_identifier),
+              (chan->global_identifier),
               listener,
-              U64_PRINTF_ARG(listener->global_identifier));
+              (listener->global_identifier));
     /* Make sure this is set correctly */
     channel_mark_incoming(chan);
     listener->listener(listener, chan);
@@ -1923,10 +1923,10 @@ channel_listener_queue_incoming(channel_listener_t *listener,
   tor_assert(incoming);
 
   log_debug(LD_CHANNEL,
-            "Queueing incoming channel %p (global ID " U64_FORMAT ") on "
-            "channel listener %p (global ID " U64_FORMAT ")",
-            incoming, U64_PRINTF_ARG(incoming->global_identifier),
-            listener, U64_PRINTF_ARG(listener->global_identifier));
+            "Queueing incoming channel %p (global ID %"PRIu64 ") on "
+            "channel listener %p (global ID %"PRIu64 ")",
+            incoming, (incoming->global_identifier),
+            listener, (listener->global_identifier));
 
   /* Do we need to queue it, or can we just call the listener right away? */
   if (!(listener->listener)) need_to_queue = 1;
@@ -1983,8 +1983,8 @@ channel_process_cell(channel_t *chan, cell_t *cell)
 
   log_debug(LD_CHANNEL,
             "Processing incoming cell_t %p for channel %p (global ID "
-            U64_FORMAT ")", cell, chan,
-            U64_PRINTF_ARG(chan->global_identifier));
+            "%"PRIu64 ")", cell, chan,
+            (chan->global_identifier));
   chan->cell_handler(chan, cell);
 }
 
@@ -2024,8 +2024,8 @@ channel_send_destroy(circid_t circ_id, channel_t *chan, int reason)
   tor_assert(chan);
   if (circ_id == 0) {
     log_warn(LD_BUG, "Attempted to send a destroy cell for circID 0 "
-             "on a channel " U64_FORMAT " at %p in state %s (%d)",
-             U64_PRINTF_ARG(chan->global_identifier),
+             "on a channel %"PRIu64 " at %p in state %s (%d)",
+             (chan->global_identifier),
              chan, channel_state_to_string(chan->state),
              chan->state);
     return 0;
@@ -2037,14 +2037,14 @@ channel_send_destroy(circid_t circ_id, channel_t *chan, int reason)
     circuitmux_append_destroy_cell(chan, chan->cmux, circ_id, reason);
     log_debug(LD_OR,
               "Sending destroy (circID %u) on channel %p "
-              "(global ID " U64_FORMAT ")",
+              "(global ID %"PRIu64 ")",
               (unsigned)circ_id, chan,
-              U64_PRINTF_ARG(chan->global_identifier));
+              (chan->global_identifier));
   } else {
     log_warn(LD_BUG,
              "Someone called channel_send_destroy() for circID %u "
-             "on a channel " U64_FORMAT " at %p in state %s (%d)",
-             (unsigned)circ_id, U64_PRINTF_ARG(chan->global_identifier),
+             "on a channel %"PRIu64 " at %p in state %s (%d)",
+             (unsigned)circ_id, (chan->global_identifier),
              chan, channel_state_to_string(chan->state),
              chan->state);
   }
@@ -2178,9 +2178,9 @@ channel_free_list(smartlist_t *channels, int mark_for_close)
     /* Deregister and free it */
     tor_assert(curr);
     log_debug(LD_CHANNEL,
-              "Cleaning up channel %p (global ID " U64_FORMAT ") "
+              "Cleaning up channel %p (global ID %"PRIu64 ") "
               "in state %s (%d)",
-              curr, U64_PRINTF_ARG(curr->global_identifier),
+              curr, (curr->global_identifier),
               channel_state_to_string(curr->state), curr->state);
     /* Detach circuits early so they can find the channel */
     if (curr->cmux) {
@@ -2209,9 +2209,9 @@ channel_listener_free_list(smartlist_t *listeners, int mark_for_close)
     /* Deregister and free it */
     tor_assert(curr);
     log_debug(LD_CHANNEL,
-              "Cleaning up channel listener %p (global ID " U64_FORMAT ") "
+              "Cleaning up channel listener %p (global ID %"PRIu64 ") "
               "in state %s (%d)",
-              curr, U64_PRINTF_ARG(curr->global_identifier),
+              curr, (curr->global_identifier),
               channel_listener_state_to_string(curr->state), curr->state);
     channel_listener_unregister(curr);
     if (mark_for_close) {
@@ -2534,33 +2534,33 @@ channel_dump_statistics, (channel_t *chan, int severity))
   age = (double)(now - chan->timestamp_created);
 
   tor_log(severity, LD_GENERAL,
-      "Channel " U64_FORMAT " (at %p) with transport %s is in state "
+      "Channel %"PRIu64 " (at %p) with transport %s is in state "
       "%s (%d)",
-      U64_PRINTF_ARG(chan->global_identifier), chan,
+      (chan->global_identifier), chan,
       channel_describe_transport(chan),
       channel_state_to_string(chan->state), chan->state);
   tor_log(severity, LD_GENERAL,
-      " * Channel " U64_FORMAT " was created at " U64_FORMAT
-      " (" U64_FORMAT " seconds ago) "
-      "and last active at " U64_FORMAT " (" U64_FORMAT " seconds ago)",
-      U64_PRINTF_ARG(chan->global_identifier),
-      U64_PRINTF_ARG(chan->timestamp_created),
-      U64_PRINTF_ARG(now - chan->timestamp_created),
-      U64_PRINTF_ARG(chan->timestamp_active),
-      U64_PRINTF_ARG(now - chan->timestamp_active));
+      " * Channel %"PRIu64 " was created at %"PRIu64
+      " (%"PRIu64 " seconds ago) "
+      "and last active at %"PRIu64 " (%"PRIu64 " seconds ago)",
+      (chan->global_identifier),
+      (chan->timestamp_created),
+      (now - chan->timestamp_created),
+      (chan->timestamp_active),
+      (now - chan->timestamp_active));
 
   /* Handle digest. */
   if (!tor_digest_is_zero(chan->identity_digest)) {
     tor_log(severity, LD_GENERAL,
-        " * Channel " U64_FORMAT " says it is connected "
+        " * Channel %"PRIu64 " says it is connected "
         "to an OR with digest %s",
-        U64_PRINTF_ARG(chan->global_identifier),
+        (chan->global_identifier),
         hex_str(chan->identity_digest, DIGEST_LEN));
   } else {
     tor_log(severity, LD_GENERAL,
-        " * Channel " U64_FORMAT " does not know the digest"
+        " * Channel %"PRIu64 " does not know the digest"
         " of the OR it is connected to",
-        U64_PRINTF_ARG(chan->global_identifier));
+        (chan->global_identifier));
   }
 
   /* Handle remote address and descriptions */
@@ -2569,10 +2569,10 @@ channel_dump_statistics, (channel_t *chan, int severity))
     char *actual = tor_strdup(channel_get_actual_remote_descr(chan));
     remote_addr_str = tor_addr_to_str_dup(&remote_addr);
     tor_log(severity, LD_GENERAL,
-        " * Channel " U64_FORMAT " says its remote address"
+        " * Channel %"PRIu64 " says its remote address"
         " is %s, and gives a canonical description of \"%s\" and an "
         "actual description of \"%s\"",
-        U64_PRINTF_ARG(chan->global_identifier),
+        (chan->global_identifier),
         safe_str(remote_addr_str),
         safe_str(channel_get_canonical_remote_descr(chan)),
         safe_str(actual));
@@ -2581,10 +2581,10 @@ channel_dump_statistics, (channel_t *chan, int severity))
   } else {
     char *actual = tor_strdup(channel_get_actual_remote_descr(chan));
     tor_log(severity, LD_GENERAL,
-        " * Channel " U64_FORMAT " does not know its remote "
+        " * Channel %"PRIu64 " does not know its remote "
         "address, but gives a canonical description of \"%s\" and an "
         "actual description of \"%s\"",
-        U64_PRINTF_ARG(chan->global_identifier),
+        (chan->global_identifier),
         channel_get_canonical_remote_descr(chan),
         actual);
     tor_free(actual);
@@ -2592,9 +2592,9 @@ channel_dump_statistics, (channel_t *chan, int severity))
 
   /* Handle marks */
   tor_log(severity, LD_GENERAL,
-      " * Channel " U64_FORMAT " has these marks: %s %s %s "
+      " * Channel %"PRIu64 " has these marks: %s %s %s "
       "%s %s %s",
-      U64_PRINTF_ARG(chan->global_identifier),
+      (chan->global_identifier),
       channel_is_bad_for_new_circs(chan) ?
         "bad_for_new_circs" : "!bad_for_new_circs",
       channel_is_canonical(chan) ?
@@ -2611,9 +2611,9 @@ channel_dump_statistics, (channel_t *chan, int severity))
 
   /* Describe circuits */
   tor_log(severity, LD_GENERAL,
-      " * Channel " U64_FORMAT " has %d active circuits out of"
+      " * Channel %"PRIu64 " has %d active circuits out of"
       " %d in total",
-      U64_PRINTF_ARG(chan->global_identifier),
+      (chan->global_identifier),
       (chan->cmux != NULL) ?
          circuitmux_num_active_circuits(chan->cmux) : 0,
       (chan->cmux != NULL) ?
@@ -2621,78 +2621,78 @@ channel_dump_statistics, (channel_t *chan, int severity))
 
   /* Describe timestamps */
   tor_log(severity, LD_GENERAL,
-      " * Channel " U64_FORMAT " was last used by a "
-      "client at " U64_FORMAT " (" U64_FORMAT " seconds ago)",
-      U64_PRINTF_ARG(chan->global_identifier),
-      U64_PRINTF_ARG(chan->timestamp_client),
-      U64_PRINTF_ARG(now - chan->timestamp_client));
+      " * Channel %"PRIu64 " was last used by a "
+      "client at %"PRIu64 " (%"PRIu64 " seconds ago)",
+      (chan->global_identifier),
+      (chan->timestamp_client),
+      (now - chan->timestamp_client));
   tor_log(severity, LD_GENERAL,
-      " * Channel " U64_FORMAT " last received a cell "
-      "at " U64_FORMAT " (" U64_FORMAT " seconds ago)",
-      U64_PRINTF_ARG(chan->global_identifier),
-      U64_PRINTF_ARG(chan->timestamp_recv),
-      U64_PRINTF_ARG(now - chan->timestamp_recv));
+      " * Channel %"PRIu64 " last received a cell "
+      "at %"PRIu64 " (%"PRIu64 " seconds ago)",
+      (chan->global_identifier),
+      (chan->timestamp_recv),
+      (now - chan->timestamp_recv));
   tor_log(severity, LD_GENERAL,
-      " * Channel " U64_FORMAT " last transmitted a cell "
-      "at " U64_FORMAT " (" U64_FORMAT " seconds ago)",
-      U64_PRINTF_ARG(chan->global_identifier),
-      U64_PRINTF_ARG(chan->timestamp_xmit),
-      U64_PRINTF_ARG(now - chan->timestamp_xmit));
+      " * Channel %"PRIu64 " last transmitted a cell "
+      "at %"PRIu64 " (%"PRIu64 " seconds ago)",
+      (chan->global_identifier),
+      (chan->timestamp_xmit),
+      (now - chan->timestamp_xmit));
 
   /* Describe counters and rates */
   tor_log(severity, LD_GENERAL,
-      " * Channel " U64_FORMAT " has received "
-      U64_FORMAT " bytes in " U64_FORMAT " cells and transmitted "
-      U64_FORMAT " bytes in " U64_FORMAT " cells",
-      U64_PRINTF_ARG(chan->global_identifier),
-      U64_PRINTF_ARG(chan->n_bytes_recved),
-      U64_PRINTF_ARG(chan->n_cells_recved),
-      U64_PRINTF_ARG(chan->n_bytes_xmitted),
-      U64_PRINTF_ARG(chan->n_cells_xmitted));
+      " * Channel %"PRIu64 " has received "
+      "%"PRIu64 " bytes in %"PRIu64 " cells and transmitted "
+      "%"PRIu64 " bytes in %"PRIu64 " cells",
+      (chan->global_identifier),
+      (chan->n_bytes_recved),
+      (chan->n_cells_recved),
+      (chan->n_bytes_xmitted),
+      (chan->n_cells_xmitted));
   if (now > chan->timestamp_created &&
       chan->timestamp_created > 0) {
     if (chan->n_bytes_recved > 0) {
       avg = (double)(chan->n_bytes_recved) / age;
       tor_log(severity, LD_GENERAL,
-          " * Channel " U64_FORMAT " has averaged %f "
+          " * Channel %"PRIu64 " has averaged %f "
           "bytes received per second",
-          U64_PRINTF_ARG(chan->global_identifier), avg);
+          (chan->global_identifier), avg);
     }
     if (chan->n_cells_recved > 0) {
       avg = (double)(chan->n_cells_recved) / age;
       if (avg >= 1.0) {
         tor_log(severity, LD_GENERAL,
-            " * Channel " U64_FORMAT " has averaged %f "
+            " * Channel %"PRIu64 " has averaged %f "
             "cells received per second",
-            U64_PRINTF_ARG(chan->global_identifier), avg);
+            (chan->global_identifier), avg);
       } else if (avg >= 0.0) {
         interval = 1.0 / avg;
         tor_log(severity, LD_GENERAL,
-            " * Channel " U64_FORMAT " has averaged %f "
+            " * Channel %"PRIu64 " has averaged %f "
             "seconds between received cells",
-            U64_PRINTF_ARG(chan->global_identifier), interval);
+            (chan->global_identifier), interval);
       }
     }
     if (chan->n_bytes_xmitted > 0) {
       avg = (double)(chan->n_bytes_xmitted) / age;
       tor_log(severity, LD_GENERAL,
-          " * Channel " U64_FORMAT " has averaged %f "
+          " * Channel %"PRIu64 " has averaged %f "
           "bytes transmitted per second",
-          U64_PRINTF_ARG(chan->global_identifier), avg);
+          (chan->global_identifier), avg);
     }
     if (chan->n_cells_xmitted > 0) {
       avg = (double)(chan->n_cells_xmitted) / age;
       if (avg >= 1.0) {
         tor_log(severity, LD_GENERAL,
-            " * Channel " U64_FORMAT " has averaged %f "
+            " * Channel %"PRIu64 " has averaged %f "
             "cells transmitted per second",
-            U64_PRINTF_ARG(chan->global_identifier), avg);
+            (chan->global_identifier), avg);
       } else if (avg >= 0.0) {
         interval = 1.0 / avg;
         tor_log(severity, LD_GENERAL,
-            " * Channel " U64_FORMAT " has averaged %f "
+            " * Channel %"PRIu64 " has averaged %f "
             "seconds between transmitted cells",
-            U64_PRINTF_ARG(chan->global_identifier), interval);
+            (chan->global_identifier), interval);
       }
     }
   }
@@ -2717,29 +2717,29 @@ channel_listener_dump_statistics(channel_listener_t *chan_l, int severity)
   age = (double)(now - chan_l->timestamp_created);
 
   tor_log(severity, LD_GENERAL,
-      "Channel listener " U64_FORMAT " (at %p) with transport %s is in "
+      "Channel listener %"PRIu64 " (at %p) with transport %s is in "
       "state %s (%d)",
-      U64_PRINTF_ARG(chan_l->global_identifier), chan_l,
+      (chan_l->global_identifier), chan_l,
       channel_listener_describe_transport(chan_l),
       channel_listener_state_to_string(chan_l->state), chan_l->state);
   tor_log(severity, LD_GENERAL,
-      " * Channel listener " U64_FORMAT " was created at " U64_FORMAT
-      " (" U64_FORMAT " seconds ago) "
-      "and last active at " U64_FORMAT " (" U64_FORMAT " seconds ago)",
-      U64_PRINTF_ARG(chan_l->global_identifier),
-      U64_PRINTF_ARG(chan_l->timestamp_created),
-      U64_PRINTF_ARG(now - chan_l->timestamp_created),
-      U64_PRINTF_ARG(chan_l->timestamp_active),
-      U64_PRINTF_ARG(now - chan_l->timestamp_active));
+      " * Channel listener %"PRIu64 " was created at %"PRIu64
+      " (%"PRIu64 " seconds ago) "
+      "and last active at %"PRIu64 " (%"PRIu64 " seconds ago)",
+      (chan_l->global_identifier),
+      (chan_l->timestamp_created),
+      (now - chan_l->timestamp_created),
+      (chan_l->timestamp_active),
+      (now - chan_l->timestamp_active));
 
   tor_log(severity, LD_GENERAL,
-      " * Channel listener " U64_FORMAT " last accepted an incoming "
-        "channel at " U64_FORMAT " (" U64_FORMAT " seconds ago) "
-        "and has accepted " U64_FORMAT " channels in total",
-        U64_PRINTF_ARG(chan_l->global_identifier),
-        U64_PRINTF_ARG(chan_l->timestamp_accepted),
-        U64_PRINTF_ARG(now - chan_l->timestamp_accepted),
-        U64_PRINTF_ARG(chan_l->n_accepted));
+      " * Channel listener %"PRIu64 " last accepted an incoming "
+        "channel at %"PRIu64 " (%"PRIu64 " seconds ago) "
+        "and has accepted %"PRIu64 " channels in total",
+        (chan_l->global_identifier),
+        (chan_l->timestamp_accepted),
+        (now - chan_l->timestamp_accepted),
+        (chan_l->n_accepted));
 
   /*
    * If it's sensible to do so, get the rate of incoming channels on this
@@ -2751,15 +2751,15 @@ channel_listener_dump_statistics(channel_listener_t *chan_l, int severity)
     avg = (double)(chan_l->n_accepted) / age;
     if (avg >= 1.0) {
       tor_log(severity, LD_GENERAL,
-          " * Channel listener " U64_FORMAT " has averaged %f incoming "
+          " * Channel listener %"PRIu64 " has averaged %f incoming "
           "channels per second",
-          U64_PRINTF_ARG(chan_l->global_identifier), avg);
+          (chan_l->global_identifier), avg);
     } else if (avg >= 0.0) {
       interval = 1.0 / avg;
       tor_log(severity, LD_GENERAL,
-          " * Channel listener " U64_FORMAT " has averaged %f seconds "
+          " * Channel listener %"PRIu64 " has averaged %f seconds "
           "between incoming channels",
-          U64_PRINTF_ARG(chan_l->global_identifier), interval);
+          (chan_l->global_identifier), interval);
     }
   }
 
diff --git a/src/or/channelpadding.c b/src/or/channelpadding.c
index 6bef4d8b3..c9d14489f 100644
--- a/src/or/channelpadding.c
+++ b/src/or/channelpadding.c
@@ -282,10 +282,10 @@ channelpadding_update_padding_for_channel(channel_t *chan,
                                       pad_vars->ito_high_ms);
 
   log_fn(LOG_INFO,LD_OR,
-         "Negotiated padding=%d, lo=%d, hi=%d on "U64_FORMAT,
+         "Negotiated padding=%d, lo=%d, hi=%d on %"PRIu64,
          chan->padding_enabled, chan->padding_timeout_low_ms,
          chan->padding_timeout_high_ms,
-         U64_PRINTF_ARG(chan->global_identifier));
+         (chan->global_identifier));
 
   return 1;
 }
@@ -393,13 +393,13 @@ channelpadding_send_padding_cell_for_callback(channel_t *chan)
     monotime_coarse_get(&now);
 
     log_fn(LOG_INFO,LD_OR,
-        "Sending netflow keepalive on "U64_FORMAT" to %s (%s) after "
-        I64_FORMAT" ms. Delta "I64_FORMAT"ms",
-        U64_PRINTF_ARG(chan->global_identifier),
+        "Sending netflow keepalive on %"PRIu64" to %s (%s) after "
+        "%"PRId64" ms. Delta %"PRId64"ms",
+        (chan->global_identifier),
         safe_str_client(chan->get_remote_descr(chan, 0)),
         safe_str_client(hex_str(chan->identity_digest, DIGEST_LEN)),
-        I64_PRINTF_ARG(monotime_coarse_diff_msec(&chan->timestamp_xfer,&now)),
-        I64_PRINTF_ARG(
+        (monotime_coarse_diff_msec(&chan->timestamp_xfer,&now)),
+        (
                    monotime_coarse_diff_msec(&chan->next_padding_time,&now)));
   }
 
@@ -539,9 +539,9 @@ channelpadding_compute_time_until_pad_for_netflow(channel_t *chan)
   if (ms_till_pad > DFLT_NETFLOW_INACTIVE_KEEPALIVE_MAX) {
     tor_fragile_assert();
     log_warn(LD_BUG,
-        "Channel padding timeout scheduled "I64_FORMAT"ms in the future. "
+        "Channel padding timeout scheduled %"PRId64"ms in the future. "
         "Did the monotonic clock just jump?",
-        I64_PRINTF_ARG(ms_till_pad));
+        (ms_till_pad));
     return 0; /* Clock jumped: Send padding now */
   }
 
@@ -565,8 +565,8 @@ channelpadding_compute_time_until_pad_for_netflow(channel_t *chan)
       int severity = (ms_till_pad < -NETFLOW_MISSED_WINDOW)
                       ? LOG_NOTICE : LOG_INFO;
       log_fn(severity, LD_OR,
-              "Channel padding timeout scheduled "I64_FORMAT"ms in the past. ",
-             I64_PRINTF_ARG(-ms_till_pad));
+              "Channel padding timeout scheduled %"PRId64"ms in the past. ",
+             (-ms_till_pad));
       return 0; /* Clock jumped: Send padding now */
     }
 
@@ -697,8 +697,8 @@ channelpadding_reduce_padding_on_channel(channel_t *chan)
   chan->padding_timeout_high_ms = consensus_nf_ito_high_reduced;
 
   log_fn(LOG_INFO,LD_OR,
-         "Reduced padding on channel "U64_FORMAT": lo=%d, hi=%d",
-         U64_PRINTF_ARG(chan->global_identifier),
+         "Reduced padding on channel %"PRIu64": lo=%d, hi=%d",
+         (chan->global_identifier),
          chan->padding_timeout_low_ms, chan->padding_timeout_high_ms);
 }
 
diff --git a/src/or/channeltls.c b/src/or/channeltls.c
index 5258935ae..f908c40ba 100644
--- a/src/or/channeltls.c
+++ b/src/or/channeltls.c
@@ -192,19 +192,19 @@ channel_tls_connect(const tor_addr_t *addr, uint16_t port,
 
   log_debug(LD_CHANNEL,
             "In channel_tls_connect() for channel %p "
-            "(global id " U64_FORMAT ")",
+            "(global id %"PRIu64 ")",
             tlschan,
-            U64_PRINTF_ARG(chan->global_identifier));
+            (chan->global_identifier));
 
   if (is_local_addr(addr)) {
     log_debug(LD_CHANNEL,
-              "Marking new outgoing channel " U64_FORMAT " at %p as local",
-              U64_PRINTF_ARG(chan->global_identifier), chan);
+              "Marking new outgoing channel %"PRIu64 " at %p as local",
+              (chan->global_identifier), chan);
     channel_mark_local(chan);
   } else {
     log_debug(LD_CHANNEL,
-              "Marking new outgoing channel " U64_FORMAT " at %p as remote",
-              U64_PRINTF_ARG(chan->global_identifier), chan);
+              "Marking new outgoing channel %"PRIu64 " at %p as remote",
+              (chan->global_identifier), chan);
     channel_mark_remote(chan);
   }
 
@@ -220,8 +220,8 @@ channel_tls_connect(const tor_addr_t *addr, uint16_t port,
   }
 
   log_debug(LD_CHANNEL,
-            "Got orconn %p for channel with global id " U64_FORMAT,
-            tlschan->conn, U64_PRINTF_ARG(chan->global_identifier));
+            "Got orconn %p for channel with global id %"PRIu64,
+            tlschan->conn, (chan->global_identifier));
 
   goto done;
 
@@ -271,8 +271,8 @@ channel_tls_start_listener(void)
     channel_tls_listener = listener;
 
     log_debug(LD_CHANNEL,
-              "Starting TLS channel listener %p with global id " U64_FORMAT,
-              listener, U64_PRINTF_ARG(listener->global_identifier));
+              "Starting TLS channel listener %p with global id %"PRIu64,
+              listener, (listener->global_identifier));
 
     channel_listener_register(listener);
   } else listener = channel_tls_listener;
@@ -301,9 +301,9 @@ channel_tls_free_all(void)
      */
     old_listener = channel_tls_listener;
     log_debug(LD_CHANNEL,
-              "Closing channel_tls_listener with ID " U64_FORMAT
+              "Closing channel_tls_listener with ID %"PRIu64
               " at %p.",
-              U64_PRINTF_ARG(old_listener->global_identifier),
+              (old_listener->global_identifier),
               old_listener);
     channel_listener_unregister(old_listener);
     channel_listener_mark_for_close(old_listener);
@@ -335,13 +335,13 @@ channel_tls_handle_incoming(or_connection_t *orconn)
 
   if (is_local_addr(&(TO_CONN(orconn)->addr))) {
     log_debug(LD_CHANNEL,
-              "Marking new incoming channel " U64_FORMAT " at %p as local",
-              U64_PRINTF_ARG(chan->global_identifier), chan);
+              "Marking new incoming channel %"PRIu64 " at %p as local",
+              (chan->global_identifier), chan);
     channel_mark_local(chan);
   } else {
     log_debug(LD_CHANNEL,
-              "Marking new incoming channel " U64_FORMAT " at %p as remote",
-              U64_PRINTF_ARG(chan->global_identifier), chan);
+              "Marking new incoming channel %"PRIu64 " at %p as remote",
+              (chan->global_identifier), chan);
     channel_mark_remote(chan);
   }
 
@@ -431,8 +431,8 @@ channel_tls_describe_transport_method(channel_t *chan)
 
     if (buf) tor_free(buf);
     tor_asprintf(&buf,
-                 "TLS channel (connection " U64_FORMAT ")",
-                 U64_PRINTF_ARG(id));
+                 "TLS channel (connection %"PRIu64 ")",
+                 (id));
 
     rv = buf;
   } else {
@@ -493,8 +493,8 @@ channel_tls_get_overhead_estimate_method(channel_t *chan)
   }
 
   log_debug(LD_CHANNEL,
-            "Estimated overhead ratio for TLS chan " U64_FORMAT " is %f",
-            U64_PRINTF_ARG(chan->global_identifier), overhead);
+            "Estimated overhead ratio for TLS chan %"PRIu64 " is %f",
+            (chan->global_identifier), overhead);
 
   return overhead;
 }
@@ -625,8 +625,8 @@ channel_tls_has_queued_writes_method(channel_t *chan)
   if (!(tlschan->conn)) {
     log_info(LD_CHANNEL,
              "something called has_queued_writes on a tlschan "
-             "(%p with ID " U64_FORMAT " but no conn",
-             chan, U64_PRINTF_ARG(chan->global_identifier));
+             "(%p with ID %"PRIu64 " but no conn",
+             chan, (chan->global_identifier));
   }
 
   outbuf_len = (tlschan->conn != NULL) ?
@@ -693,8 +693,8 @@ channel_tls_matches_extend_info_method(channel_t *chan,
   if (!(tlschan->conn)) {
     log_info(LD_CHANNEL,
              "something called matches_extend_info on a tlschan "
-             "(%p with ID " U64_FORMAT " but no conn",
-             chan, U64_PRINTF_ARG(chan->global_identifier));
+             "(%p with ID %"PRIu64 " but no conn",
+             chan, (chan->global_identifier));
     return 0;
   }
 
@@ -723,8 +723,8 @@ channel_tls_matches_target_method(channel_t *chan,
   if (!(tlschan->conn)) {
     log_info(LD_CHANNEL,
              "something called matches_target on a tlschan "
-             "(%p with ID " U64_FORMAT " but no conn",
-             chan, U64_PRINTF_ARG(chan->global_identifier));
+             "(%p with ID %"PRIu64 " but no conn",
+             chan, (chan->global_identifier));
     return 0;
   }
 
@@ -806,8 +806,8 @@ channel_tls_write_cell_method(channel_t *chan, cell_t *cell)
   } else {
     log_info(LD_CHANNEL,
              "something called write_cell on a tlschan "
-             "(%p with ID " U64_FORMAT " but no conn",
-             chan, U64_PRINTF_ARG(chan->global_identifier));
+             "(%p with ID %"PRIu64 " but no conn",
+             chan, (chan->global_identifier));
   }
 
   return written;
@@ -839,8 +839,8 @@ channel_tls_write_packed_cell_method(channel_t *chan,
   } else {
     log_info(LD_CHANNEL,
              "something called write_packed_cell on a tlschan "
-             "(%p with ID " U64_FORMAT " but no conn",
-             chan, U64_PRINTF_ARG(chan->global_identifier));
+             "(%p with ID %"PRIu64 " but no conn",
+             chan, (chan->global_identifier));
     return -1;
   }
 
@@ -868,8 +868,8 @@ channel_tls_write_var_cell_method(channel_t *chan, var_cell_t *var_cell)
   } else {
     log_info(LD_CHANNEL,
              "something called write_var_cell on a tlschan "
-             "(%p with ID " U64_FORMAT " but no conn",
-             chan, U64_PRINTF_ARG(chan->global_identifier));
+             "(%p with ID %"PRIu64 " but no conn",
+             chan, (chan->global_identifier));
   }
 
   return written;
@@ -1341,15 +1341,15 @@ channel_tls_update_marks(or_connection_t *conn)
   if (is_local_addr(&(TO_CONN(conn)->addr))) {
     if (!channel_is_local(chan)) {
       log_debug(LD_CHANNEL,
-                "Marking channel " U64_FORMAT " at %p as local",
-                U64_PRINTF_ARG(chan->global_identifier), chan);
+                "Marking channel %"PRIu64 " at %p as local",
+                (chan->global_identifier), chan);
       channel_mark_local(chan);
     }
   } else {
     if (channel_is_local(chan)) {
       log_debug(LD_CHANNEL,
-                "Marking channel " U64_FORMAT " at %p as remote",
-                U64_PRINTF_ARG(chan->global_identifier), chan);
+                "Marking channel %"PRIu64 " at %p as remote",
+                (chan->global_identifier), chan);
       channel_mark_remote(chan);
     }
   }
diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c
index 28295147c..39ae7ebf4 100644
--- a/src/or/circuitbuild.c
+++ b/src/or/circuitbuild.c
@@ -202,11 +202,11 @@ get_unique_circ_id_by_chan(channel_t *chan)
                                                               chan->cmux);
 
       log_warn(LD_CIRC, "  Circuitmux on this channel has %u circuits, "
-               "of which %u are active. It says it has "I64_FORMAT
+               "of which %u are active. It says it has %"PRId64
                " destroy cells queued.",
                circuitmux_num_circuits(chan->cmux),
                circuitmux_num_active_circuits(chan->cmux),
-               I64_PRINTF_ARG(queued_destroys));
+               (queued_destroys));
 
       /* Change this into "if (1)" in order to get more information about
        * possible failure modes here.  You'll need to know how to use gdb with
@@ -1150,20 +1150,20 @@ circuit_note_clock_jumped(int64_t seconds_elapsed, bool was_idle)
 {
   int severity = server_mode(get_options()) ? LOG_WARN : LOG_NOTICE;
   if (was_idle) {
-    tor_log(severity, LD_GENERAL, "Tor has been idle for "I64_FORMAT
+    tor_log(severity, LD_GENERAL, "Tor has been idle for %"PRId64
             " seconds; assuming established circuits no longer work.",
-            I64_PRINTF_ARG(seconds_elapsed));
+            (seconds_elapsed));
   } else {
     tor_log(severity, LD_GENERAL,
-            "Your system clock just jumped "I64_FORMAT" seconds %s; "
+            "Your system clock just jumped %"PRId64" seconds %s; "
             "assuming established circuits no longer work.",
-            I64_PRINTF_ARG(
+            (
                  seconds_elapsed >=0 ? seconds_elapsed : -seconds_elapsed),
             seconds_elapsed >=0 ? "forward" : "backward");
   }
-  control_event_general_status(LOG_WARN, "CLOCK_JUMPED TIME="I64_FORMAT
+  control_event_general_status(LOG_WARN, "CLOCK_JUMPED TIME=%"PRId64
                                " IDLE=%d",
-                               I64_PRINTF_ARG(seconds_elapsed), was_idle?1:0);
+                               (seconds_elapsed), was_idle?1:0);
   /* so we log when it works again */
   note_that_we_maybe_cant_complete_circuits();
   control_event_client_status(severity, "CIRCUIT_NOT_ESTABLISHED REASON=%s",
diff --git a/src/or/circuitlist.c b/src/or/circuitlist.c
index a696533ae..a50477c4c 100644
--- a/src/or/circuitlist.c
+++ b/src/or/circuitlist.c
@@ -1000,9 +1000,9 @@ origin_circuit_new(void)
     }
 
     log_info(LD_CIRC,
-              "Circuit " U64_FORMAT " chose an idle timeout of %d based on "
+              "Circuit %"PRIu32" chose an idle timeout of %d based on "
               "%d seconds of predictive building remaining.",
-              U64_PRINTF_ARG(circ->global_identifier),
+              (circ->global_identifier),
               circ->circuit_idle_timeout,
               prediction_time_remaining);
   }
@@ -1389,9 +1389,9 @@ circuit_get_by_circid_channel_impl(circid_t circ_id, channel_t *chan,
   if (found && found->circuit) {
     log_debug(LD_CIRC,
               "circuit_get_by_circid_channel_impl() returning circuit %p for"
-              " circ_id %u, channel ID " U64_FORMAT " (%p)",
+              " circ_id %u, channel ID %"PRIu64 " (%p)",
               found->circuit, (unsigned)circ_id,
-              U64_PRINTF_ARG(chan->global_identifier), chan);
+              (chan->global_identifier), chan);
     if (found_entry_out)
       *found_entry_out = 1;
     return found->circuit;
@@ -1399,10 +1399,10 @@ circuit_get_by_circid_channel_impl(circid_t circ_id, channel_t *chan,
 
   log_debug(LD_CIRC,
             "circuit_get_by_circid_channel_impl() found %s for"
-            " circ_id %u, channel ID " U64_FORMAT " (%p)",
+            " circ_id %u, channel ID %"PRIu64 " (%p)",
             found ? "placeholder" : "nothing",
             (unsigned)circ_id,
-            U64_PRINTF_ARG(chan->global_identifier), chan);
+            (chan->global_identifier), chan);
 
   if (found_entry_out)
     *found_entry_out = found ? 1 : 0;
@@ -2601,10 +2601,10 @@ circuits_handle_oom(size_t current_allocation)
 
  done_recovering_mem:
 
-  log_notice(LD_GENERAL, "Removed "U64_FORMAT" bytes by killing %d circuits; "
+  log_notice(LD_GENERAL, "Removed %"PRIu64" bytes by killing %d circuits; "
              "%d circuits remain alive. Also killed %d non-linked directory "
              "connections.",
-             U64_PRINTF_ARG(mem_recovered),
+             (mem_recovered),
              n_circuits_killed,
              smartlist_len(circlist) - n_circuits_killed,
              n_dirconns_killed);
@@ -2737,4 +2737,3 @@ assert_circuit_ok,(const circuit_t *c))
     tor_assert(!or_circ || !or_circ->rend_splice);
   }
 }
-
diff --git a/src/or/circuitmux.c b/src/or/circuitmux.c
index 31f9281eb..9e0126b8f 100644
--- a/src/or/circuitmux.c
+++ b/src/or/circuitmux.c
@@ -320,10 +320,10 @@ circuitmux_detach_all_circuits(circuitmux_t *cmux, smartlist_t *detached_out)
           } else {
             /* Complain and move on */
             log_warn(LD_CIRC,
-                     "Circuit %u/channel " U64_FORMAT " had direction == "
+                     "Circuit %u/channel %"PRIu64 " had direction == "
                      "CELL_DIRECTION_IN, but isn't an or_circuit_t",
                      (unsigned)to_remove->circ_id,
-                     U64_PRINTF_ARG(to_remove->chan_id));
+                     (to_remove->chan_id));
           }
 
           /* Free policy-specific data if we have it */
@@ -344,15 +344,15 @@ circuitmux_detach_all_circuits(circuitmux_t *cmux, smartlist_t *detached_out)
         } else {
           /* Complain and move on */
           log_warn(LD_CIRC,
-                   "Couldn't find circuit %u (for channel " U64_FORMAT ")",
+                   "Couldn't find circuit %u (for channel %"PRIu64 ")",
                    (unsigned)to_remove->circ_id,
-                   U64_PRINTF_ARG(to_remove->chan_id));
+                   (to_remove->chan_id));
         }
       } else {
         /* Complain and move on */
         log_warn(LD_CIRC,
-                 "Couldn't find channel " U64_FORMAT " (for circuit id %u)",
-                 U64_PRINTF_ARG(to_remove->chan_id),
+                 "Couldn't find channel %"PRIu64 " (for circuit id %u)",
+                 (to_remove->chan_id),
                  (unsigned)to_remove->circ_id);
       }
 
@@ -428,17 +428,17 @@ circuitmux_free_(circuitmux_t *cmux)
     global_destroy_ctr -= cmux->destroy_cell_queue.n;
     log_debug(LD_CIRC,
               "Freeing cmux at %p with %u queued destroys; the last cmux "
-              "destroy balance was "I64_FORMAT", global is "I64_FORMAT,
+              "destroy balance was %"PRId64", global is %"PRId64,
               cmux, cmux->destroy_cell_queue.n,
-              I64_PRINTF_ARG(cmux->destroy_ctr),
-              I64_PRINTF_ARG(global_destroy_ctr));
+              (cmux->destroy_ctr),
+              (global_destroy_ctr));
   } else {
     log_debug(LD_CIRC,
               "Freeing cmux at %p with no queued destroys, the cmux destroy "
-              "balance was "I64_FORMAT", global is "I64_FORMAT,
+              "balance was %"PRId64", global is %"PRId64,
               cmux,
-              I64_PRINTF_ARG(cmux->destroy_ctr),
-              I64_PRINTF_ARG(global_destroy_ctr));
+              (cmux->destroy_ctr),
+              (global_destroy_ctr));
   }
 
   destroy_cell_queue_clear(&cmux->destroy_cell_queue);
@@ -835,9 +835,9 @@ circuitmux_attach_circuit,(circuitmux_t *cmux, circuit_t *circ,
      * directions match and update the cell count and active circuit count.
      */
     log_info(LD_CIRC,
-             "Circuit %u on channel " U64_FORMAT " was already attached to "
+             "Circuit %u on channel %"PRIu64 " was already attached to "
              "cmux %p (trying to attach to %p)",
-             (unsigned)circ_id, U64_PRINTF_ARG(channel_id),
+             (unsigned)circ_id, (channel_id),
              ((direction == CELL_DIRECTION_OUT) ?
                 circ->n_mux : TO_OR_CIRCUIT(circ)->p_mux),
              cmux);
@@ -869,8 +869,8 @@ circuitmux_attach_circuit,(circuitmux_t *cmux, circuit_t *circ,
      * counts.
      */
     log_debug(LD_CIRC,
-             "Attaching circuit %u on channel " U64_FORMAT " to cmux %p",
-              (unsigned)circ_id, U64_PRINTF_ARG(channel_id), cmux);
+             "Attaching circuit %u on channel %"PRIu64 " to cmux %p",
+              (unsigned)circ_id, (channel_id), cmux);
 
     /*
      * Assert that the circuit doesn't already have a mux for this
@@ -1241,11 +1241,11 @@ circuitmux_notify_xmit_destroy(circuitmux_t *cmux)
   --(cmux->destroy_ctr);
   --(global_destroy_ctr);
   log_debug(LD_CIRC,
-            "Cmux at %p sent a destroy, cmux counter is now "I64_FORMAT", "
-            "global counter is now "I64_FORMAT,
+            "Cmux at %p sent a destroy, cmux counter is now %"PRId64", "
+            "global counter is now %"PRId64,
             cmux,
-            I64_PRINTF_ARG(cmux->destroy_ctr),
-            I64_PRINTF_ARG(global_destroy_ctr));
+            (cmux->destroy_ctr),
+            (global_destroy_ctr));
 }
 
 /*DOCDOC */
@@ -1262,10 +1262,10 @@ circuitmux_append_destroy_cell(channel_t *chan,
   ++global_destroy_ctr;
   log_debug(LD_CIRC,
             "Cmux at %p queued a destroy for circ %u, cmux counter is now "
-            I64_FORMAT", global counter is now "I64_FORMAT,
+            "%"PRId64", global counter is now %"PRId64,
             cmux, circ_id,
-            I64_PRINTF_ARG(cmux->destroy_ctr),
-            I64_PRINTF_ARG(global_destroy_ctr));
+            (cmux->destroy_ctr),
+            (global_destroy_ctr));
 
   /* XXXX Duplicate code from append_cell_to_circuit_queue */
   if (!channel_has_queued_writes(chan)) {
@@ -1303,12 +1303,12 @@ circuitmux_count_queued_destroy_cells(const channel_t *chan,
       n_destroy_cells != manual_total ||
       n_destroy_cells != manual_total_in_map) {
     log_warn(LD_BUG, "  Discrepancy in counts for queued destroy cells on "
-             "circuitmux. n="I64_FORMAT". queue_size="I64_FORMAT". "
-             "manual_total="I64_FORMAT". manual_total_in_map="I64_FORMAT".",
-             I64_PRINTF_ARG(n_destroy_cells),
-             I64_PRINTF_ARG(destroy_queue_size),
-             I64_PRINTF_ARG(manual_total),
-             I64_PRINTF_ARG(manual_total_in_map));
+             "circuitmux. n=%"PRId64". queue_size=%"PRId64". "
+             "manual_total=%"PRId64". manual_total_in_map=%"PRId64".",
+             (n_destroy_cells),
+             (destroy_queue_size),
+             (manual_total),
+             (manual_total_in_map));
   }
 
   return n_destroy_cells;
diff --git a/src/or/circuitstats.c b/src/or/circuitstats.c
index c2abb2d14..855001268 100644
--- a/src/or/circuitstats.c
+++ b/src/or/circuitstats.c
@@ -711,8 +711,8 @@ circuit_build_times_handle_completed_hop(origin_circuit_t *circ)
      * Switch their purpose and wait. */
     if (circ->base_.purpose != CIRCUIT_PURPOSE_C_MEASURE_TIMEOUT) {
       log_info(LD_CIRC,
-               "Deciding to timeout circuit "U64_FORMAT"\n",
-               U64_PRINTF_ARG(circ->global_identifier));
+               "Deciding to timeout circuit %"PRIu32"\n",
+               (circ->global_identifier));
       circuit_build_times_mark_circ_as_measurement_only(circ);
     }
   }
diff --git a/src/or/circuituse.c b/src/or/circuituse.c
index 71abd5d6c..a3a69dc35 100644
--- a/src/or/circuituse.c
+++ b/src/or/circuituse.c
@@ -719,9 +719,8 @@ circuit_expire_building(void)
           circuit_build_times_enough_to_compute(get_circuit_build_times())) {
 
         log_info(LD_CIRC,
-                   "Deciding to count the timeout for circuit "U64_FORMAT"\n",
-                   U64_PRINTF_ARG(
-                       TO_ORIGIN_CIRCUIT(victim)->global_identifier));
+                 "Deciding to count the timeout for circuit %"PRIu32"\n",
+                 TO_ORIGIN_CIRCUIT(victim)->global_identifier);
 
         /* Circuits are allowed to last longer for measurement.
          * Switch their purpose and wait. */
@@ -1510,10 +1509,10 @@ circuit_expire_old_circuits_clientside(void)
                 circ->purpose <= CIRCUIT_PURPOSE_C_REND_READY_INTRO_ACKED) ||
                 circ->purpose == CIRCUIT_PURPOSE_S_CONNECT_REND) {
           log_info(LD_CIRC,
-                    "Closing circuit "U64_FORMAT
+                    "Closing circuit %"PRIu32
                     " that has been unused for %ld msec.",
-                    U64_PRINTF_ARG(TO_ORIGIN_CIRCUIT(circ)->global_identifier),
-                    tv_mdiff(&circ->timestamp_began, &now));
+                   TO_ORIGIN_CIRCUIT(circ)->global_identifier,
+                   tv_mdiff(&circ->timestamp_began, &now));
           circuit_mark_for_close(circ, END_CIRC_REASON_FINISHED);
         } else if (!TO_ORIGIN_CIRCUIT(circ)->is_ancient) {
           /* Server-side rend joined circuits can end up really old, because
diff --git a/src/or/command.c b/src/or/command.c
index 387fd49bd..c2d6e2bb2 100644
--- a/src/or/command.c
+++ b/src/or/command.c
@@ -249,10 +249,10 @@ command_process_create_cell(cell_t *cell, channel_t *chan)
   tor_assert(chan);
 
   log_debug(LD_OR,
-            "Got a CREATE cell for circ_id %u on channel " U64_FORMAT
+            "Got a CREATE cell for circ_id %u on channel %"PRIu64
             " (%p)",
             (unsigned)cell->circ_id,
-            U64_PRINTF_ARG(chan->global_identifier), chan);
+            (chan->global_identifier), chan);
 
   /* First thing we do, even though the cell might be invalid, is inform the
    * DoS mitigation subsystem layer of this event. Validation is done by this
diff --git a/src/or/config.c b/src/or/config.c
index c958706f4..b055f1128 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -3047,8 +3047,8 @@ ensure_bandwidth_cap(uint64_t *value, const char *desc, char **msg)
     --*value;
   }
   if (*value > ROUTER_MAX_DECLARED_BANDWIDTH) {
-    tor_asprintf(msg, "%s ("U64_FORMAT") must be at most %d",
-                 desc, U64_PRINTF_ARG(*value),
+    tor_asprintf(msg, "%s (%"PRIu64") must be at most %d",
+                 desc, (*value),
                  ROUTER_MAX_DECLARED_BANDWIDTH);
     return -1;
   }
@@ -4636,10 +4636,10 @@ compute_real_max_mem_in_queues(const uint64_t val, int log_guess)
       }
     }
     if (log_guess && ! notice_sent) {
-      log_notice(LD_CONFIG, "%sMaxMemInQueues is set to "U64_FORMAT" MB. "
+      log_notice(LD_CONFIG, "%sMaxMemInQueues is set to %"PRIu64" MB. "
                  "You can override this by setting MaxMemInQueues by hand.",
                  ram ? "Based on detected system memory, " : "",
-                 U64_PRINTF_ARG(result / ONE_MEGABYTE));
+                 (result / ONE_MEGABYTE));
       notice_sent = 1;
     }
     return result;
diff --git a/src/or/confparse.c b/src/or/confparse.c
index c152fb171..8db6d6080 100644
--- a/src/or/confparse.c
+++ b/src/or/confparse.c
@@ -574,8 +574,8 @@ config_get_assigned_option(const config_format_t *fmt, const void *options,
       escape_val = 0; /* Can't need escape. */
       break;
     case CONFIG_TYPE_MEMUNIT:
-      tor_asprintf(&result->value, U64_FORMAT,
-                   U64_PRINTF_ARG(*(uint64_t*)value));
+      tor_asprintf(&result->value, "%"PRIu64,
+                   (*(uint64_t*)value));
       escape_val = 0; /* Can't need escape. */
       break;
     case CONFIG_TYPE_DOUBLE:
diff --git a/src/or/connection.c b/src/or/connection.c
index e3e9c313a..057a91941 100644
--- a/src/or/connection.c
+++ b/src/or/connection.c
@@ -614,9 +614,9 @@ connection_free_minimal(connection_t *conn)
       /* Owww, this shouldn't happen, but... */
       log_info(LD_CHANNEL,
                "Freeing orconn at %p, saw channel %p with ID "
-               U64_FORMAT " left un-NULLed",
+               "%"PRIu64 " left un-NULLed",
                or_conn, TLS_CHAN_TO_BASE(or_conn->chan),
-               U64_PRINTF_ARG(
+               (
                  TLS_CHAN_TO_BASE(or_conn->chan)->global_identifier));
       if (!CHANNEL_FINISHED(TLS_CHAN_TO_BASE(or_conn->chan))) {
         channel_close_for_error(TLS_CHAN_TO_BASE(or_conn->chan));
@@ -4986,16 +4986,16 @@ connection_dump_buffer_mem_stats(int severity)
   }
 
   tor_log(severity, LD_GENERAL,
-     "In buffers for %d connections: "U64_FORMAT" used/"U64_FORMAT" allocated",
+     "In buffers for %d connections: %"PRIu64" used/%"PRIu64" allocated",
       smartlist_len(conns),
-      U64_PRINTF_ARG(total_used), U64_PRINTF_ARG(total_alloc));
+      (total_used), (total_alloc));
   for (i=CONN_TYPE_MIN_; i <= CONN_TYPE_MAX_; ++i) {
     if (!n_conns_by_type[i])
       continue;
     tor_log(severity, LD_GENERAL,
-        "  For %d %s connections: "U64_FORMAT" used/"U64_FORMAT" allocated",
+        "  For %d %s connections: %"PRIu64" used/%"PRIu64" allocated",
         n_conns_by_type[i], conn_type_to_string(i),
-        U64_PRINTF_ARG(used_by_type[i]), U64_PRINTF_ARG(alloc_by_type[i]));
+        (used_by_type[i]), (alloc_by_type[i]));
   }
 }
 
diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c
index e8185a5fa..21e3c79bd 100644
--- a/src/or/connection_edge.c
+++ b/src/or/connection_edge.c
@@ -3199,9 +3199,9 @@ connection_ap_handshake_socks_reply(entry_connection_t *conn, char *reply,
        !CIRCUIT_IS_ORIGIN(conn->edge_.on_circuit)) {
       if (endreason != END_STREAM_REASON_RESOLVEFAILED) {
         log_info(LD_BUG,
-                 "No origin circuit for successful SOCKS stream "U64_FORMAT
+                 "No origin circuit for successful SOCKS stream %"PRIu64
                  ". Reason: %d",
-                 U64_PRINTF_ARG(ENTRY_TO_CONN(conn)->global_identifier),
+                 (ENTRY_TO_CONN(conn)->global_identifier),
                  endreason);
       }
       /*
diff --git a/src/or/connection_or.c b/src/or/connection_or.c
index 9692e5d67..5217ba166 100644
--- a/src/or/connection_or.c
+++ b/src/or/connection_or.c
@@ -851,9 +851,9 @@ connection_or_set_canonical(or_connection_t *or_conn,
           TLS_CHAN_TO_BASE(or_conn->chan), is_canonical);
 
   log_info(LD_CIRC,
-          "Channel " U64_FORMAT " chose an idle timeout of %d.",
+          "Channel %"PRIu64 " chose an idle timeout of %d.",
           or_conn->chan ?
-          U64_PRINTF_ARG(TLS_CHAN_TO_BASE(or_conn->chan)->global_identifier):0,
+          (TLS_CHAN_TO_BASE(or_conn->chan)->global_identifier):0,
           or_conn->idle_timeout);
 }
 
diff --git a/src/or/control.c b/src/or/control.c
index af052f756..3e7a7d9dc 100644
--- a/src/or/control.c
+++ b/src/or/control.c
@@ -1884,9 +1884,9 @@ getinfo_helper_misc(control_connection_t *conn, const char *question,
     }
     *answer = tor_dup_ip(addr);
   } else if (!strcmp(question, "traffic/read")) {
-    tor_asprintf(answer, U64_FORMAT, U64_PRINTF_ARG(get_bytes_read()));
+    tor_asprintf(answer, "%"PRIu64, (get_bytes_read()));
   } else if (!strcmp(question, "traffic/written")) {
-    tor_asprintf(answer, U64_FORMAT, U64_PRINTF_ARG(get_bytes_written()));
+    tor_asprintf(answer, "%"PRIu64, (get_bytes_written()));
   } else if (!strcmp(question, "process/pid")) {
     int myPid = -1;
 
@@ -1921,8 +1921,8 @@ getinfo_helper_misc(control_connection_t *conn, const char *question,
     int max_fds = get_max_sockets();
     tor_asprintf(answer, "%d", max_fds);
   } else if (!strcmp(question, "limits/max-mem-in-queues")) {
-    tor_asprintf(answer, U64_FORMAT,
-                 U64_PRINTF_ARG(get_options()->MaxMemInQueues));
+    tor_asprintf(answer, "%"PRIu64,
+                 (get_options()->MaxMemInQueues));
   } else if (!strcmp(question, "fingerprint")) {
     crypto_pk_t *server_key;
     if (!server_mode(get_options())) {
@@ -5882,8 +5882,8 @@ control_event_stream_status(entry_connection_t *conn, stream_status_event_t tp,
   if (circ && CIRCUIT_IS_ORIGIN(circ))
     origin_circ = TO_ORIGIN_CIRCUIT(circ);
   send_control_event(EVENT_STREAM_STATUS,
-                        "650 STREAM "U64_FORMAT" %s %lu %s%s%s%s\r\n",
-                     U64_PRINTF_ARG(ENTRY_TO_CONN(conn)->global_identifier),
+                        "650 STREAM %"PRIu64" %s %lu %s%s%s%s\r\n",
+                     (ENTRY_TO_CONN(conn)->global_identifier),
                      status,
                         origin_circ?
                            (unsigned long)origin_circ->global_identifier : 0ul,
@@ -5954,12 +5954,12 @@ control_event_or_conn_status(or_connection_t *conn, or_conn_status_event_t tp,
 
   orconn_target_get_name(name, sizeof(name), conn);
   send_control_event(EVENT_OR_CONN_STATUS,
-                              "650 ORCONN %s %s%s%s%s ID="U64_FORMAT"\r\n",
+                              "650 ORCONN %s %s%s%s%s ID=%"PRIu64"\r\n",
                               name, status,
                               reason ? " REASON=" : "",
                               orconn_end_reason_to_control_string(reason),
                               ncircs_buf,
-                              U64_PRINTF_ARG(conn->base_.global_identifier));
+                              (conn->base_.global_identifier));
 
   return 0;
 }
@@ -5979,8 +5979,8 @@ control_event_stream_bandwidth(edge_connection_t *edge_conn)
     tor_gettimeofday(&now);
     format_iso_time_nospace_usec(tbuf, &now);
     send_control_event(EVENT_STREAM_BANDWIDTH_USED,
-                       "650 STREAM_BW "U64_FORMAT" %lu %lu %s\r\n",
-                       U64_PRINTF_ARG(edge_conn->base_.global_identifier),
+                       "650 STREAM_BW %"PRIu64" %lu %lu %s\r\n",
+                       (edge_conn->base_.global_identifier),
                        (unsigned long)edge_conn->n_read,
                        (unsigned long)edge_conn->n_written,
                        tbuf);
@@ -6013,8 +6013,8 @@ control_event_stream_bandwidth_used(void)
         tor_gettimeofday(&now);
         format_iso_time_nospace_usec(tbuf, &now);
         send_control_event(EVENT_STREAM_BANDWIDTH_USED,
-                           "650 STREAM_BW "U64_FORMAT" %lu %lu %s\r\n",
-                           U64_PRINTF_ARG(edge_conn->base_.global_identifier),
+                           "650 STREAM_BW %"PRIu64" %lu %lu %s\r\n",
+                           (edge_conn->base_.global_identifier),
                            (unsigned long)edge_conn->n_read,
                            (unsigned long)edge_conn->n_written,
                            tbuf);
@@ -6092,9 +6092,9 @@ control_event_conn_bandwidth(connection_t *conn)
       return 0;
   }
   send_control_event(EVENT_CONN_BW,
-                     "650 CONN_BW ID="U64_FORMAT" TYPE=%s "
+                     "650 CONN_BW ID=%"PRIu64" TYPE=%s "
                      "READ=%lu WRITTEN=%lu\r\n",
-                     U64_PRINTF_ARG(conn->global_identifier),
+                     (conn->global_identifier),
                      conn_type_str,
                      (unsigned long)conn->n_read_conn_bw,
                      (unsigned long)conn->n_written_conn_bw);
@@ -6159,9 +6159,9 @@ append_cell_stats_by_command(smartlist_t *event_parts, const char *key,
   int i;
   for (i = 0; i <= CELL_COMMAND_MAX_; i++) {
     if (include_if_non_zero[i] > 0) {
-      smartlist_add_asprintf(key_value_strings, "%s:"U64_FORMAT,
+      smartlist_add_asprintf(key_value_strings, "%s:%"PRIu64,
                              cell_command_to_string(i),
-                             U64_PRINTF_ARG(number_to_include[i]));
+                             (number_to_include[i]));
     }
   }
   if (smartlist_len(key_value_strings) > 0) {
@@ -6188,8 +6188,8 @@ format_cell_stats(char **event_string, circuit_t *circ,
     or_circuit_t *or_circ = TO_OR_CIRCUIT(circ);
     smartlist_add_asprintf(event_parts, "InboundQueue=%lu",
                  (unsigned long)or_circ->p_circ_id);
-    smartlist_add_asprintf(event_parts, "InboundConn="U64_FORMAT,
-                 U64_PRINTF_ARG(or_circ->p_chan->global_identifier));
+    smartlist_add_asprintf(event_parts, "InboundConn=%"PRIu64,
+                 (or_circ->p_chan->global_identifier));
     append_cell_stats_by_command(event_parts, "InboundAdded",
                                  cell_stats->added_cells_appward,
                                  cell_stats->added_cells_appward);
@@ -6203,8 +6203,8 @@ format_cell_stats(char **event_string, circuit_t *circ,
   if (circ->n_chan) {
     smartlist_add_asprintf(event_parts, "OutboundQueue=%lu",
                      (unsigned long)circ->n_circ_id);
-    smartlist_add_asprintf(event_parts, "OutboundConn="U64_FORMAT,
-                 U64_PRINTF_ARG(circ->n_chan->global_identifier));
+    smartlist_add_asprintf(event_parts, "OutboundConn=%"PRIu64,
+                 (circ->n_chan->global_identifier));
     append_cell_stats_by_command(event_parts, "OutboundAdded",
                                  cell_stats->added_cells_exitward,
                                  cell_stats->added_cells_exitward);
diff --git a/src/or/dirauth/dirvote.c b/src/or/dirauth/dirvote.c
index 47d1ee44a..9e7d2dae8 100644
--- a/src/or/dirauth/dirvote.c
+++ b/src/or/dirauth/dirvote.c
@@ -999,13 +999,13 @@ networkstatus_check_weights(int64_t Wgg, int64_t Wgd, int64_t Wmg,
  out:
   if (berr) {
     log_info(LD_DIR,
-             "Bw weight mismatch %d. G="I64_FORMAT" M="I64_FORMAT
-             " E="I64_FORMAT" D="I64_FORMAT" T="I64_FORMAT
+             "Bw weight mismatch %d. G=%"PRId64" M=%"PRId64
+             " E=%"PRId64" D=%"PRId64" T=%"PRId64
              " Wmd=%d Wme=%d Wmg=%d Wed=%d Wee=%d"
              " Wgd=%d Wgg=%d Wme=%d Wmg=%d",
              berr,
-             I64_PRINTF_ARG(G), I64_PRINTF_ARG(M), I64_PRINTF_ARG(E),
-             I64_PRINTF_ARG(D), I64_PRINTF_ARG(T),
+             (G), (M), (E),
+             (D), (T),
              (int)Wmd, (int)Wme, (int)Wmg, (int)Wed, (int)Wee,
              (int)Wgd, (int)Wgg, (int)Wme, (int)Wmg);
   }
@@ -1031,10 +1031,10 @@ networkstatus_compute_bw_weights_v10(smartlist_t *chunks, int64_t G,
 
   if (G <= 0 || M <= 0 || E <= 0 || D <= 0) {
     log_warn(LD_DIR, "Consensus with empty bandwidth: "
-                     "G="I64_FORMAT" M="I64_FORMAT" E="I64_FORMAT
-                     " D="I64_FORMAT" T="I64_FORMAT,
-             I64_PRINTF_ARG(G), I64_PRINTF_ARG(M), I64_PRINTF_ARG(E),
-             I64_PRINTF_ARG(D), I64_PRINTF_ARG(T));
+                     "G=%"PRId64" M=%"PRId64" E=%"PRId64
+                     " D=%"PRId64" T=%"PRId64,
+             (G), (M), (E),
+             (D), (T));
     return 0;
   }
 
@@ -1065,13 +1065,13 @@ networkstatus_compute_bw_weights_v10(smartlist_t *chunks, int64_t G,
 
     if (berr) {
       log_warn(LD_DIR,
-             "Bw Weights error %d for %s v10. G="I64_FORMAT" M="I64_FORMAT
-             " E="I64_FORMAT" D="I64_FORMAT" T="I64_FORMAT
+             "Bw Weights error %d for %s v10. G=%"PRId64" M=%"PRId64
+             " E=%"PRId64" D=%"PRId64" T=%"PRId64
              " Wmd=%d Wme=%d Wmg=%d Wed=%d Wee=%d"
              " Wgd=%d Wgg=%d Wme=%d Wmg=%d weight_scale=%d",
              berr, casename,
-             I64_PRINTF_ARG(G), I64_PRINTF_ARG(M), I64_PRINTF_ARG(E),
-             I64_PRINTF_ARG(D), I64_PRINTF_ARG(T),
+             (G), (M), (E),
+             (D), (T),
              (int)Wmd, (int)Wme, (int)Wmg, (int)Wed, (int)Wee,
              (int)Wgd, (int)Wgg, (int)Wme, (int)Wmg, (int)weight_scale);
       return 0;
@@ -1136,13 +1136,13 @@ networkstatus_compute_bw_weights_v10(smartlist_t *chunks, int64_t G,
       if (berr != BW_WEIGHTS_NO_ERROR &&
               berr != BW_WEIGHTS_BALANCE_MID_ERROR) {
         log_warn(LD_DIR,
-             "Bw Weights error %d for %s v10. G="I64_FORMAT" M="I64_FORMAT
-             " E="I64_FORMAT" D="I64_FORMAT" T="I64_FORMAT
+             "Bw Weights error %d for %s v10. G=%"PRId64" M=%"PRId64
+             " E=%"PRId64" D=%"PRId64" T=%"PRId64
              " Wmd=%d Wme=%d Wmg=%d Wed=%d Wee=%d"
              " Wgd=%d Wgg=%d Wme=%d Wmg=%d weight_scale=%d",
              berr, casename,
-             I64_PRINTF_ARG(G), I64_PRINTF_ARG(M), I64_PRINTF_ARG(E),
-             I64_PRINTF_ARG(D), I64_PRINTF_ARG(T),
+             (G), (M), (E),
+             (D), (T),
              (int)Wmd, (int)Wme, (int)Wmg, (int)Wed, (int)Wee,
              (int)Wgd, (int)Wgg, (int)Wme, (int)Wmg, (int)weight_scale);
         return 0;
@@ -1153,10 +1153,10 @@ networkstatus_compute_bw_weights_v10(smartlist_t *chunks, int64_t G,
     // Case 3: Exactly one of Guard or Exit is scarce
     if (!(3*E < T || 3*G < T) || !(3*G >= T || 3*E >= T)) {
       log_warn(LD_BUG,
-           "Bw-Weights Case 3 v10 but with G="I64_FORMAT" M="
-           I64_FORMAT" E="I64_FORMAT" D="I64_FORMAT" T="I64_FORMAT,
-               I64_PRINTF_ARG(G), I64_PRINTF_ARG(M), I64_PRINTF_ARG(E),
-               I64_PRINTF_ARG(D), I64_PRINTF_ARG(T));
+           "Bw-Weights Case 3 v10 but with G=%"PRId64" M="
+           "%"PRId64" E=%"PRId64" D=%"PRId64" T=%"PRId64,
+               (G), (M), (E),
+               (D), (T));
     }
 
     if (3*(S+D) < T) { // Subcase a: S+D < T/3
@@ -1208,13 +1208,13 @@ networkstatus_compute_bw_weights_v10(smartlist_t *chunks, int64_t G,
       }
       if (berr) {
         log_warn(LD_DIR,
-             "Bw Weights error %d for %s v10. G="I64_FORMAT" M="I64_FORMAT
-             " E="I64_FORMAT" D="I64_FORMAT" T="I64_FORMAT
+             "Bw Weights error %d for %s v10. G=%"PRId64" M=%"PRId64
+             " E=%"PRId64" D=%"PRId64" T=%"PRId64
              " Wmd=%d Wme=%d Wmg=%d Wed=%d Wee=%d"
              " Wgd=%d Wgg=%d Wme=%d Wmg=%d weight_scale=%d",
              berr, casename,
-             I64_PRINTF_ARG(G), I64_PRINTF_ARG(M), I64_PRINTF_ARG(E),
-             I64_PRINTF_ARG(D), I64_PRINTF_ARG(T),
+             (G), (M), (E),
+             (D), (T),
              (int)Wmd, (int)Wme, (int)Wmg, (int)Wed, (int)Wee,
              (int)Wgd, (int)Wgg, (int)Wme, (int)Wmg, (int)weight_scale);
         return 0;
@@ -1248,11 +1248,11 @@ networkstatus_compute_bw_weights_v10(smartlist_t *chunks, int64_t G,
      (int)weight_scale, (int)Wmd, (int)Wme, (int)Wmg, (int)weight_scale);
 
   log_notice(LD_CIRC, "Computed bandwidth weights for %s with v10: "
-             "G="I64_FORMAT" M="I64_FORMAT" E="I64_FORMAT" D="I64_FORMAT
-             " T="I64_FORMAT,
+             "G=%"PRId64" M=%"PRId64" E=%"PRId64" D=%"PRId64
+             " T=%"PRId64,
              casename,
-             I64_PRINTF_ARG(G), I64_PRINTF_ARG(M), I64_PRINTF_ARG(E),
-             I64_PRINTF_ARG(D), I64_PRINTF_ARG(T));
+             (G), (M), (E),
+             (D), (T));
   return 1;
 }
 
diff --git a/src/or/directory.c b/src/or/directory.c
index 6b8885e12..907995479 100644
--- a/src/or/directory.c
+++ b/src/or/directory.c
@@ -1929,12 +1929,12 @@ directory_send_command(dir_connection_t *conn,
 
   log_debug(LD_DIR,
             "Sent request to directory server '%s:%d': "
-            "(purpose: %d, request size: " U64_FORMAT ", "
-            "payload size: " U64_FORMAT ")",
+            "(purpose: %d, request size: %"PRIu64 ", "
+            "payload size: %"PRIu64 ")",
             conn->base_.address, conn->base_.port,
             conn->base_.purpose,
-            U64_PRINTF_ARG(total_request_len),
-            U64_PRINTF_ARG(payload ? payload_len : 0));
+            (total_request_len),
+            (payload ? payload_len : 0));
 }
 
 /** Parse an HTTP request string <b>headers</b> of the form
@@ -2420,14 +2420,14 @@ connection_dir_client_reached_eof(dir_connection_t *conn)
 
   tor_log(LOG_DEBUG, LD_DIR,
             "Received response from directory server '%s:%d': %d %s "
-            "(purpose: %d, response size: " U64_FORMAT
+            "(purpose: %d, response size: %"PRIu64
 #ifdef MEASUREMENTS_21206
             ", data cells received: %d, data cells sent: %d"
 #endif
             ", compression: %d)",
             conn->base_.address, conn->base_.port, status_code,
             escaped(reason), conn->base_.purpose,
-            U64_PRINTF_ARG(received_bytes),
+            (received_bytes),
 #ifdef MEASUREMENTS_21206
             conn->data_cells_received, conn->data_cells_sent,
 #endif
diff --git a/src/or/geoip.c b/src/or/geoip.c
index fac35d398..3e6f20ea3 100644
--- a/src/or/geoip.c
+++ b/src/or/geoip.c
@@ -1040,12 +1040,12 @@ geoip_get_transport_history(void)
     void *transport_count_ptr = strmap_get(transport_counts, transport_name);
     uintptr_t transport_count = (uintptr_t) transport_count_ptr;
 
-    log_debug(LD_GENERAL, "We got "U64_FORMAT" clients with transport '%s'.",
-              U64_PRINTF_ARG((uint64_t)transport_count), transport_name);
+    log_debug(LD_GENERAL, "We got %"PRIu64" clients with transport '%s'.",
+              ((uint64_t)transport_count), transport_name);
 
-    smartlist_add_asprintf(string_chunks, "%s="U64_FORMAT,
+    smartlist_add_asprintf(string_chunks, "%s=%"PRIu64,
                            transport_name,
-                           U64_PRINTF_ARG(round_uint64_to_next_multiple_of(
+                           (round_uint64_to_next_multiple_of(
                                                (uint64_t)transport_count,
                                                granularity)));
   } SMARTLIST_FOREACH_END(transport_name);
diff --git a/src/or/hibernate.c b/src/or/hibernate.c
index 12264f758..c6190bc89 100644
--- a/src/or/hibernate.c
+++ b/src/or/hibernate.c
@@ -761,13 +761,13 @@ read_bandwidth_usage(void)
        "Successfully read bandwidth accounting info from state written at %s "
        "for interval starting at %s.  We have been active for %lu seconds in "
        "this interval.  At the start of the interval, we expected to use "
-       "about %lu KB per second. ("U64_FORMAT" bytes read so far, "
-       U64_FORMAT" bytes written so far)",
+       "about %lu KB per second. (%"PRIu64" bytes read so far, "
+       "%"PRIu64" bytes written so far)",
        tbuf1, tbuf2,
        (unsigned long)n_seconds_active_in_interval,
        (unsigned long)(expected_bandwidth_usage*1024/60),
-       U64_PRINTF_ARG(n_bytes_read_in_interval),
-       U64_PRINTF_ARG(n_bytes_written_in_interval));
+       (n_bytes_read_in_interval),
+       (n_bytes_written_in_interval));
   }
 
   return 0;
@@ -1134,9 +1134,9 @@ getinfo_helper_accounting(control_connection_t *conn,
     *answer = tor_strdup(hibernate_state_to_string(hibernate_state));
     tor_strlower(*answer);
   } else if (!strcmp(question, "accounting/bytes")) {
-      tor_asprintf(answer, U64_FORMAT" "U64_FORMAT,
-                 U64_PRINTF_ARG(n_bytes_read_in_interval),
-                 U64_PRINTF_ARG(n_bytes_written_in_interval));
+      tor_asprintf(answer, "%"PRIu64" %"PRIu64,
+                 (n_bytes_read_in_interval),
+                 (n_bytes_written_in_interval));
   } else if (!strcmp(question, "accounting/bytes-left")) {
     uint64_t limit = get_options()->AccountingMax;
     if (get_options()->AccountingRule == ACCT_SUM) {
@@ -1144,28 +1144,28 @@ getinfo_helper_accounting(control_connection_t *conn,
       uint64_t total_bytes = get_accounting_bytes();
       if (total_bytes < limit)
         total_left = limit - total_bytes;
-      tor_asprintf(answer, U64_FORMAT" "U64_FORMAT,
-                   U64_PRINTF_ARG(total_left), U64_PRINTF_ARG(total_left));
+      tor_asprintf(answer, "%"PRIu64" %"PRIu64,
+                   (total_left), (total_left));
     } else if (get_options()->AccountingRule == ACCT_IN) {
       uint64_t read_left = 0;
       if (n_bytes_read_in_interval < limit)
         read_left = limit - n_bytes_read_in_interval;
-      tor_asprintf(answer, U64_FORMAT" "U64_FORMAT,
-                   U64_PRINTF_ARG(read_left), U64_PRINTF_ARG(limit));
+      tor_asprintf(answer, "%"PRIu64" %"PRIu64,
+                   (read_left), (limit));
     } else if (get_options()->AccountingRule == ACCT_OUT) {
       uint64_t write_left = 0;
       if (n_bytes_written_in_interval < limit)
         write_left = limit - n_bytes_written_in_interval;
-      tor_asprintf(answer, U64_FORMAT" "U64_FORMAT,
-                   U64_PRINTF_ARG(limit), U64_PRINTF_ARG(write_left));
+      tor_asprintf(answer, "%"PRIu64" %"PRIu64,
+                   (limit), (write_left));
     } else {
       uint64_t read_left = 0, write_left = 0;
       if (n_bytes_read_in_interval < limit)
         read_left = limit - n_bytes_read_in_interval;
       if (n_bytes_written_in_interval < limit)
         write_left = limit - n_bytes_written_in_interval;
-      tor_asprintf(answer, U64_FORMAT" "U64_FORMAT,
-                   U64_PRINTF_ARG(read_left), U64_PRINTF_ARG(write_left));
+      tor_asprintf(answer, "%"PRIu64" %"PRIu64,
+                   (read_left), (write_left));
     }
   } else if (!strcmp(question, "accounting/interval-start")) {
     *answer = tor_malloc(ISO_TIME_LEN+1);
diff --git a/src/or/main.c b/src/or/main.c
index 81a8cfbee..c2fa416d6 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -1271,9 +1271,9 @@ run_connection_housekeeping(int i, time_t now)
   } else if (!have_any_circuits &&
              now - or_conn->idle_timeout >=
                                          chan->timestamp_last_had_circuits) {
-    log_info(LD_OR,"Expiring non-used OR connection "U64_FORMAT" to fd %d "
+    log_info(LD_OR,"Expiring non-used OR connection %"PRIu64" to fd %d "
              "(%s:%d) [no circuits for %d; timeout %d; %scanonical].",
-             U64_PRINTF_ARG(chan->global_identifier),
+             (chan->global_identifier),
              (int)conn->s, conn->address, conn->port,
              (int)(now - chan->timestamp_last_had_circuits),
              or_conn->idle_timeout,
@@ -3199,8 +3199,8 @@ static void
 dumpmemusage(int severity)
 {
   connection_dump_buffer_mem_stats(severity);
-  tor_log(severity, LD_GENERAL, "In rephist: "U64_FORMAT" used by %d Tors.",
-      U64_PRINTF_ARG(rephist_total_alloc), rephist_total_num);
+  tor_log(severity, LD_GENERAL, "In rephist: %"PRIu64" used by %d Tors.",
+      (rephist_total_alloc), rephist_total_num);
   dump_routerlist_mem_usage(severity);
   dump_cell_pool_usage(severity);
   dump_dns_mem_usage(severity);
@@ -3263,20 +3263,20 @@ dumpstats(int severity)
   channel_listener_dumpstats(severity);
 
   tor_log(severity, LD_NET,
-      "Cells processed: "U64_FORMAT" padding\n"
-      "                 "U64_FORMAT" create\n"
-      "                 "U64_FORMAT" created\n"
-      "                 "U64_FORMAT" relay\n"
-      "                        ("U64_FORMAT" relayed)\n"
-      "                        ("U64_FORMAT" delivered)\n"
-      "                 "U64_FORMAT" destroy",
-      U64_PRINTF_ARG(stats_n_padding_cells_processed),
-      U64_PRINTF_ARG(stats_n_create_cells_processed),
-      U64_PRINTF_ARG(stats_n_created_cells_processed),
-      U64_PRINTF_ARG(stats_n_relay_cells_processed),
-      U64_PRINTF_ARG(stats_n_relay_cells_relayed),
-      U64_PRINTF_ARG(stats_n_relay_cells_delivered),
-      U64_PRINTF_ARG(stats_n_destroy_cells_processed));
+      "Cells processed: %"PRIu64" padding\n"
+      "                 %"PRIu64" create\n"
+      "                 %"PRIu64" created\n"
+      "                 %"PRIu64" relay\n"
+      "                        (%"PRIu64" relayed)\n"
+      "                        (%"PRIu64" delivered)\n"
+      "                 %"PRIu64" destroy",
+      (stats_n_padding_cells_processed),
+      (stats_n_create_cells_processed),
+      (stats_n_created_cells_processed),
+      (stats_n_relay_cells_processed),
+      (stats_n_relay_cells_relayed),
+      (stats_n_relay_cells_delivered),
+      (stats_n_destroy_cells_processed));
   if (stats_n_data_cells_packaged)
     tor_log(severity,LD_NET,"Average packaged cell fullness: %2.3f%%",
         100*(U64_TO_DBL(stats_n_data_bytes_packaged) /
@@ -3296,13 +3296,13 @@ dumpstats(int severity)
 
   if (elapsed) {
     tor_log(severity, LD_NET,
-        "Average bandwidth: "U64_FORMAT"/%d = %d bytes/sec reading",
-        U64_PRINTF_ARG(stats_n_bytes_read),
+        "Average bandwidth: %"PRIu64"/%d = %d bytes/sec reading",
+        (stats_n_bytes_read),
         (int)elapsed,
         (int) (stats_n_bytes_read/elapsed));
     tor_log(severity, LD_NET,
-        "Average bandwidth: "U64_FORMAT"/%d = %d bytes/sec writing",
-        U64_PRINTF_ARG(stats_n_bytes_written),
+        "Average bandwidth: %"PRIu64"/%d = %d bytes/sec writing",
+        (stats_n_bytes_written),
         (int)elapsed,
         (int) (stats_n_bytes_written/elapsed));
   }
diff --git a/src/or/microdesc.c b/src/or/microdesc.c
index 838c966a2..1f8834a05 100644
--- a/src/or/microdesc.c
+++ b/src/or/microdesc.c
@@ -714,9 +714,9 @@ microdesc_cache_rebuild(microdesc_cache_t *cache, int force)
     off_real = tor_fd_getpos(fd);
     if (off_real != off) {
       log_warn(LD_BUG, "Discontinuity in position in microdescriptor cache."
-               "By my count, I'm at "I64_FORMAT
-               ", but I should be at "I64_FORMAT,
-               I64_PRINTF_ARG(off), I64_PRINTF_ARG(off_real));
+               "By my count, I'm at %"PRId64
+               ", but I should be at %"PRId64,
+               (off), (off_real));
       if (off_real >= 0)
         off = off_real;
     }
diff --git a/src/or/rephist.c b/src/or/rephist.c
index 907b01d68..12b0225aa 100644
--- a/src/or/rephist.c
+++ b/src/or/rephist.c
@@ -1266,9 +1266,9 @@ rep_hist_fill_bandwidth_history(char *buf, size_t len, const bw_array_t *b)
       total = cutoff;
 
     if (n==(b->num_maxes_set-1))
-      tor_snprintf(cp, len-(cp-buf), U64_FORMAT, U64_PRINTF_ARG(total));
+      tor_snprintf(cp, len-(cp-buf), "%"PRIu64, (total));
     else
-      tor_snprintf(cp, len-(cp-buf), U64_FORMAT",", U64_PRINTF_ARG(total));
+      tor_snprintf(cp, len-(cp-buf), "%"PRIu64",", (total));
     cp += strlen(cp);
   }
   return cp-buf;
@@ -1380,17 +1380,17 @@ rep_hist_update_bwhist_state_section(or_state_t *state,
   for (j=0; j < b->num_maxes_set; ++j,++i) {
     if (i >= NUM_TOTALS)
       i = 0;
-    smartlist_add_asprintf(*s_values, U64_FORMAT,
-                           U64_PRINTF_ARG(b->totals[i] & ~0x3ff));
+    smartlist_add_asprintf(*s_values, "%"PRIu64,
+                           (b->totals[i] & ~0x3ff));
     maxval = b->maxima[i] / NUM_SECS_ROLLING_MEASURE;
-    smartlist_add_asprintf(*s_maxima, U64_FORMAT,
-                           U64_PRINTF_ARG(maxval & ~0x3ff));
+    smartlist_add_asprintf(*s_maxima, "%"PRIu64,
+                           (maxval & ~0x3ff));
   }
-  smartlist_add_asprintf(*s_values, U64_FORMAT,
-                         U64_PRINTF_ARG(b->total_in_period & ~0x3ff));
+  smartlist_add_asprintf(*s_values, "%"PRIu64,
+                         (b->total_in_period & ~0x3ff));
   maxval = b->max_total / NUM_SECS_ROLLING_MEASURE;
-  smartlist_add_asprintf(*s_maxima, U64_FORMAT,
-                         U64_PRINTF_ARG(maxval & ~0x3ff));
+  smartlist_add_asprintf(*s_maxima, "%"PRIu64,
+                         (maxval & ~0x3ff));
 }
 
 /** Update <b>state</b> with the newest bandwidth history. Done before
@@ -1964,8 +1964,8 @@ rep_hist_format_exit_stats(time_t now)
                      exit_bytes_written[cur_port],
                      EXIT_STATS_ROUND_UP_BYTES);
       num /= 1024;
-      smartlist_add_asprintf(written_strings, "%d="U64_FORMAT,
-                             cur_port, U64_PRINTF_ARG(num));
+      smartlist_add_asprintf(written_strings, "%d=%"PRIu64,
+                             cur_port, (num));
       other_written -= exit_bytes_written[cur_port];
     }
     if (exit_bytes_read[cur_port] > 0) {
@@ -1973,8 +1973,8 @@ rep_hist_format_exit_stats(time_t now)
                      exit_bytes_read[cur_port],
                      EXIT_STATS_ROUND_UP_BYTES);
       num /= 1024;
-      smartlist_add_asprintf(read_strings, "%d="U64_FORMAT,
-                             cur_port, U64_PRINTF_ARG(num));
+      smartlist_add_asprintf(read_strings, "%d=%"PRIu64,
+                             cur_port, (num));
       other_read -= exit_bytes_read[cur_port];
     }
     if (exit_streams[cur_port] > 0) {
@@ -1990,13 +1990,13 @@ rep_hist_format_exit_stats(time_t now)
   other_written = round_uint64_to_next_multiple_of(other_written,
                   EXIT_STATS_ROUND_UP_BYTES);
   other_written /= 1024;
-  smartlist_add_asprintf(written_strings, "other="U64_FORMAT,
-                         U64_PRINTF_ARG(other_written));
+  smartlist_add_asprintf(written_strings, "other=%"PRIu64,
+                         (other_written));
   other_read = round_uint64_to_next_multiple_of(other_read,
                EXIT_STATS_ROUND_UP_BYTES);
   other_read /= 1024;
-  smartlist_add_asprintf(read_strings, "other="U64_FORMAT,
-                         U64_PRINTF_ARG(other_read));
+  smartlist_add_asprintf(read_strings, "other=%"PRIu64,
+                         (other_read));
   other_streams = round_uint32_to_next_multiple_of(other_streams,
                   EXIT_STATS_ROUND_UP_STREAMS);
   smartlist_add_asprintf(streams_strings, "other=%u", other_streams);
@@ -2256,8 +2256,8 @@ rep_hist_format_buffer_stats(time_t now)
   time_in_queue_strings = smartlist_new();
   for (i = 0; i < SHARES; i++) {
     smartlist_add_asprintf(processed_cells_strings,
-                           U64_FORMAT, !circs_in_share[i] ? 0 :
-                           U64_PRINTF_ARG(processed_cells[i] /
+                           "%"PRIu64, !circs_in_share[i] ? 0 :
+                           (processed_cells[i] /
                            circs_in_share[i]));
   }
   for (i = 0; i < SHARES; i++) {
@@ -2924,14 +2924,14 @@ rep_hist_format_hs_stats(time_t now)
 
   format_iso_time(t, now);
   tor_asprintf(&hs_stats_string, "hidserv-stats-end %s (%d s)\n"
-               "hidserv-rend-relayed-cells "I64_FORMAT" delta_f=%d "
+               "hidserv-rend-relayed-cells %"PRId64" delta_f=%d "
                                            "epsilon=%.2f bin_size=%d\n"
-               "hidserv-dir-onions-seen "I64_FORMAT" delta_f=%d "
+               "hidserv-dir-onions-seen %"PRId64" delta_f=%d "
                                         "epsilon=%.2f bin_size=%d\n",
                t, (unsigned) (now - start_of_hs_stats_interval),
-               I64_PRINTF_ARG(obfuscated_cells_seen), REND_CELLS_DELTA_F,
+               (obfuscated_cells_seen), REND_CELLS_DELTA_F,
                REND_CELLS_EPSILON, REND_CELLS_BIN_SIZE,
-               I64_PRINTF_ARG(obfuscated_onions_seen),
+               (obfuscated_onions_seen),
                ONIONS_SEEN_DELTA_F,
                ONIONS_SEEN_EPSILON, ONIONS_SEEN_BIN_SIZE);
 
@@ -3117,33 +3117,33 @@ rep_hist_get_padding_count_lines(void)
   }
 
   tor_asprintf(&result, "padding-counts %s (%d s)"
-                        " bin-size="U64_FORMAT
-                        " write-drop="U64_FORMAT
-                        " write-pad="U64_FORMAT
-                        " write-total="U64_FORMAT
-                        " read-drop="U64_FORMAT
-                        " read-pad="U64_FORMAT
-                        " read-total="U64_FORMAT
-                        " enabled-read-pad="U64_FORMAT
-                        " enabled-read-total="U64_FORMAT
-                        " enabled-write-pad="U64_FORMAT
-                        " enabled-write-total="U64_FORMAT
-                        " max-chanpad-timers="U64_FORMAT
+                        " bin-size=%"PRIu64
+                        " write-drop=%"PRIu64
+                        " write-pad=%"PRIu64
+                        " write-total=%"PRIu64
+                        " read-drop=%"PRIu64
+                        " read-pad=%"PRIu64
+                        " read-total=%"PRIu64
+                        " enabled-read-pad=%"PRIu64
+                        " enabled-read-total=%"PRIu64
+                        " enabled-write-pad=%"PRIu64
+                        " enabled-write-total=%"PRIu64
+                        " max-chanpad-timers=%"PRIu64
                         "\n",
                padding_published.first_published_at,
                REPHIST_CELL_PADDING_COUNTS_INTERVAL,
-               U64_PRINTF_ARG(ROUND_CELL_COUNTS_TO),
-               U64_PRINTF_ARG(padding_published.write_drop_cell_count),
-               U64_PRINTF_ARG(padding_published.write_pad_cell_count),
-               U64_PRINTF_ARG(padding_published.write_cell_count),
-               U64_PRINTF_ARG(padding_published.read_drop_cell_count),
-               U64_PRINTF_ARG(padding_published.read_pad_cell_count),
-               U64_PRINTF_ARG(padding_published.read_cell_count),
-               U64_PRINTF_ARG(padding_published.enabled_read_pad_cell_count),
-               U64_PRINTF_ARG(padding_published.enabled_read_cell_count),
-               U64_PRINTF_ARG(padding_published.enabled_write_pad_cell_count),
-               U64_PRINTF_ARG(padding_published.enabled_write_cell_count),
-               U64_PRINTF_ARG(padding_published.maximum_chanpad_timers)
+               (uint64_t)ROUND_CELL_COUNTS_TO,
+               (padding_published.write_drop_cell_count),
+               (padding_published.write_pad_cell_count),
+               (padding_published.write_cell_count),
+               (padding_published.read_drop_cell_count),
+               (padding_published.read_pad_cell_count),
+               (padding_published.read_cell_count),
+               (padding_published.enabled_read_pad_cell_count),
+               (padding_published.enabled_read_cell_count),
+               (padding_published.enabled_write_pad_cell_count),
+               (padding_published.enabled_write_cell_count),
+               (padding_published.maximum_chanpad_timers)
                );
 
   return result;
@@ -3157,22 +3157,22 @@ rep_hist_log_link_protocol_counts(void)
 {
   log_notice(LD_HEARTBEAT,
              "Since startup, we have initiated "
-             U64_FORMAT" v1 connections, "
-             U64_FORMAT" v2 connections, "
-             U64_FORMAT" v3 connections, and "
-             U64_FORMAT" v4 connections; and received "
-             U64_FORMAT" v1 connections, "
-             U64_FORMAT" v2 connections, "
-             U64_FORMAT" v3 connections, and "
-             U64_FORMAT" v4 connections.",
-             U64_PRINTF_ARG(link_proto_count[1][1]),
-             U64_PRINTF_ARG(link_proto_count[2][1]),
-             U64_PRINTF_ARG(link_proto_count[3][1]),
-             U64_PRINTF_ARG(link_proto_count[4][1]),
-             U64_PRINTF_ARG(link_proto_count[1][0]),
-             U64_PRINTF_ARG(link_proto_count[2][0]),
-             U64_PRINTF_ARG(link_proto_count[3][0]),
-             U64_PRINTF_ARG(link_proto_count[4][0]));
+             "%"PRIu64" v1 connections, "
+             "%"PRIu64" v2 connections, "
+             "%"PRIu64" v3 connections, and "
+             "%"PRIu64" v4 connections; and received "
+             "%"PRIu64" v1 connections, "
+             "%"PRIu64" v2 connections, "
+             "%"PRIu64" v3 connections, and "
+             "%"PRIu64" v4 connections.",
+             (link_proto_count[1][1]),
+             (link_proto_count[2][1]),
+             (link_proto_count[3][1]),
+             (link_proto_count[4][1]),
+             (link_proto_count[1][0]),
+             (link_proto_count[2][0]),
+             (link_proto_count[3][0]),
+             (link_proto_count[4][0]));
 }
 
 /** Free all storage held by the OR/link history caches, by the
diff --git a/src/or/router.c b/src/or/router.c
index c7fed1f02..1337c420c 100644
--- a/src/or/router.c
+++ b/src/or/router.c
@@ -1355,10 +1355,10 @@ router_should_be_dirserver(const or_options_t *options, int dir_port)
       interval_length = 1;
     }
     log_info(LD_GENERAL, "Calculating whether to advertise %s: effective "
-                         "bwrate: %u, AccountingMax: "U64_FORMAT", "
+                         "bwrate: %u, AccountingMax: %"PRIu64", "
                          "accounting interval length %d",
                          dir_port ? "dirport" : "begindir",
-                         effective_bw, U64_PRINTF_ARG(options->AccountingMax),
+                         effective_bw, (options->AccountingMax),
                          interval_length);
 
     acc_bytes = options->AccountingMax;
diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index ad6555fe1..37337e93f 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -3348,10 +3348,10 @@ dump_routerlist_mem_usage(int severity)
                     olddescs += sd->signed_descriptor_len);
 
   tor_log(severity, LD_DIR,
-      "In %d live descriptors: "U64_FORMAT" bytes.  "
-      "In %d old descriptors: "U64_FORMAT" bytes.",
-      smartlist_len(routerlist->routers), U64_PRINTF_ARG(livedescs),
-      smartlist_len(routerlist->old_routers), U64_PRINTF_ARG(olddescs));
+      "In %d live descriptors: %"PRIu64" bytes.  "
+      "In %d old descriptors: %"PRIu64" bytes.",
+      smartlist_len(routerlist->routers), (livedescs),
+      smartlist_len(routerlist->old_routers), (olddescs));
 }
 
 /** Debugging helper: If <b>idx</b> is nonnegative, assert that <b>ri</b> is
diff --git a/src/or/routerparse.c b/src/or/routerparse.c
index 9f3072bc3..56853768d 100644
--- a/src/or/routerparse.c
+++ b/src/or/routerparse.c
@@ -874,8 +874,8 @@ dump_desc_populate_fifo_from_directory(const char *dirname)
     /* Log some stats */
     log_info(LD_DIR,
              "Reloaded unparseable descriptor dump FIFO with %d dump(s) "
-             "totaling " U64_FORMAT " bytes",
-             smartlist_len(descs_dumped), U64_PRINTF_ARG(len_descs_dumped));
+             "totaling %"PRIu64 " bytes",
+             smartlist_len(descs_dumped), (len_descs_dumped));
   }
 
   /* Free the original list */
@@ -2947,8 +2947,8 @@ networkstatus_verify_bw_weights(networkstatus_t *ns, int consensus_method)
   // We use > 1 as the check for these because they are computed as integers.
   // Sometimes there are rounding errors.
   if (fabs(Wmm - weight_scale) > 1) {
-    log_warn(LD_BUG, "Wmm=%f != "I64_FORMAT,
-             Wmm, I64_PRINTF_ARG(weight_scale));
+    log_warn(LD_BUG, "Wmm=%f != %"PRId64,
+             Wmm, (weight_scale));
     valid = 0;
   }
 
@@ -2968,20 +2968,20 @@ networkstatus_verify_bw_weights(networkstatus_t *ns, int consensus_method)
   }
 
   if (fabs(Wgg + Wmg - weight_scale) > 0.001*weight_scale) {
-    log_warn(LD_BUG, "Wgg=%f != "I64_FORMAT" - Wmg=%f", Wgg,
-             I64_PRINTF_ARG(weight_scale), Wmg);
+    log_warn(LD_BUG, "Wgg=%f != %"PRId64" - Wmg=%f", Wgg,
+             (weight_scale), Wmg);
     valid = 0;
   }
 
   if (fabs(Wee + Wme - weight_scale) > 0.001*weight_scale) {
-    log_warn(LD_BUG, "Wee=%f != "I64_FORMAT" - Wme=%f", Wee,
-             I64_PRINTF_ARG(weight_scale), Wme);
+    log_warn(LD_BUG, "Wee=%f != %"PRId64" - Wme=%f", Wee,
+             (weight_scale), Wme);
     valid = 0;
   }
 
   if (fabs(Wgd + Wmd + Wed - weight_scale) > 0.001*weight_scale) {
-    log_warn(LD_BUG, "Wgd=%f + Wmd=%f + Wed=%f != "I64_FORMAT,
-             Wgd, Wmd, Wed, I64_PRINTF_ARG(weight_scale));
+    log_warn(LD_BUG, "Wgd=%f + Wmd=%f + Wed=%f != %"PRId64,
+             Wgd, Wmd, Wed, (weight_scale));
     valid = 0;
   }
 
@@ -3039,36 +3039,36 @@ networkstatus_verify_bw_weights(networkstatus_t *ns, int consensus_method)
     if (fabs(Etotal-Mtotal) > 0.01*MAX(Etotal,Mtotal)) {
       log_warn(LD_DIR,
                "Bw Weight Failure for %s: Etotal %f != Mtotal %f. "
-               "G="I64_FORMAT" M="I64_FORMAT" E="I64_FORMAT" D="I64_FORMAT
-               " T="I64_FORMAT". "
+               "G=%"PRId64" M=%"PRId64" E=%"PRId64" D=%"PRId64
+               " T=%"PRId64". "
                "Wgg=%f Wgd=%f Wmg=%f Wme=%f Wmd=%f Wee=%f Wed=%f",
                casename, Etotal, Mtotal,
-               I64_PRINTF_ARG(G), I64_PRINTF_ARG(M), I64_PRINTF_ARG(E),
-               I64_PRINTF_ARG(D), I64_PRINTF_ARG(T),
+               (G), (M), (E),
+               (D), (T),
                Wgg, Wgd, Wmg, Wme, Wmd, Wee, Wed);
       valid = 0;
     }
     if (fabs(Etotal-Gtotal) > 0.01*MAX(Etotal,Gtotal)) {
       log_warn(LD_DIR,
                "Bw Weight Failure for %s: Etotal %f != Gtotal %f. "
-               "G="I64_FORMAT" M="I64_FORMAT" E="I64_FORMAT" D="I64_FORMAT
-               " T="I64_FORMAT". "
+               "G=%"PRId64" M=%"PRId64" E=%"PRId64" D=%"PRId64
+               " T=%"PRId64". "
                "Wgg=%f Wgd=%f Wmg=%f Wme=%f Wmd=%f Wee=%f Wed=%f",
                casename, Etotal, Gtotal,
-               I64_PRINTF_ARG(G), I64_PRINTF_ARG(M), I64_PRINTF_ARG(E),
-               I64_PRINTF_ARG(D), I64_PRINTF_ARG(T),
+               (G), (M), (E),
+               (D), (T),
                Wgg, Wgd, Wmg, Wme, Wmd, Wee, Wed);
       valid = 0;
     }
     if (fabs(Gtotal-Mtotal) > 0.01*MAX(Gtotal,Mtotal)) {
       log_warn(LD_DIR,
                "Bw Weight Failure for %s: Mtotal %f != Gtotal %f. "
-               "G="I64_FORMAT" M="I64_FORMAT" E="I64_FORMAT" D="I64_FORMAT
-               " T="I64_FORMAT". "
+               "G=%"PRId64" M=%"PRId64" E=%"PRId64" D=%"PRId64
+               " T=%"PRId64". "
                "Wgg=%f Wgd=%f Wmg=%f Wme=%f Wmd=%f Wee=%f Wed=%f",
                casename, Mtotal, Gtotal,
-               I64_PRINTF_ARG(G), I64_PRINTF_ARG(M), I64_PRINTF_ARG(E),
-               I64_PRINTF_ARG(D), I64_PRINTF_ARG(T),
+               (G), (M), (E),
+               (D), (T),
                Wgg, Wgd, Wmg, Wme, Wmd, Wee, Wed);
       valid = 0;
     }
@@ -3095,12 +3095,12 @@ networkstatus_verify_bw_weights(networkstatus_t *ns, int consensus_method)
       if (Rtotal > Stotal) {
         log_warn(LD_DIR,
                    "Bw Weight Failure for %s: Rtotal %f > Stotal %f. "
-                   "G="I64_FORMAT" M="I64_FORMAT" E="I64_FORMAT" D="I64_FORMAT
-                   " T="I64_FORMAT". "
+                   "G=%"PRId64" M=%"PRId64" E=%"PRId64" D=%"PRId64
+                   " T=%"PRId64". "
                    "Wgg=%f Wgd=%f Wmg=%f Wme=%f Wmd=%f Wee=%f Wed=%f",
                    casename, Rtotal, Stotal,
-                   I64_PRINTF_ARG(G), I64_PRINTF_ARG(M), I64_PRINTF_ARG(E),
-                   I64_PRINTF_ARG(D), I64_PRINTF_ARG(T),
+                   (G), (M), (E),
+                   (D), (T),
                    Wgg, Wgd, Wmg, Wme, Wmd, Wee, Wed);
         valid = 0;
       }
@@ -3108,12 +3108,12 @@ networkstatus_verify_bw_weights(networkstatus_t *ns, int consensus_method)
       if (3*Rtotal > T) {
         log_warn(LD_DIR,
                    "Bw Weight Failure for %s: 3*Rtotal %f > T "
-                   I64_FORMAT". G="I64_FORMAT" M="I64_FORMAT" E="I64_FORMAT
-                   " D="I64_FORMAT" T="I64_FORMAT". "
+                   "%"PRId64". G=%"PRId64" M=%"PRId64" E=%"PRId64
+                   " D=%"PRId64" T=%"PRId64". "
                    "Wgg=%f Wgd=%f Wmg=%f Wme=%f Wmd=%f Wee=%f Wed=%f",
-                   casename, Rtotal*3, I64_PRINTF_ARG(T),
-                   I64_PRINTF_ARG(G), I64_PRINTF_ARG(M), I64_PRINTF_ARG(E),
-                   I64_PRINTF_ARG(D), I64_PRINTF_ARG(T),
+                   casename, Rtotal*3, (T),
+                   (G), (M), (E),
+                   (D), (T),
                    Wgg, Wgd, Wmg, Wme, Wmd, Wee, Wed);
         valid = 0;
       }
@@ -3121,12 +3121,12 @@ networkstatus_verify_bw_weights(networkstatus_t *ns, int consensus_method)
       if (3*Stotal > T) {
         log_warn(LD_DIR,
                    "Bw Weight Failure for %s: 3*Stotal %f > T "
-                   I64_FORMAT". G="I64_FORMAT" M="I64_FORMAT" E="I64_FORMAT
-                   " D="I64_FORMAT" T="I64_FORMAT". "
+                   "%"PRId64". G=%"PRId64" M=%"PRId64" E=%"PRId64
+                   " D=%"PRId64" T=%"PRId64". "
                    "Wgg=%f Wgd=%f Wmg=%f Wme=%f Wmd=%f Wee=%f Wed=%f",
-                   casename, Stotal*3, I64_PRINTF_ARG(T),
-                   I64_PRINTF_ARG(G), I64_PRINTF_ARG(M), I64_PRINTF_ARG(E),
-                   I64_PRINTF_ARG(D), I64_PRINTF_ARG(T),
+                   casename, Stotal*3, (T),
+                   (G), (M), (E),
+                   (D), (T),
                    Wgg, Wgd, Wmg, Wme, Wmd, Wee, Wed);
         valid = 0;
       }
@@ -3134,13 +3134,13 @@ networkstatus_verify_bw_weights(networkstatus_t *ns, int consensus_method)
       if (3*Mtotal < T) {
         log_warn(LD_DIR,
                    "Bw Weight Failure for %s: 3*Mtotal %f < T "
-                   I64_FORMAT". "
-                   "G="I64_FORMAT" M="I64_FORMAT" E="I64_FORMAT" D="I64_FORMAT
-                   " T="I64_FORMAT". "
+                   "%"PRId64". "
+                   "G=%"PRId64" M=%"PRId64" E=%"PRId64" D=%"PRId64
+                   " T=%"PRId64". "
                    "Wgg=%f Wgd=%f Wmg=%f Wme=%f Wmd=%f Wee=%f Wed=%f",
-                   casename, Mtotal*3, I64_PRINTF_ARG(T),
-                   I64_PRINTF_ARG(G), I64_PRINTF_ARG(M), I64_PRINTF_ARG(E),
-                   I64_PRINTF_ARG(D), I64_PRINTF_ARG(T),
+                   casename, Mtotal*3, (T),
+                   (G), (M), (E),
+                   (D), (T),
                    Wgg, Wgd, Wmg, Wme, Wmd, Wee, Wed);
         valid = 0;
       }
@@ -3153,36 +3153,36 @@ networkstatus_verify_bw_weights(networkstatus_t *ns, int consensus_method)
         if (fabs(Etotal-Mtotal) > 0.01*MAX(Etotal,Mtotal)) {
           log_warn(LD_DIR,
                    "Bw Weight Failure for %s: Etotal %f != Mtotal %f. "
-                   "G="I64_FORMAT" M="I64_FORMAT" E="I64_FORMAT" D="I64_FORMAT
-                   " T="I64_FORMAT". "
+                   "G=%"PRId64" M=%"PRId64" E=%"PRId64" D=%"PRId64
+                   " T=%"PRId64". "
                    "Wgg=%f Wgd=%f Wmg=%f Wme=%f Wmd=%f Wee=%f Wed=%f",
                    casename, Etotal, Mtotal,
-                   I64_PRINTF_ARG(G), I64_PRINTF_ARG(M), I64_PRINTF_ARG(E),
-                   I64_PRINTF_ARG(D), I64_PRINTF_ARG(T),
+                   (G), (M), (E),
+                   (D), (T),
                    Wgg, Wgd, Wmg, Wme, Wmd, Wee, Wed);
           valid = 0;
         }
         if (fabs(Etotal-Gtotal) > 0.01*MAX(Etotal,Gtotal)) {
           log_warn(LD_DIR,
                    "Bw Weight Failure for %s: Etotal %f != Gtotal %f. "
-                   "G="I64_FORMAT" M="I64_FORMAT" E="I64_FORMAT" D="I64_FORMAT
-                   " T="I64_FORMAT". "
+                   "G=%"PRId64" M=%"PRId64" E=%"PRId64" D=%"PRId64
+                   " T=%"PRId64". "
                    "Wgg=%f Wgd=%f Wmg=%f Wme=%f Wmd=%f Wee=%f Wed=%f",
                    casename, Etotal, Gtotal,
-                   I64_PRINTF_ARG(G), I64_PRINTF_ARG(M), I64_PRINTF_ARG(E),
-                   I64_PRINTF_ARG(D), I64_PRINTF_ARG(T),
+                   (G), (M), (E),
+                   (D), (T),
                    Wgg, Wgd, Wmg, Wme, Wmd, Wee, Wed);
           valid = 0;
         }
         if (fabs(Gtotal-Mtotal) > 0.01*MAX(Gtotal,Mtotal)) {
           log_warn(LD_DIR,
                    "Bw Weight Failure for %s: Mtotal %f != Gtotal %f. "
-                   "G="I64_FORMAT" M="I64_FORMAT" E="I64_FORMAT" D="I64_FORMAT
-                   " T="I64_FORMAT". "
+                   "G=%"PRId64" M=%"PRId64" E=%"PRId64" D=%"PRId64
+                   " T=%"PRId64". "
                    "Wgg=%f Wgd=%f Wmg=%f Wme=%f Wmd=%f Wee=%f Wed=%f",
                    casename, Mtotal, Gtotal,
-                   I64_PRINTF_ARG(G), I64_PRINTF_ARG(M), I64_PRINTF_ARG(E),
-                   I64_PRINTF_ARG(D), I64_PRINTF_ARG(T),
+                   (G), (M), (E),
+                   (D), (T),
                    Wgg, Wgd, Wmg, Wme, Wmd, Wee, Wed);
           valid = 0;
         }
@@ -3190,12 +3190,12 @@ networkstatus_verify_bw_weights(networkstatus_t *ns, int consensus_method)
         if (fabs(Etotal-Gtotal) > 0.01*MAX(Etotal,Gtotal)) {
           log_warn(LD_DIR,
                    "Bw Weight Failure for %s: Etotal %f != Gtotal %f. "
-                   "G="I64_FORMAT" M="I64_FORMAT" E="I64_FORMAT" D="I64_FORMAT
-                   " T="I64_FORMAT". "
+                   "G=%"PRId64" M=%"PRId64" E=%"PRId64" D=%"PRId64
+                   " T=%"PRId64". "
                    "Wgg=%f Wgd=%f Wmg=%f Wme=%f Wmd=%f Wee=%f Wed=%f",
                    casename, Etotal, Gtotal,
-                   I64_PRINTF_ARG(G), I64_PRINTF_ARG(M), I64_PRINTF_ARG(E),
-                   I64_PRINTF_ARG(D), I64_PRINTF_ARG(T),
+                   (G), (M), (E),
+                   (D), (T),
                    Wgg, Wgd, Wmg, Wme, Wmd, Wee, Wed);
           valid = 0;
         }
@@ -3220,12 +3220,12 @@ networkstatus_verify_bw_weights(networkstatus_t *ns, int consensus_method)
       if (3*Stotal > T) {
         log_warn(LD_DIR,
                    "Bw Weight Failure for %s: 3*Stotal %f > T "
-                   I64_FORMAT". G="I64_FORMAT" M="I64_FORMAT" E="I64_FORMAT
-                   " D="I64_FORMAT" T="I64_FORMAT". "
+                   "%"PRId64". G=%"PRId64" M=%"PRId64" E=%"PRId64
+                   " D=%"PRId64" T=%"PRId64". "
                    "Wgg=%f Wgd=%f Wmg=%f Wme=%f Wmd=%f Wee=%f Wed=%f",
-                   casename, Stotal*3, I64_PRINTF_ARG(T),
-                   I64_PRINTF_ARG(G), I64_PRINTF_ARG(M), I64_PRINTF_ARG(E),
-                   I64_PRINTF_ARG(D), I64_PRINTF_ARG(T),
+                   casename, Stotal*3, (T),
+                   (G), (M), (E),
+                   (D), (T),
                    Wgg, Wgd, Wmg, Wme, Wmd, Wee, Wed);
         valid = 0;
       }
@@ -3233,12 +3233,12 @@ networkstatus_verify_bw_weights(networkstatus_t *ns, int consensus_method)
         if (fabs(NStotal-Mtotal) > 0.01*MAX(NStotal,Mtotal)) {
           log_warn(LD_DIR,
                    "Bw Weight Failure for %s: NStotal %f != Mtotal %f. "
-                   "G="I64_FORMAT" M="I64_FORMAT" E="I64_FORMAT" D="I64_FORMAT
-                   " T="I64_FORMAT". "
+                   "G=%"PRId64" M=%"PRId64" E=%"PRId64" D=%"PRId64
+                   " T=%"PRId64". "
                    "Wgg=%f Wgd=%f Wmg=%f Wme=%f Wmd=%f Wee=%f Wed=%f",
                    casename, NStotal, Mtotal,
-                   I64_PRINTF_ARG(G), I64_PRINTF_ARG(M), I64_PRINTF_ARG(E),
-                   I64_PRINTF_ARG(D), I64_PRINTF_ARG(T),
+                   (G), (M), (E),
+                   (D), (T),
                    Wgg, Wgd, Wmg, Wme, Wmd, Wee, Wed);
           valid = 0;
         }
@@ -3247,12 +3247,12 @@ networkstatus_verify_bw_weights(networkstatus_t *ns, int consensus_method)
         if (3*NStotal < T) {
           log_warn(LD_DIR,
                      "Bw Weight Failure for %s: 3*NStotal %f < T "
-                     I64_FORMAT". G="I64_FORMAT" M="I64_FORMAT
-                     " E="I64_FORMAT" D="I64_FORMAT" T="I64_FORMAT". "
+                     "%"PRId64". G=%"PRId64" M=%"PRId64
+                     " E=%"PRId64" D=%"PRId64" T=%"PRId64". "
                      "Wgg=%f Wgd=%f Wmg=%f Wme=%f Wmd=%f Wee=%f Wed=%f",
-                     casename, NStotal*3, I64_PRINTF_ARG(T),
-                     I64_PRINTF_ARG(G), I64_PRINTF_ARG(M), I64_PRINTF_ARG(E),
-                     I64_PRINTF_ARG(D), I64_PRINTF_ARG(T),
+                     casename, NStotal*3, (T),
+                     (G), (M), (E),
+                     (D), (T),
                      Wgg, Wgd, Wmg, Wme, Wmd, Wee, Wed);
           valid = 0;
         }
@@ -3262,36 +3262,36 @@ networkstatus_verify_bw_weights(networkstatus_t *ns, int consensus_method)
       if (fabs(Etotal-Mtotal) > 0.01*MAX(Etotal,Mtotal)) {
         log_warn(LD_DIR,
                  "Bw Weight Failure for %s: Etotal %f != Mtotal %f. "
-                 "G="I64_FORMAT" M="I64_FORMAT" E="I64_FORMAT" D="I64_FORMAT
-                 " T="I64_FORMAT". "
+                 "G=%"PRId64" M=%"PRId64" E=%"PRId64" D=%"PRId64
+                 " T=%"PRId64". "
                  "Wgg=%f Wgd=%f Wmg=%f Wme=%f Wmd=%f Wee=%f Wed=%f",
                  casename, Etotal, Mtotal,
-                 I64_PRINTF_ARG(G), I64_PRINTF_ARG(M), I64_PRINTF_ARG(E),
-                 I64_PRINTF_ARG(D), I64_PRINTF_ARG(T),
+                 (G), (M), (E),
+                 (D), (T),
                  Wgg, Wgd, Wmg, Wme, Wmd, Wee, Wed);
         valid = 0;
       }
       if (fabs(Etotal-Gtotal) > 0.01*MAX(Etotal,Gtotal)) {
         log_warn(LD_DIR,
                  "Bw Weight Failure for %s: Etotal %f != Gtotal %f. "
-                 "G="I64_FORMAT" M="I64_FORMAT" E="I64_FORMAT" D="I64_FORMAT
-                 " T="I64_FORMAT". "
+                 "G=%"PRId64" M=%"PRId64" E=%"PRId64" D=%"PRId64
+                 " T=%"PRId64". "
                  "Wgg=%f Wgd=%f Wmg=%f Wme=%f Wmd=%f Wee=%f Wed=%f",
                  casename, Etotal, Gtotal,
-                 I64_PRINTF_ARG(G), I64_PRINTF_ARG(M), I64_PRINTF_ARG(E),
-                 I64_PRINTF_ARG(D), I64_PRINTF_ARG(T),
+                 (G), (M), (E),
+                 (D), (T),
                  Wgg, Wgd, Wmg, Wme, Wmd, Wee, Wed);
         valid = 0;
       }
       if (fabs(Gtotal-Mtotal) > 0.01*MAX(Gtotal,Mtotal)) {
         log_warn(LD_DIR,
                  "Bw Weight Failure for %s: Mtotal %f != Gtotal %f. "
-                 "G="I64_FORMAT" M="I64_FORMAT" E="I64_FORMAT" D="I64_FORMAT
-                 " T="I64_FORMAT". "
+                 "G=%"PRId64" M=%"PRId64" E=%"PRId64" D=%"PRId64
+                 " T=%"PRId64". "
                  "Wgg=%f Wgd=%f Wmg=%f Wme=%f Wmd=%f Wee=%f Wed=%f",
                  casename, Mtotal, Gtotal,
-                 I64_PRINTF_ARG(G), I64_PRINTF_ARG(M), I64_PRINTF_ARG(E),
-                 I64_PRINTF_ARG(D), I64_PRINTF_ARG(T),
+                 (G), (M), (E),
+                 (D), (T),
                  Wgg, Wgd, Wmg, Wme, Wmd, Wee, Wed);
         valid = 0;
       }
diff --git a/src/or/scheduler_vanilla.c b/src/or/scheduler_vanilla.c
index 0346af2ad..e05bebb37 100644
--- a/src/or/scheduler_vanilla.c
+++ b/src/or/scheduler_vanilla.c
@@ -72,9 +72,9 @@ vanilla_scheduler_run(void)
     n_cells = channel_num_cells_writeable(chan);
     if (n_cells > 0) {
       log_debug(LD_SCHED,
-                "Scheduler saw pending channel " U64_FORMAT " at %p with "
+                "Scheduler saw pending channel %"PRIu64 " at %p with "
                 "%d cells writeable",
-                U64_PRINTF_ARG(chan->global_identifier), chan, n_cells);
+                (chan->global_identifier), chan, n_cells);
 
       flushed = 0;
       while (flushed < n_cells) {
@@ -97,9 +97,9 @@ vanilla_scheduler_run(void)
             if (!to_readd) to_readd = smartlist_new();
             smartlist_add(to_readd, chan);
             log_debug(LD_SCHED,
-                      "Channel " U64_FORMAT " at %p "
+                      "Channel %"PRIu64 " at %p "
                       "is still pending",
-                      U64_PRINTF_ARG(chan->global_identifier),
+                      (chan->global_identifier),
                       chan);
           } else {
             /* It's waiting to be able to write more */
@@ -125,14 +125,14 @@ vanilla_scheduler_run(void)
 
       log_debug(LD_SCHED,
                 "Scheduler flushed %d cells onto pending channel "
-                U64_FORMAT " at %p",
-                (int)flushed, U64_PRINTF_ARG(chan->global_identifier),
+                "%"PRIu64 " at %p",
+                (int)flushed, (chan->global_identifier),
                 chan);
     } else {
       log_info(LD_SCHED,
-               "Scheduler saw pending channel " U64_FORMAT " at %p with "
+               "Scheduler saw pending channel %"PRIu64 " at %p with "
                "no cells writeable",
-               U64_PRINTF_ARG(chan->global_identifier), chan);
+               (chan->global_identifier), chan);
       /* Put it back to WAITING_TO_WRITE */
       scheduler_set_channel_state(chan, SCHED_CHAN_WAITING_TO_WRITE);
     }
diff --git a/src/or/status.c b/src/or/status.c
index d0b3bc553..5c0a768ac 100644
--- a/src/or/status.c
+++ b/src/or/status.c
@@ -77,7 +77,7 @@ bytes_to_usage(uint64_t bytes)
   char *bw_string = NULL;
 
   if (bytes < (1<<20)) { /* Less than a megabyte. */
-    tor_asprintf(&bw_string, U64_FORMAT" kB", U64_PRINTF_ARG(bytes>>10));
+    tor_asprintf(&bw_string, "%"PRIu64" kB", (bytes>>10));
   } else if (bytes < (1<<30)) { /* Megabytes. Let's add some precision. */
     double bw = U64_TO_DBL(bytes);
     tor_asprintf(&bw_string, "%.2f MB", bw/(1<<20));
@@ -188,12 +188,12 @@ log_heartbeat(time_t now)
     const uint64_t main_loop_idle_count = get_main_loop_idle_count();
 
     log_fn(LOG_NOTICE, LD_HEARTBEAT, "Main event loop statistics: "
-         U64_FORMAT " successful returns, "
-         U64_FORMAT " erroneous returns, and "
-         U64_FORMAT " idle returns.",
-         U64_PRINTF_ARG(main_loop_success_count),
-         U64_PRINTF_ARG(main_loop_error_count),
-         U64_PRINTF_ARG(main_loop_idle_count));
+         "%"PRIu64 " successful returns, "
+         "%"PRIu64 " erroneous returns, and "
+         "%"PRIu64 " idle returns.",
+         (main_loop_success_count),
+         (main_loop_error_count),
+         (main_loop_idle_count));
   }
 
   /** Now, if we are an HS service, log some stats about our usage */
diff --git a/src/test/test-timers.c b/src/test/test-timers.c
index f6ff9a5f8..aed150bda 100644
--- a/src/test/test-timers.c
+++ b/src/test/test-timers.c
@@ -104,8 +104,8 @@ main(int argc, char **argv)
     total_square_difference += diff*diff;
   }
   const int64_t mean_diff = total_difference / n_active_timers;
-  printf("mean difference: "I64_FORMAT" usec\n",
-         I64_PRINTF_ARG(mean_diff));
+  printf("mean difference: %"PRId64" usec\n",
+         (mean_diff));
 
   const double mean_sq = ((double)total_square_difference)/ n_active_timers;
   const double sq_mean = mean_diff * mean_diff;
diff --git a/src/test/test_util.c b/src/test/test_util.c
index 5fea1a463..67a10a8a5 100644
--- a/src/test/test_util.c
+++ b/src/test/test_util.c
@@ -1918,8 +1918,8 @@ test_util_strmisc(void *arg)
   tor_snprintf(buf, 10, "abcdef");
   tt_int_op(0,OP_EQ, buf[6]);
   /* uint64 */
-  tor_snprintf(buf, sizeof(buf), "x!"U64_FORMAT"!x",
-               U64_PRINTF_ARG(UINT64_C(12345678901)));
+  tor_snprintf(buf, sizeof(buf), "x!%"PRIu64"!x",
+               (UINT64_C(12345678901)));
   tt_str_op("x!12345678901!x",OP_EQ, buf);
 
   /* Test str{,case}cmpstart */
@@ -5557,7 +5557,7 @@ test_util_max_mem(void *arg)
   tt_int_op(r, OP_EQ, r2);
   tt_uint_op(memory2, OP_EQ, memory1);
 
-  TT_BLATHER(("System memory: "U64_FORMAT, U64_PRINTF_ARG(memory1)));
+  TT_BLATHER(("System memory: %"PRIu64, (memory1)));
 
   if (r==0) {
     /* You have at least a megabyte. */



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits