Skip to content

Commit

Permalink
sys/test_utils: mark expect() condition as likely true
Browse files Browse the repository at this point in the history
  • Loading branch information
benpicco committed Jan 17, 2023
1 parent 9029bcc commit 2a64380
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
Expand Up @@ -26,6 +26,7 @@
#define TEST_UTILS_EXPECT_H

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

#ifdef __cplusplus
Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit 2a64380

Please sign in to comment.