summaryrefslogtreecommitdiff
path: root/test/SemaOpenCL/printf-format-string-warnings.cl
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2019-01-19 10:04:05 +0000
committerDimitry Andric <dim@FreeBSD.org>2019-01-19 10:04:05 +0000
commit676fbe8105eeb6ff4bb2ed261cb212fcfdbe7b63 (patch)
tree02a1ac369cb734d0abfa5000dd86e5b7797e6a74 /test/SemaOpenCL/printf-format-string-warnings.cl
parentc7e70c433efc6953dc3888b9fbf9f3512d7da2b0 (diff)
Diffstat (limited to 'test/SemaOpenCL/printf-format-string-warnings.cl')
-rw-r--r--test/SemaOpenCL/printf-format-string-warnings.cl13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/SemaOpenCL/printf-format-string-warnings.cl b/test/SemaOpenCL/printf-format-string-warnings.cl
new file mode 100644
index 0000000000000..2b9c5cc3f319f
--- /dev/null
+++ b/test/SemaOpenCL/printf-format-string-warnings.cl
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL2.0 -finclude-default-header
+
+// Make sure warnings are produced based on printf format strings.
+
+
+kernel void format_string_warnings(__constant char* arg) {
+
+ printf("%d", arg); // expected-warning {{format specifies type 'int' but the argument has type '__constant char *'}}
+
+ printf("not enough arguments %d %d", 4); // expected-warning {{more '%' conversions than data arguments}}
+
+ printf("too many arguments", 4); // expected-warning {{data argument not used by format string}}
+}