Debian Codegraph @

clang-tools-extra/test/clang-tidy/checkers/hicpp/signed-bitwise-standard-types.h

raw
1 #pragma clang system_header
2
3 // Implement standard types that are known to be defined as unsigned in some
4 // implementations like MSVC.
5 namespace std {
6 namespace locale {
7 enum category : int {
8 none = 0u,
9 collate = 1u << 1u,
10 ctype = 1u << 2u,
11 monetary = 1u << 3u,
12 numeric = 1u << 4u,
13 time = 1u << 5u,
14 messages = 1u << 6u,
15 all = none | collate | ctype | monetary | numeric | time | messages
16 // CHECK MESSAGES: [[@LINE-1]]:9: warning: use of a signed integer operand with a binary bitwise operator
17 };
18 } // namespace locale
19
20 namespace ctype_base {
21 enum mask : int {
22 space,
23 print,
24 cntrl,
25 upper,
26 lower,
27 alpha,
28 digit,
29 punct,
30 xdigit,
31 /* blank, // C++11 */
32 alnum = alpha | digit,
33 // CHECK MESSAGES: [[@LINE-1]]:11: warning: use of a signed integer operand with a binary bitwise operator
34 graph = alnum | punct
35 // CHECK MESSAGES: [[@LINE-1]]:11: warning: use of a signed integer operand with a binary bitwise operator
36 };
37 } // namespace ctype_base
38
39 namespace ios_base {
40 enum fmtflags : int {
41 dec = 0u,
42 oct = 1u << 2u,
43 hex = 1u << 3u,
44 basefield = dec | oct | hex | 0u,
45 // CHECK MESSAGES: [[@LINE-1]]:15: warning: use of a signed integer operand with a binary bitwise operator
46 left = 1u << 4u,
47 right = 1u << 5u,
48 internal = 1u << 6u,
49 adjustfield = left | right | internal,
50 // CHECK MESSAGES: [[@LINE-1]]:17: warning: use of a signed integer operand with a binary bitwise operator
51 scientific = 1u << 7u,
52 fixed = 1u << 8u,
53 floatfield = scientific | fixed | (scientific | fixed) | 0u,
54 // CHECK MESSAGES: [[@LINE-1]]:16: warning: use of a signed integer operand with a binary bitwise operator
55 // CHECK MESSAGES: [[@LINE-2]]:38: warning: use of a signed integer operand with a binary bitwise operator
56 boolalpha = 1u << 9u,
57 showbase = 1u << 10u,
58 showpoint = 1u << 11u,
59 showpos = 1u << 12u,
60 skipws = 1u << 13u,
61 unitbuf = 1u << 14u,
62 uppercase = 1u << 15u
63 };
64
65 enum iostate : int {
66 goodbit = 0u,
67 badbit = 1u << 1u,
68 failbit = 1u << 2u,
69 eofbit = 1u << 3u
70 };
71
72 enum openmode : int {
73 app = 0u,
74 binary = 0u << 1u,
75 in = 0u << 2u,
76 out = 0u << 3u,
77 trunc = 0u << 4u,
78 ate = 0u << 5u
79 };
80 } // namespace ios_base
81 } // namespace std