From 58fc8082a89f51a7cec210fa57c301bcb754aef0 Mon Sep 17 00:00:00 2001 From: Matt Arsenault Date: Tue, 29 Jan 2019 20:49:54 +0000 Subject: 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 --- clang/test/Sema/format-strings.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'clang/test/Sema/format-strings.c') diff --git a/clang/test/Sema/format-strings.c b/clang/test/Sema/format-strings.c index a9af8ce5dee..e8acd40c8d2 100644 --- a/clang/test/Sema/format-strings.c +++ b/clang/test/Sema/format-strings.c @@ -617,6 +617,8 @@ void test_opencl_vector_format(int x) { printf("%v4d", x); // expected-warning{{invalid conversion specifier 'v'}} printf("%vd", x); // expected-warning{{invalid conversion specifier 'v'}} printf("%0vd", x); // expected-warning{{invalid conversion specifier 'v'}} + printf("%hlf", x); // expected-warning{{invalid conversion specifier 'l'}} + printf("%hld", x); // expected-warning{{invalid conversion specifier 'l'}} } // Test that we correctly merge the format in both orders. -- cgit v1.2.3