-
Notifications
You must be signed in to change notification settings - Fork 2k
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
cpp: Exception handling undefined #17523
Comments
@maribu As we discussed I tried to build with the |
At least for Alpine, linking against the nano variant of libstdc++ results in no exceptions being supported: And indeed,
I'm pulling the current version of It would also be sensible to prominently document that adding |
OK, with I was also trying to give |
Description
The exception handling is undefined in RIOT.
Some modules and unit tests use exceptions, e.g. the
riot::thread
implementation from thecpp11_compat
module and the according unit test.Steps to reproduce the issue
I've created a unit test to demonstrate the current undefined behavior: jenswet@7940cbe
Expected results
All boards should give the following result:
Actual results
The native board does as expected:
The
nucleo-f767zi
does the following (with bothgnu
andllvm
toolchain):With the default compiler flags there is no
-fno-exceotions
.When adding
-fno-exceotions
manually and therefore disabling exceptions the test wouldn't even compile:Exact the same behavior can be verified on
esp32-wroom-32
:The devices are powered off instead of catching the exception.
Arduino has defined behabior, when trying to compile code that uses exceptions an error occurs
error: exception handling disabled, use -fexceptions to enable
.I didn't try the other platforms because of missing hardware.
I don't want to discuss whether exceptions are useful for embedded development or not. But the behavior should be consistent. Either they should work or they should be disabled. When they do not work, they should not be used in any module imho.
Versions
It doesn't matter whether I build locally:
or with the latest
riot/riotbuild
.The text was updated successfully, but these errors were encountered: