#include "auto/config.h"
Go to the source code of this file.
|
#define | __has_feature(x) 0 |
|
#define | __has_extension __has_feature |
|
#define | STATIC_ASSERT_PRAGMA_START |
|
#define | STATIC_ASSERT_PRAGMA_END |
|
#define | STATIC_ASSERT(cond, msg) |
| Assert at compile time if condition is not satisfied. More...
|
|
#define | STATIC_ASSERT_STATEMENT STATIC_ASSERT_EXPR |
|
#define | ASSERT_CONCAT_(a, b) a##b |
|
#define | ASSERT_CONCAT(a, b) ASSERT_CONCAT_(a, b) |
|
#define | STATIC_ASSERT_EXPR(e, m) ((enum { ASSERT_CONCAT(assert_line_, __LINE__) = 1/(!!(e)), }) 0) |
| Like STATIC_ASSERT, but can be used where expressions are used. More...
|
|
#define | STRICT_ADD(a, b, c, t) do { *(c) = (t)((a) + (b)); } while (0) |
| Adds (a + b) and stores result in c . Aborts on overflow. More...
|
|
#define | STRICT_SUB(a, b, c, t) do { *(c) = (t)((a) - (b)); } while (0) |
| Subtracts (a - b) and stores result in c . Aborts on overflow. More...
|
|
◆ __has_extension
◆ __has_feature
#define __has_feature |
( |
|
x | ) |
0 |
◆ ASSERT_CONCAT
◆ ASSERT_CONCAT_
#define ASSERT_CONCAT_ |
( |
|
a, |
|
|
|
b |
|
) |
| a##b |
◆ STATIC_ASSERT
#define STATIC_ASSERT |
( |
|
cond, |
|
|
|
msg |
|
) |
| |
Value:
STATIC_ASSERT_PRAGMA_END \
} while (0)
Assert at compile time if condition is not satisfied.
Should be put on its own line, followed by a semicolon.
Example:
STATIC_ASSERT(sizeof(void *) == 8, "Expected 64-bit mode");
- Parameters
-
[in] | condition | Condition to check, should be an integer constant expression. |
[in] | message | Message which will be given if check fails. |
◆ STATIC_ASSERT_EXPR
#define STATIC_ASSERT_EXPR |
( |
|
e, |
|
|
|
m |
|
) |
| ((enum { ASSERT_CONCAT(assert_line_, __LINE__) = 1/(!!(e)), }) 0) |
Like STATIC_ASSERT, but can be used where expressions are used.
STATIC_ASSERT_EXPR may be put in brace initializer lists. Error message given in this case is not very nice with the current implementation though and message
argument is ignored.
◆ STATIC_ASSERT_PRAGMA_END
#define STATIC_ASSERT_PRAGMA_END |
◆ STATIC_ASSERT_PRAGMA_START
#define STATIC_ASSERT_PRAGMA_START |
◆ STATIC_ASSERT_STATEMENT
◆ STRICT_ADD
#define STRICT_ADD |
( |
|
a, |
|
|
|
b, |
|
|
|
c, |
|
|
|
t |
|
) |
| do { *(c) = (t)((a) + (b)); } while (0) |
◆ STRICT_SUB
#define STRICT_SUB |
( |
|
a, |
|
|
|
b, |
|
|
|
c, |
|
|
|
t |
|
) |
| do { *(c) = (t)((a) - (b)); } while (0) |
Subtracts (a - b) and stores result in c
. Aborts on overflow.
- See also
- STRICT_ADD