From 381ac08f1214e46131ad4ad40bfdd1aa24ca1d8c Mon Sep 17 00:00:00 2001 From: Otto Winter Date: Fri, 22 Oct 2021 18:13:33 +0200 Subject: [PATCH] bugfix (esp_common): remove infinite recursion in FLAG_ATTR operator Closes https://github.com/espressif/esp-idf/pull/7754 Signed-off-by: Jakob Hasse --- components/riscv/include/esp_attr.h | 4 ++-- components/spi_flash/sim/stubs/xtensa/esp_attr.h | 4 ++-- components/xtensa/include/esp_attr.h | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/components/riscv/include/esp_attr.h b/components/riscv/include/esp_attr.h index 38a8fbe4ee..681c2e1a79 100644 --- a/components/riscv/include/esp_attr.h +++ b/components/riscv/include/esp_attr.h @@ -95,8 +95,8 @@ FORCE_INLINE_ATTR constexpr TYPE operator<< (TYPE a, int b) { return (TYPE)((INT FORCE_INLINE_ATTR TYPE& operator|=(TYPE& a, TYPE b) { a = a | b; return a; } \ FORCE_INLINE_ATTR TYPE& operator&=(TYPE& a, TYPE b) { a = a & b; return a; } \ FORCE_INLINE_ATTR TYPE& operator^=(TYPE& a, TYPE b) { a = a ^ b; return a; } \ -FORCE_INLINE_ATTR TYPE& operator>>=(TYPE& a, int b) { a >>= b; return a; } \ -FORCE_INLINE_ATTR TYPE& operator<<=(TYPE& a, int b) { a <<= b; return a; } +FORCE_INLINE_ATTR TYPE& operator>>=(TYPE& a, int b) { a = a >> b; return a; } \ +FORCE_INLINE_ATTR TYPE& operator<<=(TYPE& a, int b) { a = a << b; return a; } #define FLAG_ATTR_U32(TYPE) FLAG_ATTR_IMPL(TYPE, uint32_t) #define FLAG_ATTR FLAG_ATTR_U32 diff --git a/components/spi_flash/sim/stubs/xtensa/esp_attr.h b/components/spi_flash/sim/stubs/xtensa/esp_attr.h index 2b59f16e95..027b642154 100644 --- a/components/spi_flash/sim/stubs/xtensa/esp_attr.h +++ b/components/spi_flash/sim/stubs/xtensa/esp_attr.h @@ -116,8 +116,8 @@ FORCE_INLINE_ATTR constexpr TYPE operator<< (TYPE a, int b) { return (TYPE)((INT FORCE_INLINE_ATTR TYPE& operator|=(TYPE& a, TYPE b) { a = a | b; return a; } \ FORCE_INLINE_ATTR TYPE& operator&=(TYPE& a, TYPE b) { a = a & b; return a; } \ FORCE_INLINE_ATTR TYPE& operator^=(TYPE& a, TYPE b) { a = a ^ b; return a; } \ -FORCE_INLINE_ATTR TYPE& operator>>=(TYPE& a, int b) { a >>= b; return a; } \ -FORCE_INLINE_ATTR TYPE& operator<<=(TYPE& a, int b) { a <<= b; return a; } +FORCE_INLINE_ATTR TYPE& operator>>=(TYPE& a, int b) { a = a >> b; return a; } \ +FORCE_INLINE_ATTR TYPE& operator<<=(TYPE& a, int b) { a = a << b; return a; } #define FLAG_ATTR_U32(TYPE) FLAG_ATTR_IMPL(TYPE, uint32_t) #define FLAG_ATTR FLAG_ATTR_U32 diff --git a/components/xtensa/include/esp_attr.h b/components/xtensa/include/esp_attr.h index 27db5cbf00..b90a7e27c4 100644 --- a/components/xtensa/include/esp_attr.h +++ b/components/xtensa/include/esp_attr.h @@ -117,8 +117,8 @@ FORCE_INLINE_ATTR constexpr TYPE operator<< (TYPE a, int b) { return (TYPE)((INT FORCE_INLINE_ATTR TYPE& operator|=(TYPE& a, TYPE b) { a = a | b; return a; } \ FORCE_INLINE_ATTR TYPE& operator&=(TYPE& a, TYPE b) { a = a & b; return a; } \ FORCE_INLINE_ATTR TYPE& operator^=(TYPE& a, TYPE b) { a = a ^ b; return a; } \ -FORCE_INLINE_ATTR TYPE& operator>>=(TYPE& a, int b) { a >>= b; return a; } \ -FORCE_INLINE_ATTR TYPE& operator<<=(TYPE& a, int b) { a <<= b; return a; } +FORCE_INLINE_ATTR TYPE& operator>>=(TYPE& a, int b) { a = a >> b; return a; } \ +FORCE_INLINE_ATTR TYPE& operator<<=(TYPE& a, int b) { a = a << b; return a; } #define FLAG_ATTR_U32(TYPE) FLAG_ATTR_IMPL(TYPE, uint32_t) #define FLAG_ATTR FLAG_ATTR_U32