Re: ISO C does not support %I64

Keith Marshall <[email protected]> Tue, 26 Jan 2021 19:50:04 +0000
Newsgroups gmane.comp.gnu.mingw.user
Organization MinGW.org Project
Message-ID <[email protected]>
This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
--===============5665097984433380596==
Content-Type: multipart/signed; micalg=pgp-sha256;
 protocol="application/pgp-signature";
 boundary="MI2hRagcUnBlPHhrOZe1eE8N3IuOJjlTc"

This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
--MI2hRagcUnBlPHhrOZe1eE8N3IuOJjlTc
Content-Type: multipart/mixed; boundary="lGr8FfKLVXBcJQ8KrudYR1kfk8n0aEriU";
 protected-headers="v1"
From: Keith Marshall <[email protected]>
To: [email protected]
Message-ID: <8e7f2ad6-7fdb-c46e-e868-330110ccc8bc-JlWs9+JhQMeJPt80KsDg5Q@public.gmane.org>
Subject: Re: [MinGW-Users] ISO C does not support %I64
References: <8335yn1v6a.fsf-mXXj517/[email protected]>
In-Reply-To: <8335yn1v6a.fsf-mXXj517/[email protected]>

--lGr8FfKLVXBcJQ8KrudYR1kfk8n0aEriU
Content-Type: text/plain; charset=utf-8
Content-Language: en-US
Content-Transfer-Encoding: quoted-printable

On 26/01/2021 17:10, Eli Zaretskii wrote:
> Could someone (Keith?) please remind me how to avoid the following
> compiler warning:
>=20
>   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.

--=20
Regards,
Keith.

Public key available from keys.gnupg.net
Key fingerprint: C19E C018 1547 DE50 E1D4 8F53 C0AD 36C6 347E 5A3F


--lGr8FfKLVXBcJQ8KrudYR1kfk8n0aEriU--

--MI2hRagcUnBlPHhrOZe1eE8N3IuOJjlTc
Content-Type: application/pgp-signature; name="OpenPGP_signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="OpenPGP_signature"

-----BEGIN PGP SIGNATURE-----

wsF5BAABCAAjFiEEwZ7AGBVH3lDh1I9TwK02xjR+Wj8FAmAQcmwFAwAAAAAACgkQwK02xjR+Wj94
kw/+IX6XXbjd+F4trXuraPYZPhfTqnR+p/IGVl5JixyMA/WTkL3LwEsAWRa+bRpb8QaPJvPo6eTv
DTporRmxy69NsozP+2nlvLWHRgk8PKb4XyxB/rIOegp8K3ajegIBkSApTBFc4DHU5t9TG4KR8zul
7BROw9I1oDynXmWqNNKcDHWHoWcwlD02Q2RqNSD6MKjRcP2v53VomvoO+Qi5FlQtL2fjXmcAQ/Sw
Cp6WMNEbYPvjqf44PblyFb86Pt4jqUwo91PXAbtn+l0qD1HqQUcgtzwBf1cw7WRLj5xQlQdhIrYI
Z7wvzKlV5/hei+IItx5x2L/r0HIK9xpJHURjCX0htv2xHsivFWVqG9yZm+VNctEwCcqXU4xeS7fL
c7h7jTxsnIvzlSESSsMcjnJ5Y6IV3TpQ8Lqymdo2uE7p3N+8+Hf8vAHq5nziwKftLTLqlTcrHNmB
yye+prU1ug2qODIQYehAQddRv5y55ISwGxSoEULW0wJ7+6pagV1nuRaxyZF2O62cOxbSbDdTBIQ0
19lRFOs2TG3PzIPOiZeS8NlDqWsJ29IppH5PyrhEjytuV2IXOUqJTf0/rozZ6BJUEwaDL04f+qS1
lhNbfCX2mHBEoxwk6ZBYJiOOkH5zRhDWJ12vsPgKJ/irOIB9xFyeDZQChyRuAZQrArb/x4Plg72M
3Hs=
=7Hiu
-----END PGP SIGNATURE-----

--MI2hRagcUnBlPHhrOZe1eE8N3IuOJjlTc--


--===============5665097984433380596==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: base64
Content-Disposition: inline

X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KTWluR1ctVXNl
cnMgbWFpbGluZyBsaXN0Ck1pbkdXLVVzZXJzQGxpc3RzLm9zZG4ubWUKClRoaXMgbGlzdCBvYnNl
cnZlcyB0aGUgUG9zdGluZyBFdGlxdWV0dGUsIGFzIGRlc2NyaWJlZCBhdCBodHRwczovL21pbmd3
Lm9zZG4uaW8vaW5kZXguaHRtbD9wYWdlPW1haWxpbmcuaHRtbCNsaXN0LWV0aXF1ZXR0ZS4KV2Ug
YXNrIHRoYXQgeW91IGJlIHBvbGl0ZSBhbmQgZG8gdGhlIHNhbWUuICBEaXNyZWdhcmQgZm9yIHRo
ZSBsaXN0IGV0aXF1ZXR0ZSBtYXkgY2F1c2UgeW91ciBhY2NvdW50IHRvIGJlIG1vZGVyYXRlZC4K
Cl9fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fCllvdSBtYXkg
Y2hhbmdlIHlvdXIgTWluR1cgQWNjb3VudCBPcHRpb25zIG9yIHVuc3Vic2NyaWJlIGF0OgpodHRw
czovL2xpc3RzLm9zZG4ubWUvbWFpbG1hbi9saXN0aW5mby9taW5ndy11c2VycwpBbHNvOiBtYWls
dG86bWluZ3ctdXNlcnMtcmVxdWVzdEBsaXN0cy5vc2RuLm1lP3N1YmplY3Q9dW5zdWJzY3JpYmU=

--===============5665097984433380596==--