Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sys/test_utils: mark expect() condition as likely true
Browse files Browse the repository at this point in the history
benpicco committed Jan 17, 2023

Verified

This commit was signed with the committer’s verified signature. The key has expired.
miri64 Martine Lenders
1 parent 7e57e0f commit e75c702
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion sys/include/test_utils/expect.h
Original file line number Diff line number Diff line change
@@ -26,6 +26,7 @@
#define TEST_UTILS_EXPECT_H

#include <stdio.h>
#include "compiler_hints.h"
#include "panic.h"

#ifdef __cplusplus
@@ -76,7 +77,7 @@ NORETURN static inline void _expect_failure(const char *file, unsigned line)
* the condition failed in.
*
*/
#define expect(cond) ((cond) ? (void)0 : _expect_failure(__FILE__, __LINE__))
#define expect(cond) (likely(cond) ? (void)0 : _expect_failure(__FILE__, __LINE__))

#ifdef __cplusplus
}

0 comments on commit e75c702

Please sign in to comment.