]> granicus.if.org Git - clang/commit
Format strings: suggest casts for NS(U)Integer and [SU]Int32 on Darwin.
authorJordan Rose <jordan_rose@apple.com>
Wed, 5 Sep 2012 22:56:26 +0000 (22:56 +0000)
committerJordan Rose <jordan_rose@apple.com>
Wed, 5 Sep 2012 22:56:26 +0000 (22:56 +0000)
commitec08735e1b6a51c11533311b774bf6336c0a5d63
tree2914bc2fcf4fa7b9630195f1da15aa6d934b63f6
parent614a8656279b6549750e83143635cec63ac0e8b7
Format strings: suggest casts for NS(U)Integer and [SU]Int32 on Darwin.

These types are defined differently on 32-bit and 64-bit platforms, and
trying to offer a fixit for one platform would only mess up the format
string for the other. The Apple-recommended solution is to cast to a type
that is known to be large enough and always use that to print the value.

This should only have an impact on compile time if the format string is
incorrect; in cases where the format string matches the definition on the
current platform, no warning will be emitted.

<rdar://problem/9135072&12164284>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163266 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/Basic/DiagnosticSemaKinds.td
lib/Sema/SemaChecking.cpp
test/FixIt/format-darwin.m [new file with mode: 0644]