-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Prevent unreachable statements and correct variable sizes. #11470
Conversation
@hugueskamba, thank you for your changes. |
@@ -114,6 +114,9 @@ MBED_NORETURN void mbed_rtos_start() | |||
} | |||
|
|||
osKernelStart(); | |||
#if MBED_TRAP_ERRORS_ENABLED |
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.
Are you intending to change behaviour here, or are you thinking that MBED_ERROR
's behaviour is conditional on this flag?
MBED_ERROR
always kills the system. You can just remove the while (1)
.
If you're trying to reduce ROM size and make more error cases conditional, putting more MBED_TRAP_ERRORS_ENABLED
conditions in might be a thing you could do, but it's a bit tangential.
Note that previously that flag was only on for debug profile - now it's on for develop and debug, not relase. It tends to catch RTOS errors like "claiming a mutex from IRQ".
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.
I'll remove the infinite loop. I do not understand the reason for those statements that are expected not to be reached...
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.
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.
Previously mbed_error
wasn't marked "noreturn", so I can imagine compilers complaining about returning? It might have complained with osRtxErrorNotify being "noreturn" itself. Maybe the loops were to shut that up.
Or perhaps people were just being over-cautious - not trusting it.
(With the "noreturn" marking, the compiler will actually not be making it possible for mbed_error
to return anyway - it'll crash if it did)
@@ -53,6 +53,7 @@ __NO_RETURN void osRtxIdleThread(void *argument) | |||
|
|||
__NO_RETURN uint32_t osRtxErrorNotify(uint32_t code, void *object_id) | |||
{ | |||
#if MBED_TRAP_ERRORS_ENABLED |
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.
Same comment as above - are you intentionally killing stack overflow reports for release builds? If you want to do that, I suggest this isn't the place - you'd do better switching whatever the existing options are to make mbed_error
not print anything and just halt the system. (Rather than change every callsite of mbed_error
)
Otherwise, just remove the for loop.
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.
Same comment as above.
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.
ae5de83
to
2163d07
Compare
This force-push removes unreachable infinite loops. |
CI started |
Test run: SUCCESSSummary: 11 of 11 test jobs passed |
Description
Fix the following warnings:
Pull request type
Reviewers
Release Notes