[Cryptech-Commits] [sw/libhal] 01/02: Silence platform-dependent compiler whining: in general, when printf() whines about some platform-dependent integer size issue, it's best to use both an explicitly sized format (eg, "%lu") and an explicit cast (eg, "(unsigned long)") when silencing the warning, otherwise it'll just pop up again in different form on the next platform tested.

git at cryptech.is git at cryptech.is
Sun Dec 13 06:49:48 UTC 2015


This is an automated email from the git hooks/post-receive script.

sra at hactrn.net pushed a commit to branch rpc
in repository sw/libhal.

commit 6f479d8615a60e94b3c19e090a4eba8a0256ec32
Author: Rob Austein <sra at hactrn.net>
Date:   Sat Dec 12 16:12:02 2015 -0500

    Silence platform-dependent compiler whining: in general, when printf()
    whines about some platform-dependent integer size issue, it's best to
    use both an explicitly sized format (eg, "%lu") and an explicit cast
    (eg, "(unsigned long)") when silencing the warning, otherwise it'll
    just pop up again in different form on the next platform tested.
---
 tests/test-bus.c | 3 ++-
 utils/cores.c    | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/tests/test-bus.c b/tests/test-bus.c
index 1c60e5d..b4a3e1c 100644
--- a/tests/test-bus.c
+++ b/tests/test-bus.c
@@ -91,7 +91,8 @@ static void _time_check(char *label, const struct timeval t0, const int err)
     t.tv_sec  -= 1;
   }
   rounds = (float)TEST_NUM_ROUNDS/((float)t.tv_sec + ((float)t.tv_usec / 1000000));
-  printf("%s%lu.%06lu seconds, %u/sec\n", label, t.tv_sec, t.tv_usec, (unsigned)rounds);
+  printf("%s%lu.%06lu seconds, %u/sec\n", label,
+	 (unsigned long)t.tv_sec, (unsigned long)t.tv_usec, (unsigned)rounds);
 }
 
 #define time_check(_label_, _expr_)             \
diff --git a/utils/cores.c b/utils/cores.c
index d59f834..18e994d 100644
--- a/utils/cores.c
+++ b/utils/cores.c
@@ -49,7 +49,7 @@ int main(int argc, char *argv[])
 
     for (core = hal_core_iterate(NULL); core != NULL; core = hal_core_iterate(core)) {
 	info = hal_core_info(core);
-	printf("%08lx: %8.8s %4.4s\n", info->base, info->name, info->version);
+	printf("%08lx: %8.8s %4.4s\n", (unsigned long)info->base, info->name, info->version);
     }
 
     return 0;



More information about the Commits mailing list