summaryrefslogtreecommitdiffstats
path: root/debian/uncrustify-trinity/uncrustify-trinity-0.76.0/tests/expected/cpp/30400-attribute_specifier_seqs.cpp
blob: 15cc6e3ab68a9d09b48c6b0ce914630c8d51353e (plain)
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
void asd(void)
{
	a < up_lim() ? do_hi() : do_low;
	a[ a<b>c] = d;
}

[[nodiscard]] inline static CFErrorRef _Nullable CreateErrorIfError(CFStringRef const inDomain, CFIndex const inCode, CFDictionaryRef const inInformation) {
	[[maybe_unused]] auto const [iterator, inserted]{ super_type::insert(ioFileReference) };
	if (inCode == 0) {
		return nullptr;
	}
	return ::CFErrorCreate(kCFAllocatorDefault, inDomain, inCode, inInformation);
}

[[gnu::always_inline]] [[gnu::hot]] [[gnu::const]] [[nodiscard]]
inline int f();
[[gnu::always_inline, gnu::const, gnu::hot, nodiscard]]
int f();
[[using gnu : const, always_inline, hot]] [[nodiscard]]
int f [[gnu::always_inline]]();

int f(int i) [[expects: i > 0]] [[ensures audit x: x < 1]];

void f() {
	int i [[cats::meow([[]])]];
	int x [[unused]] = f();
}

int f(int i) [[deprecated]] {
	switch(i) {
	case 1: [[fallthrough]];
		[[likely]] case 2: return 1;
	}
	return 2;
}

[[
unused, deprecated("keeping for reference only")
]]
void f()
{
}

[[noreturn]] void f() [[deprecated("because")]] {
	throw "error";
}

void print2(int * [[carries_dependency]] val)
{
	std::cout<<*p<<std::endl;
}

class X {
public:
int v() const {
	return x;
}
int g() [[expects: v() > 0]];
private:
int k() [[expects: x > 0]];
int x;
};

class [[foo, bar("baz")]] /**/ Y : private Foo, Bar {
public:
int v(int &x) {
	return x;
}
};

class
	[[foo]]
	[[bar("baz")]]
	Z : Foo, public Bar {
public:
int v(int * x) {
	return *x;
}
};

int g(int* p) [[ensures: p != nullptr]]
{
	*p = 42;
}

bool meow(const int&) {
	return true;
}
void i(int& x) [[ensures: meow(x)]]
{
	++x;
}

enum Enum {
	a, b
};
enum class [[foo]] Enum {
	a, b
};
enum struct [[foo]] /**/ [[bar("baz")]] Enum {
	a, b
};
enum [[foo]]
Enum {
	a, b
};
enum class [[foo]] //
[[bar("baz")]] Enum {
	a, b
};
enum struct //
[[bar("baz")]] Enum {
	a, b
};
enum
[[foo]] [[bar("baz")]] /**/ Enum {
	a, b
};
enum class /**/ [[foo]] [[bar("baz")]]
Enum {
	a, b
};
enum //
struct
[[foo]]
[[bar("baz")]]
Enum {
	a, b
};