[PATCH] D42933: [Sema] Avoid -Wformat warning for NSInteger/NSUInteger 'int' values with %zu/%zi long specifiers
JF Bastien via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue May 8 12:38:18 PDT 2018
jfb added a comment.
In https://reviews.llvm.org/D42933#1091809, @jyknight wrote:
> I also think that special casing these two specifiers doesn't make sense. The problem is a general issue -- and one I've often found irritating. This exact same situation comes up all the time in non-Darwin contexts too.
I don't think that's true. In this very specific case the platform guarantees that `(sizeof(size_t) == sizeof(NSInteger)) && (sizeof(ssize_t) == sizeof(NSUInteger))` for all architectures this platform supports. This exact same situation does not come up all the time in other contexts because the `int` / `long` / `long long` distinction isn't backed by a portability guarantee. The warning is there to say "this code isn't portable!", but in the very specific case of `NSInteger` and `NSUInteger` it is and users rely on it so it cannot be broken. The warning is therefore spurious, users therefore rightly complain.
Repository:
rC Clang
https://reviews.llvm.org/D42933
More information about the cfe-commits
mailing list