mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-06 14:14:33 +02:00
esp_common: Don't redefine likely/unlikely if already defined
As these macros aren't namespaced, they may have been defined by another header. Also reported in https://github.com/espressif/esp-idf/issues/6445
This commit is contained in:
@@ -23,12 +23,20 @@
|
|||||||
* code.
|
* code.
|
||||||
*/
|
*/
|
||||||
#if (CONFIG_COMPILER_OPTIMIZATION_PERF)
|
#if (CONFIG_COMPILER_OPTIMIZATION_PERF)
|
||||||
|
#ifndef likely
|
||||||
#define likely(x) __builtin_expect(!!(x), 1)
|
#define likely(x) __builtin_expect(!!(x), 1)
|
||||||
|
#endif
|
||||||
|
#ifndef unlikely
|
||||||
#define unlikely(x) __builtin_expect(!!(x), 0)
|
#define unlikely(x) __builtin_expect(!!(x), 0)
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
|
#ifndef likely
|
||||||
#define likely(x) (x)
|
#define likely(x) (x)
|
||||||
|
#endif
|
||||||
|
#ifndef unlikely
|
||||||
#define unlikely(x) (x)
|
#define unlikely(x) (x)
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Utility macros used for designated initializers, which work differently
|
* Utility macros used for designated initializers, which work differently
|
||||||
|
Reference in New Issue
Block a user