From cc21c646621e661abd2d10029849b9db43146284 Mon Sep 17 00:00:00 2001 From: Nate Bargmann Date: Tue, 9 Feb 2016 11:26:23 -0600 Subject: [PATCH] Advise on use of int64_t cast Advise on testing with clang compiler and using int64_t cast with PRIll macro. Fix GCC warning when 'make distcheck' is run. --- README.developer | 3 ++- tests/testbcd.c | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/README.developer b/README.developer index 1813f3ed9..3bfa5a18c 100644 --- a/README.developer +++ b/README.developer @@ -577,12 +577,13 @@ Hamlib should also compile with the following common compilers: * gcc-4.x and newer * in shared and static * C++ compiler against rig.h, riglist.h, rotator.h + * clang compiler Portability issues to watch: * little vs. big endian systems (use shifts or adhoc functions) * 64 bit int: avoid them in API - * printf/scanf of 64bit int: use PRIll and SCNll + * printf/scanf of 64bit int: use PRIll (cast value to int64_t) and SCNll * printf/scanf of freq_t: use PRIfreq and SCNfreq Testing: diff --git a/tests/testbcd.c b/tests/testbcd.c index a642cbe1e..8cb25a603 100644 --- a/tests/testbcd.c +++ b/tests/testbcd.c @@ -40,7 +40,7 @@ int main (int argc, char *argv[]) printf("BCD: %2.2x",b[0]); for (i = 1; i < (digits+1)/2; i++) printf(",%2.2x",b[i]); - printf("\nResult after recoding: %"PRIll"\n", from_bcd(b, digits)); + printf("\nResult after recoding: %"PRIll"\n", (int64_t)from_bcd(b, digits)); printf("\nBig Endian mode\n"); printf("Frequency: %"PRIfreq"\n",f); @@ -48,7 +48,7 @@ int main (int argc, char *argv[]) printf("BCD: %2.2x",b[0]); for (i = 1; i < (digits+1)/2; i++) printf(",%2.2x",b[i]); - printf("\nResult after recoding: %"PRIll"\n", from_bcd_be(b, digits)); + printf("\nResult after recoding: %"PRIll"\n", (int64_t)from_bcd_be(b, digits)); return 0; }