mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-05 13:44:32 +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.
|
||||
*/
|
||||
#if (CONFIG_COMPILER_OPTIMIZATION_PERF)
|
||||
#ifndef likely
|
||||
#define likely(x) __builtin_expect(!!(x), 1)
|
||||
#endif
|
||||
#ifndef unlikely
|
||||
#define unlikely(x) __builtin_expect(!!(x), 0)
|
||||
#endif
|
||||
#else
|
||||
#ifndef likely
|
||||
#define likely(x) (x)
|
||||
#endif
|
||||
#ifndef unlikely
|
||||
#define unlikely(x) (x)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Utility macros used for designated initializers, which work differently
|
||||
|
Reference in New Issue
Block a user