erik.pilkington added a comment. In D66856#1648809 <https://reviews.llvm.org/D66856#1648809>, @aaron.ballman wrote:
> I'm wondering whether this should even warn pedantically. There are no format > specifiers that apply directly to a `_Bool` datatype, so the user is left > making a choice as to what specifier fits best. I think `hhd` and `hhu` are > both equally reasonable types, as are the `d` and `u` groups directly -- I > don't think we should warn on either of those specifiers with a `_Bool` > argument. I could maybe see a case for pedantically diagnosing `h`, `l`, and > `ll` prefixes with `_Bool` because that seems a bit type-confused to me. `c` > as a specifier seems weird (given that false values will potentially > terminate the string suddenly depending on terminal behavior, IIRC), but `lc` > seems like type confusion again. Hmm... on second though I think the `l` and `ll` prefixes are worth -Wformat proper, since that can result in printing a half-initialized integer when the argument ends up on the stack (we generate `movl $0,(%rsp)` for the first stack argument). I think `%c` is probably also worth a -Wformat, it seems like it would almost certainly be a mistake. I suppose we could pedantically warn on `%hd`, but I'm not sure. Who is the audience for -Wformat-pedantic? Users that expect it to diagnose any pedantically-UB printf calls will already be disappointed, since the C standard seems to be quite a lot more restrictive then us (7.21.6.9p9 says: "If any argument is not the correct type for the corresponding conversion specification, the behavior is undefined." (I'm assuming "correct type" means "same type")). So I think we should just concern ourselves with calls that would lead to actual problems at runtime, or are likely programmer errors, and `printf("%hd", (_Bool)0)` doesn't seem to meet either of those bars. Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D66856/new/ https://reviews.llvm.org/D66856 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits