aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAnna Zaks <ganna@apple.com>2012-08-08 21:42:23 +0000
committerAnna Zaks <ganna@apple.com>2012-08-08 21:42:23 +0000
commit0f38acee92014cb15af980808f87144e5564031d (patch)
tree23483763a4ec2068c7493294b81636603bb32d1d /test
parent77c7b0a7d04bf28b6fe15d21dc9a5b5d366347cc (diff)
Address code review comments for Wstrncat-size warning (r161440).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161527 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/Sema/warn-strncat-size.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/test/Sema/warn-strncat-size.c b/test/Sema/warn-strncat-size.c
index 7157edffea..dcc3367e94 100644
--- a/test/Sema/warn-strncat-size.c
+++ b/test/Sema/warn-strncat-size.c
@@ -59,7 +59,7 @@ void size_1() {
char z[1];
char str[] = "hi";
- strncat(z, str, sizeof(z)); // expected-warning{{the value of the size argument in 'strncat' is too large, might lead to a buffer overflow}}
+ strncat(z, str, sizeof(z)); // expected-warning{{the value of the size argument to 'strncat' is wrong}}
}
// Support VLAs.
@@ -69,3 +69,8 @@ void vlas(int size) {
strncat(z, str, sizeof(str)); // expected-warning {{size argument in 'strncat' call appears to be size of the source}} expected-note {{change the argument to be the free space in the destination buffer minus the terminating null byte}}
}
+
+// Non-array type gets a different error message.
+void f(char* s, char* d) {
+ strncat(d, s, sizeof(d)); // expected-warning {{the value of the size argument to 'strncat' is wrong}}
+}