Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix infinite recursion in FLAG_ATTR operator (IDFGH-6073) #7754

Closed
wants to merge 1 commit into from

Conversation

OttoWinter
Copy link
Contributor

clang-tidy detected this while linting esphome

~/espidf/components/hal/include/hal/touch_sensor_types.h:165:1: error: all paths through this function will call itself [clang-diagnostic-infinite-recursion]
FLAG_ATTR(touch_pad_intr_mask_t)
^
~/espidf/components/riscv/include/esp_attr.h:102:19: note: expanded from macro 'FLAG_ATTR'
#define FLAG_ATTR FLAG_ATTR_U32
                  ^
~/espidf/components/riscv/include/esp_attr.h:101:29: note: expanded from macro 'FLAG_ATTR_U32'
#define FLAG_ATTR_U32(TYPE) FLAG_ATTR_IMPL(TYPE, uint32_t)
                            ^
~/espidf/components/riscv/include/esp_attr.h:98:53: note: expanded from macro 'FLAG_ATTR_IMPL'
FORCE_INLINE_ATTR TYPE& operator>>=(TYPE& a, int b) { a >>= b; return a; } \

It seems the intention was to use the >> and << operators defined a couple of lines above (like in the |= etc operators). But this version currently just results in infinite recursion.

@CLAassistant
Copy link

CLAassistant commented Oct 22, 2021

CLA assistant check
All committers have signed the CLA.

@espressif-bot espressif-bot added the Status: Opened Issue is new label Oct 22, 2021
@github-actions github-actions bot changed the title Fix infinite recursion in FLAG_ATTR operator Fix infinite recursion in FLAG_ATTR operator (IDFGH-6073) Oct 22, 2021
@Alvin1Zhang
Copy link
Collaborator

Thanks for your contribution.

@suda-morris suda-morris added the PR-Sync-Merge Pull request sync as merge commit label Jan 4, 2022
@suda-morris
Copy link
Collaborator

sha=d0f43871a3acea4af8fa611c9cf86a81fb38befb

@0xjakob 0xjakob self-assigned this Jan 7, 2022
@espressif-bot espressif-bot added Resolution: NA Issue resolution is unavailable Status: Done Issue is done internally Resolution: Done Issue is done internally and removed Status: Opened Issue is new Resolution: NA Issue resolution is unavailable labels Jan 18, 2022
@0xjakob
Copy link
Collaborator

0xjakob commented Jan 18, 2022

@OttoWinter We've just merge this PR internally. You can expect it to arrive on github during the next days. Unfortunately, we couldn't preserve the original commit hash, but your authorship is still retained, of course.

dskulina pushed a commit to playable-tech/esp-idf that referenced this pull request Feb 4, 2022
Closes espressif#7754

Signed-off-by: Jakob Hasse <jakob.hasse@espressif.com>
dskulina pushed a commit to playable-tech/esp-idf that referenced this pull request Feb 5, 2022
Closes espressif#7754

Signed-off-by: Jakob Hasse <jakob.hasse@espressif.com>
@AxelLin
Copy link
Contributor

AxelLin commented Mar 13, 2022

@0xjakob
v4.4 needs the same fix.
v4.3 needs backport fix:
$ git grep "FORCE_INLINE_ATTR TYPE& operator>>="
components/riscv/include/esp_attr.h:FORCE_INLINE_ATTR TYPE& operator>>=(TYPE& a, int b) { a >>= b; return a; }
components/spi_flash/sim/stubs/xtensa/esp_attr.h:FORCE_INLINE_ATTR TYPE& operator>>=(TYPE& a, int b) { a >>= b; return a; }
components/xtensa/include/esp_attr.h:FORCE_INLINE_ATTR TYPE& operator>>=(TYPE& a, int b) { a >>= b; return a; } \

@AxelLin
Copy link
Contributor

AxelLin commented Feb 22, 2023

@OttoWinter We've just merge this PR internally. You can expect it to arrive on github during the next days. Unfortunately, we couldn't preserve the original commit hash, but your authorship is still retained, of course.

v4.4 still needs the fix.
https://github.com/espressif/esp-idf/blob/release/v4.4/components/esp_common/include/esp_attr.h#L133-L134

@0xjakob
Copy link
Collaborator

0xjakob commented Apr 17, 2023

@AxelLin Sorry, the backports slipped through, we're creating them now.

espressif-bot pushed a commit that referenced this pull request Apr 22, 2023
Closes #7754

Signed-off-by: Jakob Hasse <jakob.hasse@espressif.com>
espressif-bot pushed a commit that referenced this pull request Apr 23, 2023
Closes #7754

Signed-off-by: Jakob Hasse <jakob.hasse@espressif.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR-Sync-Merge Pull request sync as merge commit Resolution: Done Issue is done internally Status: Done Issue is done internally
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants