On 26/01/2021 17:10, Eli Zaretskii wrote: > Could someone (Keith?) please remind me how to avoid the following > compiler warning: > > D:\usr\eli>gcc -Wall -pedantic -c tsnprintf.c When building GCC, I configure with: --disable-build-format-warnings but that's a package-specific configuration option. For more general use, you could try: D:\usr\eli>gcc -Wall -pedantic -Wno-pedantic-ms-format -c tsnprintf.c Alternatively, insert: #pragma GCC diagnostic ignored "-Wformat" into the source, (but that would suppress *all* format warnings), or (more selectively) wrap the offending snprintf() call within: # pragma GCC diagnostic push # pragma GCC diagnostic ignored "-Wformat" snprintf (buf, 40, "%" PRIu64, bar); # pragma GCC diagnostic pop (Unfortunately, I'm not aware of any pragma which would activate -Wno-pedantic-ms-format in any more selective fashion, or I might suggest adding it to features.h). > One way of getting rid of this is to use _snprintf instead, but is > there a cleaner way? I wouldn't recommend that: _snprintf() is *not* a drop-in replacement for snprintf(), but __mingw_snprintf() might be a viable alternative; (after all, it *is* MinGW's effective implementation of snprintf()). > I thought some function attribute could solve this, perhaps? The format attribute is already specified; I'm not aware of any modifier to override the pedantic-ms-format behaviour. -- Regards, Keith. Public key available from keys.gnupg.net Key fingerprint: C19E C018 1547 DE50 E1D4 8F53 C0AD 36C6 347E 5A3F -------------- next part -------------- A non-text attachment was scrubbed... Name: OpenPGP_signature Type: application/pgp-signature Size: 840 bytes Desc: OpenPGP digital signature URL: <https://lists.osdn.me/mailman/archives/mingw-users/attachments/20210126/9d34c725/attachment.sig>