| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
C11 standard refers to the unsigned counterpart of the type ptrdiff_t
in the paragraph 7.21.6.1p7 where it defines the format specifier %tu.
In Clang (in PrintfFormatString.cpp, lines 508-510) there is a FIXME for this case,
in particular, Clang didn't diagnose %tu issues at all, i.e.
it didn't emit any warnings on the code printf("%tu", 3.14).
In this diff we add a method getUnsignedPointerDiffType for getting the corresponding type
similarly to how it's already done in the other analogous cases (size_t, ssize_t, ptrdiff_t etc)
and fix -Wformat diagnostics for %tu plus the emitted fix-it as well.
Test plan: make check-all
Differential revision: https://reviews.llvm.org/D38270
llvm-svn: 314470
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This diff addresses FIXMEs in lib/Analysis/ScanfFormatString.cpp
for the case of ssize_t format specifier and adds tests.
In particular, this change enables Clang to emit a warning
on incorrect using of "%zd"/"%zn".
Test plan: make check-all
Differential revision: https://reviews.llvm.org/D35652
llvm-svn: 308662
|
|
|
|
|
|
|
|
|
|
| |
Followup from r264752.
Attempt to appease buildbots:
http://lab.llvm.org:8011/builders/clang-ppc64be-linux/builds/2882
http://lab.llvm.org:8011/builders/clang-s390x-linux/builds/2619
llvm-svn: 264765
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Improve invalid format string specifier handling by printing out
invalid specifiers characters with \x, \u and \U. Previously clang
would print gargabe whenever the character is unprintable.
Example, before:
NSLog(@"%\u25B9"); => warning: invalid conversion specifier ' [-Wformat-invalid-specifier]
after:
NSLog(@"%\u25B9"); => warning: invalid conversion specifier '\u25b9' [-Wformat-invalid-specifier]
Differential Revision: http://reviews.llvm.org/D18296
rdar://problem/24672159
llvm-svn: 264752
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
The printf/scanf format checker is a little over-zealous in handling the conditional operator. This patch reduces work by not checking code-paths that are never used and reduces false positives regarding uncovered arguments, for example in the code fragment:
printf(minimal ? "%i\n" : "%i: %s\n", code, msg);
Reviewers: rtrieu
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D15636
llvm-svn: 262025
|
|
|
|
| |
llvm-svn: 207573
|
|
|
|
|
|
|
|
|
|
| |
This patch was submitted to the list for review and didn't receive a LGTM.
(In fact one explicit objection and one query were raised.)
This reverts commit r197295.
llvm-svn: 197299
|
|
|
|
|
|
| |
Differential Revision: http://llvm-reviews.chandlerc.com/D2392
llvm-svn: 197295
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously, a line like
// expected-error-re {{foo}}
treats the entirety of foo as a regex. This is inconvenient when matching type
names containing regex characters. For example, to match
"void *(class test8::A::*)(void)" inside such a regex, one would have to type
"void \*\(class test8::A::\*\)\(void\)".
This patch changes the semantics of expected-error-re to only treat the parts
of the directive wrapped in double curly braces as regexes. This avoids the
escaping problem and leads to nicer patterns for those cases; see e.g. the
change to test/Sema/format-strings-scanf.c.
(The balanced search for closing }} of a directive also makes us handle the
full directive in test\SemaCXX\constexpr-printing.cpp:41 and :53.)
Differential Revision: http://llvm-reviews.chandlerc.com/D2388
llvm-svn: 197092
|
|
|
|
|
|
|
|
|
| |
expected-warning-re to let matched for Win32 targets.
- format specifies type 'wchar_t **' (aka 'int **') but the argument has type 'float *'
- format specifies type 'wchar_t **' (aka 'unsigned short **') but the argument has type 'float *'
llvm-svn: 163468
|
|
|
|
|
|
|
|
|
| |
This seems to be a GNU libc extension; we offer a fixit to %lld on
these platforms.
<rdar://problem/11518237>
llvm-svn: 163452
|
|
|
|
| |
llvm-svn: 161408
|
|
|
|
|
|
|
|
| |
This is useful for example for %n in printf, which expects
a pointer to int with the same logic for checking as %d
would have in scanf.
llvm-svn: 161407
|
|
|
|
|
|
|
| |
Warn about using pointers to const-qualified types as arguments to
scanf. Ignore the volatile qualifier when checking if types match.
llvm-svn: 161052
|
|
|
|
|
|
|
| |
This makes Clang check that the corresponding argument for "%n" in a
format string is a pointer to int.
llvm-svn: 160966
|
|
|
|
|
|
|
|
|
| |
This is in preparation for being able to warn about 'q' and other
non-standard format string features.
It also allows us to print its name correctly.
llvm-svn: 150697
|
|
|
|
| |
llvm-svn: 149394
|
|
|
|
|
|
| |
Fixes PR 9466.
llvm-svn: 148859
|
|
|
|
| |
llvm-svn: 148586
|
|
|
|
|
|
| |
to GCC's).
llvm-svn: 148579
|
|
|
|
|
|
| |
Fixes PR9195.
llvm-svn: 148300
|
|
|
|
|
|
| |
are used with that and the 'a' length modifier.
llvm-svn: 148029
|
|
|
|
|
|
|
| |
Before r148025 we (accidentally) didn't check whether a length modifier is
appropriate for a scanlist, but now we do.
llvm-svn: 148026
|
|
|
|
| |
llvm-svn: 148025
|
|
|
|
| |
llvm-svn: 146651
|
|
|
|
|
|
|
|
|
| |
extension.
This fixes gcc.dg/format/c90-scanf-3.c and ext-4.c (test for excess
errors).
llvm-svn: 146649
|
|
|
|
| |
llvm-svn: 146392
|
|
|
|
| |
llvm-svn: 146390
|
|
|
|
| |
llvm-svn: 146367
|
|
|
|
|
|
| |
and offer fixits when there is a mismatch.
llvm-svn: 146326
|
|
|
|
|
|
|
|
|
|
|
| |
string is part of the function call, then there is no difference. If the
format string is not, the warning will point to the call site and a note
will point to where the format string is.
Fix-it hints for strings are moved to the note if a note is emitted. This will
prevent changes to format strings that may be used in multiple places.
llvm-svn: 143168
|
|
|
|
| |
llvm-svn: 108907
|
|
|
|
|
|
|
|
| |
positional arguments, since
these don't actually consume an argument.
llvm-svn: 108757
|
|
|
|
| |
llvm-svn: 108750
|
|
|
|
|
|
| |
<rdar://problem/8204052>.
llvm-svn: 108742
|
|
|
|
|
|
| |
of mine.
llvm-svn: 108552
|
|
|
|
| |
llvm-svn: 108542
|
|
|
|
| |
llvm-svn: 108541
|
|
llvm-svn: 108503
|