]> granicus.if.org Git - clang/commitdiff
Add tests to check recent changes to some builtins.
authorBill Wendling <isanbard@gmail.com>
Tue, 18 Dec 2012 21:09:25 +0000 (21:09 +0000)
committerBill Wendling <isanbard@gmail.com>
Tue, 18 Dec 2012 21:09:25 +0000 (21:09 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170458 91177308-0d34-0410-b5e6-96231b3b80d8

test/Sema/builtins.c

index e3b3b7e83178b55b8802d2dc8dd868a3270c3f72..d525ac012e11ff1cbc8907726067d1cd1ae7af8a 100644 (file)
@@ -176,3 +176,18 @@ void test17() {
 #undef T
 #undef F
 }
+
+void test18() {
+  char src[1024];
+  char dst[2048];
+  size_t result;
+  void *ptr;
+
+  ptr = __builtin___memccpy_chk(dst, src, '\037', sizeof(src), sizeof(dst));
+  result = __builtin___strlcpy_chk(dst, src, sizeof(src), sizeof(dst));
+  result = __builtin___strlcat_chk(dst, src, sizeof(src), sizeof(dst));
+
+  ptr = __builtin___memccpy_chk(dst, src, '\037', sizeof(src));      // expected-error {{too few arguments to function call}}
+  ptr = __builtin___strlcpy_chk(dst, src, sizeof(src), sizeof(dst)); // expected-warning {{incompatible integer to pointer conversion}}
+  ptr = __builtin___strlcat_chk(dst, src, sizeof(src), sizeof(dst)); // expected-warning {{incompatible integer to pointer conversion}}
+}