summaryrefslogtreecommitdiffstats
path: root/test/SemaOpenCL/printf-format-string-warnings.cl
blob: d08c95b6d8abdb12cf54d32545653e6acb960104 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
// 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}}
}