summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema/builtins.c
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-12-20 00:26:33 +0000
committerChris Lattner <sabre@nondot.org>2007-12-20 00:26:33 +0000
commit2da14fb84f007009384d7d7eae5dda2f6516f5f1 (patch)
treed070c00a93f942b6ced052e3d924aa0409520718 /clang/test/Sema/builtins.c
parent6d279d484a5e883af1afe557421d63d1928d7d10 (diff)
downloadbcm5719-llvm-2da14fb84f007009384d7d7eae5dda2f6516f5f1.tar.gz
bcm5719-llvm-2da14fb84f007009384d7d7eae5dda2f6516f5f1.zip
implement semantic analysis for __builtin_islessequal and friends.
llvm-svn: 45239
Diffstat (limited to 'clang/test/Sema/builtins.c')
-rw-r--r--clang/test/Sema/builtins.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/clang/test/Sema/builtins.c b/clang/test/Sema/builtins.c
new file mode 100644
index 00000000000..997a8ede0ea
--- /dev/null
+++ b/clang/test/Sema/builtins.c
@@ -0,0 +1,33 @@
+// RUN: clang %s -fsyntax-only -verify
+
+int test1(float a, int b) {
+ return __builtin_isless(a, b);
+}
+int test2(int a, int b) {
+ return __builtin_islessequal(a, b); // expected-error {{floating point type}}
+}
+
+int test3(double a, float b) {
+ return __builtin_isless(a, b);
+}
+int test4(int* a, double b) {
+ return __builtin_islessequal(a, b); // expected-error {{floating point type}}
+}
+
+int test5(float a, long double b) {
+ return __builtin_isless(a, b, b); // expected-error {{too many arguments}}
+}
+int test6(float a, long double b) {
+ return __builtin_islessequal(a); // expected-error {{too few arguments}}
+}
+
+
+#define CFSTR __builtin___CFStringMakeConstantString
+void cfstring() {
+ CFSTR("\242"); // expected-warning {{ CFString literal contains non-ASCII character }}
+ CFSTR("\0"); // expected-warning {{ CFString literal contains NUL character }}
+ CFSTR(242); // expected-error {{ CFString literal is not a string constant }} \
+ expected-warning {{incompatible types}}
+ CFSTR("foo", "bar"); // expected-error {{ error: too many arguments to function }}
+}
+
OpenPOWER on IntegriCloud