Skip to content

Commit dc4b105

Browse files
committed
add tests with multiple spaces
1 parent a7043b2 commit dc4b105

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

clang/test/Sema/warn-format-overflow-truncation.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,10 @@ void call_snprintf(double d, int n, int *ptr) {
4646
__builtin_snprintf(buf, 6, "%5.1f", 9.f);
4747
__builtin_snprintf(buf, 6, "%+5.1f", 9.f);
4848
__builtin_snprintf(buf, 6, "% 5.1f", 9.f);
49+
__builtin_snprintf(buf, 6, "% 5.1f", 9.f);
4950
__builtin_snprintf(buf, 6, "%+6.1f", 9.f); // kprintf-warning {{'snprintf' will always be truncated; specified size is 6, but format string expands to at least 7}}
5051
__builtin_snprintf(buf, 6, "% 6.1f", 9.f); // kprintf-warning {{'snprintf' will always be truncated; specified size is 6, but format string expands to at least 7}}
52+
__builtin_snprintf(buf, 6, "% 6.1f", 9.f); // kprintf-warning {{'snprintf' will always be truncated; specified size is 6, but format string expands to at least 7}}
5153
}
5254

5355
void call_vsnprintf(void) {
@@ -161,6 +163,8 @@ void call_sprintf(void) {
161163
sprintf(buf, "%5.1f", 9.f);
162164
sprintf(buf, "%+5.1f", 9.f);
163165
sprintf(buf, "% 5.1f", 9.f);
166+
sprintf(buf, "% 5.1f", 9.f);
164167
sprintf(buf, "%+6.1f", 9.f); // kprintf-warning {{'sprintf' will always overflow; destination buffer has size 6, but format string expands to at least 7}}
165168
sprintf(buf, "% 6.1f", 9.f); // kprintf-warning {{'sprintf' will always overflow; destination buffer has size 6, but format string expands to at least 7}}
169+
sprintf(buf, "% 6.1f", 9.f); // kprintf-warning {{'sprintf' will always overflow; destination buffer has size 6, but format string expands to at least 7}}
166170
}

0 commit comments

Comments
 (0)