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
Make macro defined event base variables immutable (IDFGH-9106) #10509
Conversation
|
Thanks for your contribution. |
@ljden Thanks, I think it's a good change! Unfortunately, the pre-commit hook fails because that file has an old license/copyright header which is rejected once it is changed. There are several solutions to this:
|
@0xjakob is updating the licence also a solution? Also, what does installing the pre-commit hook do? Will it actually change anything or would it just notify my locally that I have an issue |
sha=b4d904f8f05a69f96587f7e0d1807363d985e131 |
@ljden Looks great! Thanks for the update. Just for the record:
It installs a bunch of checkers that automatically run whenever you commit to the IDF repository. These checks are also run in our internal pipelines, hence you can't avoid fixing them and it's better to fix them before even pushing the code (ideally).
The pre-commit hook will try to automatically fix license headers once you run it. |
Makes sense, cheers for the details 👍 |
@ljden Your code is available on master already (i.e., it has been merged). Consequently, we're closing this PR. |
I believe the following code should not compile:
however it does as
esp_event_base_t
is a mutable pointer.esp-idf/components/esp_event/include/esp_event_base.h
Lines 23 to 27 in 4c98bee
I suggest that as
esp_event_base_t
type may be used in user code relying on the mutability of the type, theESP_EVENT_*_BASE
macros should be updated to make the variable immutable:This results in the original code no longer compiling:
If there is a reason for the mutability that I've missed please let me know!