llvm-project/clang/test/SemaOpenCL/printf-format-string-warnings.cl
Sven van Haastregt 20d93267e1 [OpenCL] Use -fdeclare-opencl-builtins for some tests
This speeds up the test running times, as the large `opencl-c.h`
header no longer needs to be parsed.
2021-03-22 09:46:28 +00:00

13 lines
578 B
Common Lisp

// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL2.0 -finclude-default-header -fdeclare-opencl-builtins
// 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}}
}