blob: d13e29e9cbc259309bb96866351f4f34f0c75c3e (
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
|
#ifndef SMOLBOTE_SINGLETON_HPP
#define SMOLBOTE_SINGLETON_HPP
/*
* Clang consumed semantics
* States can be: unconsumed, consumed, unknown
* Mark classes with consumable(unconsumed)
* Mark constructors with return_typestate(unconsumed)
* Mark invalidating functions with set_typestate(consumed)
*/
#if defined(__clang__)
#define consumable(X) [[clang::consumable(X)]]
#define return_typestate(X) [[clang::return_typestate(X)]]
#define set_typestate(X) [[clang::set_typestate(X)]]
#define callable_when(X) [[clang::callable_when(X)]]
#define param_typestate(X) [[clang::param_typestate(X)]]
#else
#define consumable(X)
#define return_typestate(X)
#define set_typestate(X)
#define callable_when(X)
#define param_typestate(X)
#endif
#endif // SMOLBOTE_SINGLETON_HPP
|