[cfe-dev] minor printf format checker fix for mips64-*-freebsd
Brooks Davis
brooks at freebsd.org
Tue Nov 5 17:20:30 PST 2013
On FreeBSD/mips64 intmax_t is long, not long long so format checks fail
with this nice confusing error:
error: format specifies type
'uintmax_t' (aka 'unsigned long long') but the argument has type
'uintmax_t' (aka 'unsigned long') [-Werror,-Wformat]
The following patch fixes it for me:
--- tools/clang/lib/Basic/Targets.cpp.orig
+++ tools/clang/lib/Basic/Targets.cpp
@@ -4981,6 +4981,8 @@
LongDoubleWidth = LongDoubleAlign = 128;
LongDoubleFormat = &llvm::APFloat::IEEEquad;
if (getTriple().getOS() == llvm::Triple::FreeBSD) {
+ IntMaxType = SignedLong;
+ UIntMaxType = UnsignedLong;
LongDoubleWidth = LongDoubleAlign = 64;
LongDoubleFormat = &llvm::APFloat::IEEEdouble;
}
If a test is required, adding another RUN: line with "-triple
mips64-unknown-freebsd" to test/Sema/format-strings-size_t.c should do
the trick.
Thanks,
Brooks
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 188 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20131105/442fbf63/attachment.sig>
More information about the cfe-dev
mailing list