1
1
// RUN: %check_clang_tidy %s cert-dcl16-c %t -- -- -I %clang_tidy_headers
2
- // RUN: grep -Ev "// *[A-Z-]+:" %s > %t.cpp
3
- // RUN: clang-tidy %t.cpp -checks='-*,cert-dcl16-c' -fix -- -I %clang_tidy_headers
4
- // RUN: clang-tidy %t.cpp -checks='-*,cert-dcl16-c' -warnings-as-errors='-*,cert-dcl16-c' -- -I %clang_tidy_headers
5
2
6
3
#include " integral_constant.h"
7
4
8
5
void integer_suffix () {
9
6
static constexpr auto v0 = __LINE__; // synthetic
10
- static_assert (v0 == 9 || v0 == 5 , " " );
11
-
12
7
static constexpr auto v1 = __cplusplus; // synthetic, long
13
8
14
9
static constexpr auto v2 = 1 ; // no literal
@@ -29,9 +24,6 @@ void integer_suffix() {
29
24
30
25
static constexpr auto v5 = 1l ;
31
26
// CHECK-MESSAGES: :[[@LINE-1]]:30: warning: integer literal has suffix 'l', which is not uppercase
32
- // CHECK-MESSAGES-NEXT: static constexpr auto v5 = 1l;
33
- // CHECK-MESSAGES-NEXT: ^~
34
- // CHECK-MESSAGES-NEXT: {{^ *| *}}L{{$}}
35
27
// CHECK-FIXES: static constexpr auto v5 = 1L;
36
28
static_assert (is_same<decltype (v5), const long >::value, " " );
37
29
static_assert (v5 == 1 , " " );
@@ -44,9 +36,6 @@ void integer_suffix() {
44
36
45
37
static constexpr auto v7 = 1ll ;
46
38
// CHECK-MESSAGES: :[[@LINE-1]]:30: warning: integer literal has suffix 'll', which is not uppercase
47
- // CHECK-MESSAGES-NEXT: static constexpr auto v7 = 1ll;
48
- // CHECK-MESSAGES-NEXT: ^~~
49
- // CHECK-MESSAGES-NEXT: {{^ *| *}}LL{{$}}
50
39
// CHECK-FIXES: static constexpr auto v7 = 1LL;
51
40
static_assert (is_same<decltype (v7), const long long >::value, " " );
52
41
static_assert (v7 == 1 , " " );
@@ -77,27 +66,18 @@ void integer_suffix() {
77
66
78
67
static constexpr auto v13 = 1lu;
79
68
// CHECK-MESSAGES: :[[@LINE-1]]:31: warning: integer literal has suffix 'lu', which is not uppercase
80
- // CHECK-MESSAGES-NEXT: static constexpr auto v13 = 1lu;
81
- // CHECK-MESSAGES-NEXT: ^~~
82
- // CHECK-MESSAGES-NEXT: {{^ *| *}}LU{{$}}
83
69
// CHECK-FIXES: static constexpr auto v13 = 1LU;
84
70
static_assert (is_same<decltype (v13), const unsigned long >::value, " " );
85
71
static_assert (v13 == 1 , " " );
86
72
87
73
static constexpr auto v14 = 1Lu;
88
74
// CHECK-MESSAGES: :[[@LINE-1]]:31: warning: integer literal has suffix 'Lu', which is not uppercase
89
- // CHECK-MESSAGES-NEXT: static constexpr auto v14 = 1Lu;
90
- // CHECK-MESSAGES-NEXT: ^~~
91
- // CHECK-MESSAGES-NEXT: {{^ *| *}}LU{{$}}
92
75
// CHECK-FIXES: static constexpr auto v14 = 1LU;
93
76
static_assert (is_same<decltype (v14), const unsigned long >::value, " " );
94
77
static_assert (v14 == 1 , " " );
95
78
96
79
static constexpr auto v15 = 1lU;
97
80
// CHECK-MESSAGES: :[[@LINE-1]]:31: warning: integer literal has suffix 'lU', which is not uppercase
98
- // CHECK-MESSAGES-NEXT: static constexpr auto v15 = 1lU;
99
- // CHECK-MESSAGES-NEXT: ^~~
100
- // CHECK-MESSAGES-NEXT: {{^ *| *}}LU{{$}}
101
81
// CHECK-FIXES: static constexpr auto v15 = 1LU;
102
82
static_assert (is_same<decltype (v15), const unsigned long >::value, " " );
103
83
static_assert (v15 == 1 , " " );
@@ -128,27 +108,18 @@ void integer_suffix() {
128
108
129
109
static constexpr auto v21 = 1llu;
130
110
// CHECK-MESSAGES: :[[@LINE-1]]:31: warning: integer literal has suffix 'llu', which is not uppercase
131
- // CHECK-MESSAGES-NEXT: static constexpr auto v21 = 1llu;
132
- // CHECK-MESSAGES-NEXT: ^~~~
133
- // CHECK-MESSAGES-NEXT: {{^ *| *}}LLU{{$}}
134
111
// CHECK-FIXES: static constexpr auto v21 = 1LLU;
135
112
static_assert (is_same<decltype (v21), const unsigned long long >::value, " " );
136
113
static_assert (v21 == 1 , " " );
137
114
138
115
static constexpr auto v22 = 1LLu;
139
116
// CHECK-MESSAGES: :[[@LINE-1]]:31: warning: integer literal has suffix 'LLu', which is not uppercase
140
- // CHECK-MESSAGES-NEXT: static constexpr auto v22 = 1LLu;
141
- // CHECK-MESSAGES-NEXT: ^~~~
142
- // CHECK-MESSAGES-NEXT: {{^ *| *}}LLU{{$}}
143
117
// CHECK-FIXES: static constexpr auto v22 = 1LLU;
144
118
static_assert (is_same<decltype (v22), const unsigned long long >::value, " " );
145
119
static_assert (v22 == 1 , " " );
146
120
147
121
static constexpr auto v23 = 1llU;
148
122
// CHECK-MESSAGES: :[[@LINE-1]]:31: warning: integer literal has suffix 'llU', which is not uppercase
149
- // CHECK-MESSAGES-NEXT: static constexpr auto v23 = 1llU;
150
- // CHECK-MESSAGES-NEXT: ^~~~
151
- // CHECK-MESSAGES-NEXT: {{^ *| *}}LLU{{$}}
152
123
// CHECK-FIXES: static constexpr auto v23 = 1LLU;
153
124
static_assert (is_same<decltype (v23), const unsigned long long >::value, " " );
154
125
static_assert (v23 == 1 , " " );
0 commit comments