1*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -fsyntax-only -fblocks -verify %s 2*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -fdiagnostics-parseable-fixits -fblocks %s 2>&1 | FileCheck %s 3*f4a2713aSLionel Sambuc 4*f4a2713aSLionel Sambucextern "C" void NSLog(id, ...); 5*f4a2713aSLionel Sambuc 6*f4a2713aSLionel Sambucvoid test_percent_C() { 7*f4a2713aSLionel Sambuc const unsigned short data = 'a'; 8*f4a2713aSLionel Sambuc NSLog(@"%C", data); // no-warning 9*f4a2713aSLionel Sambuc 10*f4a2713aSLionel Sambuc const wchar_t wchar_data = L'a'; 11*f4a2713aSLionel Sambuc NSLog(@"%C", wchar_data); // expected-warning{{format specifies type 'unichar' (aka 'unsigned short') but the argument has type 'wchar_t'}} 12*f4a2713aSLionel Sambuc // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:16-[[@LINE-1]]:16}:"(unsigned short)" 13*f4a2713aSLionel Sambuc 14*f4a2713aSLionel Sambuc NSLog(@"%C", 0x260300); // expected-warning{{format specifies type 'unichar' (aka 'unsigned short') but the argument has type 'int'}} 15*f4a2713aSLionel Sambuc // CHECK-NOT: fix-it:"{{.*}}":{[[@LINE-1]]:11-[[@LINE-1]]:13}:"%d" 16*f4a2713aSLionel Sambuc // CHECK: fix-it:"{{.*}}":{[[@LINE-2]]:16-[[@LINE-2]]:16}:"(unsigned short)" 17*f4a2713aSLionel Sambuc 18*f4a2713aSLionel Sambuc typedef unsigned short unichar; 19*f4a2713aSLionel Sambuc 20*f4a2713aSLionel Sambuc NSLog(@"%C", wchar_data); // expected-warning{{format specifies type 'unichar' (aka 'unsigned short') but the argument has type 'wchar_t'}} 21*f4a2713aSLionel Sambuc // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:16-[[@LINE-1]]:16}:"(unichar)" 22*f4a2713aSLionel Sambuc 23*f4a2713aSLionel Sambuc NSLog(@"%C", 0x260300); // expected-warning{{format specifies type 'unichar' (aka 'unsigned short') but the argument has type 'int'}} 24*f4a2713aSLionel Sambuc // CHECK-NOT: fix-it:"{{.*}}":{[[@LINE-1]]:11-[[@LINE-1]]:13}:"%d" 25*f4a2713aSLionel Sambuc // CHECK: fix-it:"{{.*}}":{[[@LINE-2]]:16-[[@LINE-2]]:16}:"(unichar)" 26*f4a2713aSLionel Sambuc 27*f4a2713aSLionel Sambuc NSLog(@"%C", 0.0); // expected-warning{{format specifies type 'unichar' (aka 'unsigned short') but the argument has type 'double'}} 28*f4a2713aSLionel Sambuc // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:11-[[@LINE-1]]:13}:"%f" 29*f4a2713aSLionel Sambuc // CHECK-NOT: fix-it:"{{.*}}":{[[@LINE-2]]:16-[[@LINE-2]]:16}:"(unichar)" 30*f4a2713aSLionel Sambuc} 31