Libecoli  0.11.3
Extensible COmmand LIne library
utils.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright 2018, Olivier MATZ <zer0@droids-corp.org>
3  */
4 
12 #pragma once
13 
17 #define EC_CAST(x, old_type, new_type) \
18  ({ \
19  __typeof__(old_type) __x = (x); \
20  (__typeof__(new_type))__x; \
21  })
22 
26 #define EC_VA_END ((void *)1)
27 
31 #define EC_COUNT_OF(x) ((sizeof(x) / sizeof(0 [x])) / ((size_t)(!(sizeof(x) % sizeof(0 [x])))))
32 
36 #define EC_DEPRECATED(msg) __attribute__((deprecated(msg)))
37 
41 #define EC_DEPRECATED_MACRO_(x) _Pragma(#x)
42 #define EC_DEPRECATED_MACRO(msg) EC_DEPRECATED_MACRO_(GCC warning msg)
43