agileRTOS (zrtos)
Version 0.8.0 (ghostbuster)
assert.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2024 ykat UG (haftungsbeschraenkt) - All Rights Reserved
3
*
4
* Permission for non-commercial use is hereby granted,
5
* free of charge, without warranty of any kind.
6
*/
7
#ifndef ZRTOS_ASSERT_H
8
#define ZRTOS_ASSERT_H
9
#ifdef __cplusplus
10
extern
"C"
{
11
#endif
12
13
#ifdef __cplusplus
14
#define ZRTOS_ASSERT__STATIC_EX(cond,msg) static_assert(cond,msg)
15
#define ZRTOS_ASSERT__STATIC(cond) static_assert(cond)
16
#else
17
#define ZRTOS_ASSERT__STATIC_EX(cond,msg) \
18
typedef char static_assertion_##msg[ \
19
(cond)?1:-1 \
20
]__attribute__((unused));
21
22
#define ZRTOS_ASSERT__STATIC_HELPER(cond,line) \
23
ZRTOS_ASSERT__STATIC_EX(cond,line)
24
25
#define ZRTOS_ASSERT__STATIC(cond) \
26
ZRTOS_ASSERT__STATIC_HELPER(cond,__COUNTER__)
27
#endif
28
29
#define ZRTOS_ASSERT__STATIC_IS_POWER_OF_TWO(x) \
30
ZRTOS_ASSERT__STATIC(((x) != 0) && (((x) & ((x) - 1)) == 0))
31
32
33
#ifdef __cplusplus
34
}
35
#endif
36
#endif
zrtos
assert.h
© 2024 ykat UG (haftungsbeschränkt)