blob: 91e45a23ca2409ff4d7275f1d57017b42d692e3f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
#ifndef __DEFER_H__
#define __DEFER_H__
#ifndef __unused
#define __unused __attribute__((unused))
#endif
#define __cleanup(f) __attribute__((cleanup(f)))
#define CAT(a, b) CAT_(a, b)
#define CAT_(a, b) a ## b
#define UNIQ(name) CAT(name, __LINE__)
#define defer \
auto void UNIQ(defer_func)(int *); \
int UNIQ(defer_var) __cleanup(UNIQ(defer_func)); \
void UNIQ(defer_func)(int *__arg __unused)
#endif
|