mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-26 04:10:14 +01:00
std-aux: add code comment to NM_BOOLEAN_EXPR()
This commit is contained in:
parent
8bd72d5f2e
commit
e7b1fd9dbc
1 changed files with 9 additions and 0 deletions
|
|
@ -156,6 +156,15 @@ typedef uint64_t _nm_bitwise nm_be64_t;
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
/* NM_BOOLEAN_EXPR(expr) exists to ensure that there is still a compiler
|
||||
* warning when accidentally(?) using assignments like `NM_BOOLEAN_EXPR(x = 1)`
|
||||
* Compiler will warn about that and suggest either == or additional parentheses
|
||||
* `NM_BOOLEAN_EXPR((x = 1))`.
|
||||
*
|
||||
* This also is true for users of this macro, like `NM_LIKELY(x = 1)` and further
|
||||
* up `nm_assert(x = 1)`. Those users must make sure not themselves adding additional
|
||||
* parentheses around the condition.
|
||||
*/
|
||||
#define _NM_BOOLEAN_EXPR_IMPL(v, expr) \
|
||||
({ \
|
||||
int NM_UNIQ_T(V, v); \
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue