Merge branch 'feature/likely_unlikely' into 'master'

Adding likely unlikely macros to hot code paths

Closes IDF-284

See merge request espressif/esp-idf!6368
This commit is contained in:
Angus Gratton
2020-01-10 14:05:07 +08:00
18 changed files with 94 additions and 35 deletions

View File

@@ -94,6 +94,8 @@
#ifdef __cplusplus
extern "C" {
#endif
/* for likely and unlikely */
#include "esp_compiler.h"
/* Application specific configuration options. */
#include "FreeRTOSConfig.h"

View File

@@ -126,12 +126,12 @@ int xt_clock_freq(void) __attribute__((deprecated));
#if defined(CONFIG_FREERTOS_ASSERT_DISABLE)
#define configASSERT(a) /* assertions disabled */
#elif defined(CONFIG_FREERTOS_ASSERT_FAIL_PRINT_CONTINUE)
#define configASSERT(a) if (!(a)) { \
#define configASSERT(a) if (unlikely(!(a))) { \
ets_printf("%s:%d (%s)- assert failed!\n", __FILE__, __LINE__, \
__FUNCTION__); \
}
#else /* CONFIG_FREERTOS_ASSERT_FAIL_ABORT */
#define configASSERT(a) if (!(a)) { \
#define configASSERT(a) if (unlikely(!(a))) { \
ets_printf("%s:%d (%s)- assert failed!\n", __FILE__, __LINE__, \
__FUNCTION__); \
abort(); \