]> granicus.if.org Git - clang/commitdiff
Migrate over 2009-04-22-UnknownSize.c, 2009-07-17-VoidParameter.c,
authorEric Christopher <echristo@apple.com>
Tue, 26 Jul 2011 00:47:54 +0000 (00:47 +0000)
committerEric Christopher <echristo@apple.com>
Tue, 26 Jul 2011 00:47:54 +0000 (00:47 +0000)
2009-03-09-WeakDeclarations-1.c, and 2010-05-31-palignr.c from
llvm/test/FrontendC.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136033 91177308-0d34-0410-b5e6-96231b3b80d8

test/Sema/2009-03-09-WeakDeclarations-1.c [new file with mode: 0644]
test/Sema/2009-04-22-UnknownSize.c [new file with mode: 0644]
test/Sema/2009-07-17-VoidParameter.c [new file with mode: 0644]
test/Sema/2010-05-31-palignr.c [new file with mode: 0644]

diff --git a/test/Sema/2009-03-09-WeakDeclarations-1.c b/test/Sema/2009-03-09-WeakDeclarations-1.c
new file mode 100644 (file)
index 0000000..f219de6
--- /dev/null
@@ -0,0 +1,16 @@
+// RUN: %clang_cc1 %s -triple i686-apple-darwin
+// Insist upon warnings for inappropriate weak attributes.
+
+// O.K.
+extern int ext_weak_import __attribute__ ((__weak_import__));
+
+// These are inappropriate, and should generate warnings:
+int decl_weak_import __attribute__ ((__weak_import__)); // expected-warning {'weak_import' attribute cannot be specified on a definition}
+int decl_initialized_weak_import __attribute__ ((__weak_import__)) = 13; // expected-warning {'weak_import' attribute cannot be specified on a definition}
+
+// O.K.
+extern int ext_f(void) __attribute__ ((__weak_import__));
+
+// These are inappropriate, and should generate warnings:
+int def_f(void) __attribute__ ((__weak_import__));
+int __attribute__ ((__weak_import__)) decl_f(void) {return 0;};
diff --git a/test/Sema/2009-04-22-UnknownSize.c b/test/Sema/2009-04-22-UnknownSize.c
new file mode 100644 (file)
index 0000000..9f71740
--- /dev/null
@@ -0,0 +1,4 @@
+// RUN: not %clang_cc1 %s -emit-llvm -o -
+// PR2958
+static struct foo s; // expected-error { tentative definition has type 'struct foo' that is never completed }
+struct foo *p = &s;
diff --git a/test/Sema/2009-07-17-VoidParameter.c b/test/Sema/2009-07-17-VoidParameter.c
new file mode 100644 (file)
index 0000000..68d1b1e
--- /dev/null
@@ -0,0 +1,4 @@
+// RUN: not %clang_cc1 -emit-llvm %s -o -
+// PR4214
+typedef void vt;
+void (*func_ptr)(vt my_vt); // expected-error {argument may not have 'void' type}
diff --git a/test/Sema/2010-05-31-palignr.c b/test/Sema/2010-05-31-palignr.c
new file mode 100644 (file)
index 0000000..12be29a
--- /dev/null
@@ -0,0 +1,22 @@
+// RUN: not %clang_cc1 -triple x86_64-apple-darwin -emit-llvm -o /dev/null %s
+
+#include <tmmintrin.h>
+
+extern int i;
+
+int main ()
+{
+#if defined( __SSSE3__ )
+
+  typedef int16_t     vSInt16         __attribute__ ((__vector_size__ (16)));
+
+  short   dtbl[] = {1,2,3,4,5,6,7,8};
+  vSInt16 *vdtbl = (vSInt16*) dtbl;
+
+  vSInt16 v0;
+  v0 = *vdtbl;
+  v0 = _mm_alignr_epi8(v0, v0, i); // expected-error {{argument to '__builtin_ia32_palignr128' must be a constant integer}}
+
+  return 0;
+#endif
+}