From: Ondřej Surý Date: Wed, 15 Apr 2020 10:36:12 +0000 (+0200) Subject: Workaround MSVC warning C4477 X-Git-Tag: v9.17.2~146^2~4 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=60c632ab91dc8f817e1641c9e3317b8933ab5af4;p=thirdparty%2Fbind9.git Workaround MSVC warning C4477 Due to a way the stdatomic.h shim is implemented on Windows, the MSVC always things that the outside type is the largest - atomic_(u)int_fast64_t. This can lead to false positives as this one: lib\dns\adb.c(3678): warning C4477: 'fprintf' : format string '%u' requires an argument of type 'unsigned int', but variadic argument 2 has type 'unsigned __int64' We workaround the issue by loading the value in a scoped local variable with correct type first. --- diff --git a/lib/dns/adb.c b/lib/dns/adb.c index 5d0a5d6dcf9..a2800226d1f 100644 --- a/lib/dns/adb.c +++ b/lib/dns/adb.c @@ -3675,8 +3675,9 @@ dump_entry(FILE *f, dns_adb_t *adb, dns_adbentry_t *entry, bool debug, } if (adb != NULL && adb->quota != 0 && adb->atr_freq != 0) { + uint_fast32_t quota = atomic_load_relaxed(&entry->quota); fprintf(f, " [atr %0.2f] [quota %" PRIuFAST32 "]", entry->atr, - atomic_load_relaxed(&entry->quota)); + quota); } fprintf(f, "\n");