Loading...
Searching...
No Matches
utils.h
/* SPDX-License-Identifier: BSD-3-Clause
* Copyright 2018, Olivier MATZ <zer0@droids-corp.org>
*/
#pragma once
#define EC_CAST(x, old_type, new_type) \
({ \
__typeof__(old_type) __x = (x); \
(__typeof__(new_type))__x; \
})
#define EC_VA_END ((void *)1)
#define EC_COUNT_OF(x) ((sizeof(x) / sizeof(0 [x])) / ((size_t)(!(sizeof(x) % sizeof(0 [x])))))
#define EC_DEPRECATED(msg) __attribute__((deprecated(msg)))
#define EC_DEPRECATED_MACRO_(x) _Pragma(#x)
#define EC_DEPRECATED_MACRO(msg) EC_DEPRECATED_MACRO_(GCC warning msg)