[cfe-dev] minor printf format checker fix for mips64-*-freebsd

Rafael EspĂ­ndola rafael.espindola at gmail.com
Tue Nov 5 17:32:27 PST 2013


Yes, please include the test is the patch.

On 5 November 2013 17:20, Brooks Davis <brooks at freebsd.org> wrote:
> 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
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>



More information about the cfe-dev mailing list