mirror of
https://github.com/apache/nuttx.git
synced 2026-05-21 13:13:08 +08:00
include/compiler: replace likely to predict_true
likely is defined repeatedly in an external library Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
This commit is contained in:
committed by
Alan Carvalho de Assis
parent
b91042e5a0
commit
216483f96b
+4
-4
@@ -50,11 +50,11 @@
|
||||
#define PANIC() __assert(__FILE__, __LINE__, "panic")
|
||||
|
||||
#ifdef CONFIG_DEBUG_ASSERTIONS_EXPRESSION
|
||||
#define ASSERT(f) do { if (unlikely(!(f))) __assert(__FILE__, __LINE__, #f); } while (0)
|
||||
#define VERIFY(f) do { if (unlikely((f) < 0)) __assert(__FILE__, __LINE__, #f); } while (0)
|
||||
#define ASSERT(f) do { if (predict_false(!(f))) __assert(__FILE__, __LINE__, #f); } while (0)
|
||||
#define VERIFY(f) do { if (predict_false((f) < 0)) __assert(__FILE__, __LINE__, #f); } while (0)
|
||||
#else
|
||||
#define ASSERT(f) do { if (unlikely(!(f))) __assert(__FILE__, __LINE__, NULL); } while (0)
|
||||
#define VERIFY(f) do { if (unlikely((f) < 0)) __assert(__FILE__, __LINE__, NULL); } while (0)
|
||||
#define ASSERT(f) do { if (predict_false(!(f))) __assert(__FILE__, __LINE__, NULL); } while (0)
|
||||
#define VERIFY(f) do { if (predict_false((f) < 0)) __assert(__FILE__, __LINE__, NULL); } while (0)
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_DEBUG_ASSERTIONS
|
||||
|
||||
+12
-12
@@ -156,8 +156,8 @@
|
||||
|
||||
/* Branch prediction */
|
||||
|
||||
# define likely(x) __builtin_expect((x), 1)
|
||||
# define unlikely(x) __builtin_expect((x), 0)
|
||||
# define predict_true(x) __builtin_expect(!!(x), 1)
|
||||
# define predict_false(x) __builtin_expect((x), 0)
|
||||
|
||||
/* Code locate */
|
||||
|
||||
@@ -476,8 +476,8 @@
|
||||
*/
|
||||
|
||||
# define noreturn_function
|
||||
# define likely(x) (x)
|
||||
# define unlikely(x) (x)
|
||||
# define predict_true(x) (x)
|
||||
# define predict_false(x) (x)
|
||||
# define locate_code(n)
|
||||
# define aligned_data(n)
|
||||
# define locate_data(n)
|
||||
@@ -628,8 +628,8 @@
|
||||
*/
|
||||
|
||||
# define noreturn_function
|
||||
# define likely(x) (x)
|
||||
# define unlikely(x) (x)
|
||||
# define predict_true(x) (x)
|
||||
# define predict_false(x) (x)
|
||||
# define aligned_data(n)
|
||||
# define locate_code(n)
|
||||
# define locate_data(n)
|
||||
@@ -737,8 +737,8 @@
|
||||
# define weak_const_function
|
||||
# define noreturn_function
|
||||
# define farcall_function
|
||||
# define likely(x) (x)
|
||||
# define unlikely(x) (x)
|
||||
# define predict_true(x) (x)
|
||||
# define predict_false(x) (x)
|
||||
# define locate_code(n)
|
||||
# define aligned_data(n)
|
||||
# define locate_data(n)
|
||||
@@ -826,8 +826,8 @@
|
||||
# define restrict
|
||||
# define noreturn_function
|
||||
# define farcall_function
|
||||
# define likely(x) (x)
|
||||
# define unlikely(x) (x)
|
||||
# define predict_true(x) (x)
|
||||
# define predict_false(x) (x)
|
||||
# define aligned_data(n)
|
||||
# define locate_code(n)
|
||||
# define locate_data(n)
|
||||
@@ -890,8 +890,8 @@
|
||||
# define restrict
|
||||
# define noreturn_function
|
||||
# define farcall_function
|
||||
# define likely(x) (x)
|
||||
# define unlikely(x) (x)
|
||||
# define predict_true(x) (x)
|
||||
# define predict_false(x) (x)
|
||||
# define aligned_data(n)
|
||||
# define locate_code(n)
|
||||
# define locate_data(n)
|
||||
|
||||
Reference in New Issue
Block a user