[PATCH] D132568: [clang][Sema] check default argument promotions for printf
YingChi Long via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 25 08:16:32 PDT 2022
inclyc added inline comments.
================
Comment at: clang/test/FixIt/format.m:40
-void test_object_correction (id x) {
+void test_object_correction (id x) {
NSLog(@"%d", x); // expected-warning{{format specifies type 'int' but the argument has type 'id'}}
----------------
aaron.ballman wrote:
> It looks like some whitespace only changes snuck in.
> It looks like some whitespace only changes snuck in.
I'm sorry for this, do I need to discard these whitespace-only changes? Since this patch changes this file, is it my responsibility to keep other parts that don't belong to this patch unchanged, or am I correcting them by the way?
================
Comment at: clang/test/Sema/format-strings-scanf.c:289-290
+ // ill-formed floats
+ scanf("%hf", // expected-warning{{length modifier 'h' results in undefined behavior or no effect with 'f' conversion specifier}}
+ &sc); // Is this a clang bug ?
+
----------------
aaron.ballman wrote:
> Is what a clang bug?
>
> Also, what is with the "or no effect" in that wording? "This could cause major issues or nothing bad at all might happen" is a very odd way to word a diagnostic. :-D (Maybe something to look into improving in a later patch.)
> Is what a clang bug?
Look at `sc` which is a `signed char`, but scanf need a pointer `float *`, I add this comment because I think there should be a warning like
```
format specifies type 'float *' but the argument has type 'signed short *'
```
See printf tests below
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D132568/new/
https://reviews.llvm.org/D132568
More information about the cfe-commits
mailing list