inclyc added inline comments.
================
Comment at: clang/test/Sema/format-strings-scanf.c:235
scanf(0 ? "%s" : "%d", i); // no warning
- scanf(1 ? "%s" : "%d", i); // expected-warning{{format specifies type 'char
*'}}
+ scanf(1 ? "%s" : "%d", i); // expected-warning{{format specifies type 'char
*'}} \
+ // expected-note{{format string is defined here}}
----------------
These new notes are FixIt hints, looks much better than before.
================
Comment at: clang/test/Sema/format-strings.c:263
// expected-note@-1{{treat the string as an argument to avoid this}}
- printf(s4); // expected-warning{{not a string literal}}
- // expected-note@-1{{treat the string as an argument to avoid this}}
+ printf(s4);
printf(s5); // expected-warning{{not a string literal}}
----------------
Here, s4 is declared as `char * const` and initialized as `const char`, so
warning generates at the declaration of `s4` is sufficient? Since modify
characters in string literal causes UB.
```
Initializing 'char *const' with an expression of type 'const char[6]' discards
qualifiers
```
Currently the checker in this patch just qualifies `"hello"` as a string
literal, and does not report `-Wformat-nonliteral` as before
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D130906/new/
https://reviews.llvm.org/D130906
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits