printf-format-string-warnings.cl 552 B

123456789101112
  1. // RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL2.0 -finclude-default-header
  2. // Make sure warnings are produced based on printf format strings.
  3. kernel void format_string_warnings(__constant char* arg) {
  4. printf("%d", arg); // expected-warning {{format specifies type 'int' but the argument has type '__constant char *'}}
  5. printf("not enough arguments %d %d", 4); // expected-warning {{more '%' conversions than data arguments}}
  6. printf("too many arguments", 4); // expected-warning {{data argument not used by format string}}
  7. }