-
Notifications
You must be signed in to change notification settings - Fork 889
Better fix for #1699 #1705
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
Better fix for #1699 #1705
Conversation
|
we should add a warning disable for that line, if we all agree the warning is incorrect, which I think we are. e.g. #pragma GCC diagnostic ignored "-Wmissing-field-initializers"
stdAc::state_t result{};
#pragma GCC diagnostic pop |
No need to apologise at all. |
OK, I've added this much more targeted fix: #pragma gcc diagnostic push
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
stdAc::state_t result{};
#pragma GCC diagnostic pop |
crankyoldgit
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Thanks again.
|
What is this code lint error? the code is identical to that around it? Is this a spurious error? |
crankyoldgit
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src/IRsend.h:97: Do not indent within a namespace [runtime/indentation_namespace] [4]
Done
|
@crankyoldgit ... I have looked at this four different ways. Lines 96 to 116 in 56d5352
It's showing two space indentation before Then there is the PR: This is using the exact same spacing... the indentation has not changed. Is this blocking the PR, unless it reformats the indentation of that entire namespace? |
In short, yes. @henrygab It appears we've triggered the I'll adjust your branch/PR to address it. |
|
OK, thanks for adjusting the PR, and approving / merging. It just seemed (seems?) wrong. It could be that the linter is smart ... e.g., maybe it won't report an error for a section of code unless it's being changed? either way, many thanks! |
You're not alone. I had to dig into it to find out why it was triggering.
No, it's not smart and it is standalone. It does the whole thing. It often misses stuff due to parsing issues. End of the day, it's a piece of python that does a pretty good (but not perfect) job, and is often correct.
No worries. |
In PR #1700, I removed the curly braces, because GCC (ESP8266) warned about uninitialized fields (see #1699). After digging deeper, the warnings that GCC emitted were incorrect. Special shout out to @mcspr for questioning this, and making me dig deeper!
PR #1700 resulted in the removal of explicitly zero-initialization of the structure. While the function then initialized each field, there are likely unused packing bytes (e.g., between final
beepandsleep) that would not be initialized to zero.I admit that I'm not sure how GCC handles returning a local
struct... (does it use the copy constructor?), but regardless of whether this actually exposes uninitialized bytes, it's still bad practice(*) to not properly initialized structures.@crankyoldgit ... please accept my apologies. I didn't dig deeply enough, and made a mistake.