aboutsummaryrefslogtreecommitdiff
path: root/test/Sema/builtins.c
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-05-08 06:58:22 +0000
committerChris Lattner <sabre@nondot.org>2009-05-08 06:58:22 +0000
commit5caa370ea6f70bd3e7e4a9cc3b69ac1a849c8534 (patch)
tree325c140baaa5ecb1abc5f7d3a8353040d468253e /test/Sema/builtins.c
parentfb1e3310da7e3886c8057a5f009d2cdf30d8804f (diff)
reimplement __sync_* builtins to be variadic and to follow the same
semantic rules that gcc and icc use. This implements the variadic and concrete versions as builtins and has sema do the disambiguation. There are probably a bunch of details to finish up but this seems like a large monotonic step forward :) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71212 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Sema/builtins.c')
-rw-r--r--test/Sema/builtins.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/test/Sema/builtins.c b/test/Sema/builtins.c
index ce7c3484fd..c6ef5ea0d1 100644
--- a/test/Sema/builtins.c
+++ b/test/Sema/builtins.c
@@ -24,7 +24,7 @@ int test6(float a, long double b) {
#define CFSTR __builtin___CFStringMakeConstantString
-void cfstring() {
+void test7() {
CFSTR("\242");
CFSTR("\0"); // expected-warning {{ CFString literal contains NUL character }}
CFSTR(242); // expected-error {{ CFString literal is not a string constant }} expected-warning {{incompatible integer to pointer conversion}}
@@ -35,8 +35,18 @@ void cfstring() {
typedef __attribute__(( ext_vector_type(16) )) unsigned char uchar16;
// rdar://5905347
-unsigned char foo( short v ) {
+unsigned char test8( short v ) {
uchar16 c;
return __builtin_ia32_vec_ext_v4si( c ); // expected-error {{too few arguments to function}}
}
+
+// atomics.
+
+unsigned char test9(short v) {
+ unsigned i, old;
+
+ old = __sync_fetch_and_add(); // expected-error {{too few arguments to function call}}
+ old = __sync_fetch_and_add(&old); // expected-error {{too few arguments to function call}}
+ old = __sync_fetch_and_add((int**)0, 42i); // expected-error {{operand of type '_Complex int' cannot be cast to a pointer type}} expected-warning {{imaginary constants are an extension}}
+}