1 // RUN: %check_clang_tidy -std=cl2.0 %s readability-uppercase-literal-suffix %t -- -- -target x86_64-pc-linux-gnu -I %S -x cl
2 // RUN: grep -Ev "// *[A-Z-]+:" %s > %t.cpp
3 // RUN: clang-tidy %t.cpp -checks='-*,readability-uppercase-literal-suffix' -fix -- -target x86_64-pc-linux-gnu -I %S -std=cl2.0 -x cl
4 // RUN: clang-tidy %t.cpp -checks='-*,readability-uppercase-literal-suffix' -warnings-as-errors='-*,readability-uppercase-literal-suffix' -- -target x86_64-pc-linux-gnu -I %S -std=cl2.0 -x cl
5 
6 #pragma OPENCL EXTENSION cl_khr_fp16 : enable
7 
floating_point_half_suffix()8 void floating_point_half_suffix() {
9   static half v0 = 0x0p0; // no literal
10 
11   // half
12 
13   static half v2 = 1.h;
14   // CHECK-MESSAGES: :[[@LINE-1]]:20: warning: floating point literal has suffix 'h', which is not uppercase
15   // CHECK-MESSAGES-NEXT: static half v2 = 1.h;
16   // CHECK-MESSAGES-NEXT: ^ ~
17   // CHECK-MESSAGES-NEXT: {{^ *}}H{{$}}
18   // CHECK-HIXES: static half v2 = 1.H;
19 
20   static half v3 = 1.e0h;
21   // CHECK-MESSAGES: :[[@LINE-1]]:20: warning: floating point literal has suffix 'h', which is not uppercase
22   // CHECK-MESSAGES-NEXT: static half v3 = 1.e0h;
23   // CHECK-MESSAGES-NEXT: ^ ~
24   // CHECK-MESSAGES-NEXT: {{^ *}}H{{$}}
25   // CHECK-HIXES: static half v3 = 1.e0H;
26 
27   static half v4 = 1.H; // OK.
28 
29   static half v5 = 1.e0H; // OK.
30 }
31