diff options
author | Matt Arsenault <Matthew.Arsenault@amd.com> | 2019-01-29 20:49:54 +0000 |
---|---|---|
committer | Matt Arsenault <Matthew.Arsenault@amd.com> | 2019-01-29 20:49:54 +0000 |
commit | 58fc8082a89f51a7cec210fa57c301bcb754aef0 (patch) | |
tree | 97dfdac10ccd9f336e77f49ad32a2f93b2588e22 /clang/test/SemaOpenCL/format-strings-fixit.cl | |
parent | 297afb14ec82180021aa1b2f02abd3c8c5e4c475 (diff) | |
download | bcm5719-llvm-58fc8082a89f51a7cec210fa57c301bcb754aef0.tar.gz bcm5719-llvm-58fc8082a89f51a7cec210fa57c301bcb754aef0.zip |
OpenCL: Use length modifier for warning on vector printf arguments
Re-enable format string warnings on printf.
The warnings are still incomplete. Apparently it is undefined to use a
vector specifier without a length modifier, which is not currently
warned on. Additionally, type warnings appear to not be working with
the hh modifier, and aren't warning on all of the special restrictions
from c99 printf.
llvm-svn: 352540
Diffstat (limited to 'clang/test/SemaOpenCL/format-strings-fixit.cl')
-rw-r--r-- | clang/test/SemaOpenCL/format-strings-fixit.cl | 58 |
1 files changed, 54 insertions, 4 deletions
diff --git a/clang/test/SemaOpenCL/format-strings-fixit.cl b/clang/test/SemaOpenCL/format-strings-fixit.cl index b9f949ffe2f..e1181e1e3e6 100644 --- a/clang/test/SemaOpenCL/format-strings-fixit.cl +++ b/clang/test/SemaOpenCL/format-strings-fixit.cl @@ -3,22 +3,72 @@ // RUN: %clang_cc1 -cl-std=CL1.2 -fsyntax-only -pedantic -Wall -Werror %t // RUN: %clang_cc1 -cl-std=CL1.2 -E -o - %t | FileCheck %s +typedef __attribute__((ext_vector_type(4))) char char4; +typedef __attribute__((ext_vector_type(4))) short short4; typedef __attribute__((ext_vector_type(4))) int int4; +typedef __attribute__((ext_vector_type(4))) unsigned int uint4; typedef __attribute__((ext_vector_type(8))) int int8; +typedef __attribute__((ext_vector_type(4))) long long4; +typedef __attribute__((ext_vector_type(4))) float float4; +typedef __attribute__((ext_vector_type(4))) double double4; int printf(__constant const char* st, ...) __attribute__((format(printf, 1, 2))); void vector_fixits() { printf("%v4f", (int4) 123); - // CHECK: printf("%v4d", (int4) 123); + // CHECK: printf("%v4hld", (int4) 123); printf("%v8d", (int4) 123); - // CHECK: printf("%v4d", (int4) 123); + // CHECK: printf("%v4hld", (int4) 123); printf("%v4d", (int8) 123); - // CHECK: printf("%v8d", (int8) 123); + // CHECK: printf("%v8hld", (int8) 123); printf("%v4f", (int8) 123); - // CHECK: printf("%v8d", (int8) 123); + // CHECK: printf("%v8hld", (int8) 123); + + printf("%v4ld", (int8) 123); + // CHECK: printf("%v8hld", (int8) 123); + + printf("%v4hlf", (int4) 123); + // CHECK: printf("%v4hld", (int4) 123); + + printf("%v8hld", (int4) 123); + // CHECK: printf("%v4hld", (int4) 123); + + printf("%v4hld", (int8) 123); + // CHECK: printf("%v8hld", (int8) 123); + + printf("%v4hlf", (int8) 123); + // CHECK: printf("%v8hld", (int8) 123); + + printf("%v4hd", (int4) 123); + // CHECK: printf("%v4hld", (int4) 123); + + printf("%v4hld", (short4) 123); + // CHECK: printf("%v4hd", (short4) 123); + + printf("%v4ld", (short4) 123); + // CHECK: printf("%v4hd", (short4) 123); + + printf("%v4hld", (long4) 123); + // CHECK: printf("%v4ld", (long4) 123); + + printf("%v8f", (float4) 2.0f); + // CHECK: printf("%v4hlf", (float4) 2.0f); + + printf("%v4f", (float4) 2.0f); + // CHECK: printf("%v4hlf", (float4) 2.0f); + + printf("%v4lf", (double4) 2.0); + // CHECK: printf("%v4lf", (double4) 2.0); + + /// FIXME: This should be fixed + printf("%v4hhd", (int4) 123); + // CHECK: printf("%v4hhd", (int4) 123); + + /// FIXME: This should be fixed + printf("%v4hhd", (int8) 123); + // CHECK: printf("%v4hhd", (int8) 123); } |