summaryrefslogtreecommitdiff
path: root/test/Sema/builtin-object-size.c
diff options
context:
space:
mode:
authorEd Schouten <ed@FreeBSD.org>2009-06-02 17:58:47 +0000
committerEd Schouten <ed@FreeBSD.org>2009-06-02 17:58:47 +0000
commitec2b103c267a06a66e926f62cd96767b280f5cf5 (patch)
treece7d964cbb5e39695b71481698f10cb099c23d4a /test/Sema/builtin-object-size.c
downloadsrc-test2-ec2b103c267a06a66e926f62cd96767b280f5cf5.tar.gz
src-test2-ec2b103c267a06a66e926f62cd96767b280f5cf5.zip
Notes
Diffstat (limited to 'test/Sema/builtin-object-size.c')
-rw-r--r--test/Sema/builtin-object-size.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/test/Sema/builtin-object-size.c b/test/Sema/builtin-object-size.c
new file mode 100644
index 000000000000..4b15cb1f0e23
--- /dev/null
+++ b/test/Sema/builtin-object-size.c
@@ -0,0 +1,28 @@
+// RUN: clang-cc -fsyntax-only -verify %s &&
+// RUN: clang-cc -fsyntax-only -triple x86_64-apple-darwin9 -verify %s
+
+int a[10];
+
+int f0() {
+ return __builtin_object_size(&a); // expected-error {{too few arguments to function}}
+}
+int f1() {
+ return (__builtin_object_size(&a, 0) +
+ __builtin_object_size(&a, 1) +
+ __builtin_object_size(&a, 2) +
+ __builtin_object_size(&a, 3));
+}
+int f2() {
+ return __builtin_object_size(&a, -1); // expected-error {{argument should be a value from 0 to 3}}
+}
+int f3() {
+ return __builtin_object_size(&a, 4); // expected-error {{argument should be a value from 0 to 3}}
+}
+
+
+// rdar://6252231 - cannot call vsnprintf with va_list on x86_64
+void f4(const char *fmt, ...) {
+ __builtin_va_list args;
+ __builtin___vsnprintf_chk (0, 42, 0, 11, fmt, args);
+}
+