-
Notifications
You must be signed in to change notification settings - Fork 76
Expand file tree
/
Copy pathtest.cpp
More file actions
53 lines (40 loc) · 1.23 KB
/
test.cpp
File metadata and controls
53 lines (40 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include "test.h"
#include <cstdint>
#include <functional>
#include <string>
#undef INT_MAX // NON_COMPLIANT
#define SIZE_MAX 256 // NON_COMPLIANT
enum {
INT_MAX = 0 // NON_COMPLIANT
};
#undef noreturn // NON_COMPLIANT
#define private 1 // NON_COMPLIANT
// int NULL = 0; // NON_COMPLIANT, but not supported by compilers in practice
namespace ns {
int tzname = 0; // NON_COMPLIANT
}
void min() {} // NON_COMPLIANT
void operator"" x(long double); // NON_COMPLIANT
void operator"" _x(long double); // COMPLIANT
int __x; // NON_COMPLIANT
int _X; // NON_COMPLIANT
int _x; // NON_COMPLIANT
namespace ns {
int _x; // COMPLIANT
int __x; // NON_COMPLIANT
int _X; // NON_COMPLIANT
} // namespace ns
#define F(X) int _##X
F(i); // NON_COMPLIANT - user macro
#define FD_SET(X) \
int _##X // NON_COMPLIANT - redefinition of standard library macro
FD_SET(j); // COMPLIANT - standard library macro
void f() {
std::string x = __func__; // COMPLIANT
}
void g(int (*l)(int)) {}
void test_lambda(const int y) {
// Lambda generates a static function called `_FUN` when the lambda is
// converted to a function pointer
g([](int x) { return x; }); // COMPLIANT - compiler generated
}