On 02/08/2024 18:22, Sven Bieg via Gcc-help wrote:
Somebody told me to put noexcept in my code, can You automate this?
Put "-fno-exceptions" in your makefile or flag settings in whatever build system you are using. It's just like any other compiler flag. (It only makes sense for C++, not C.)
From your recent posts, I suspect you are using gcc for small-systems embedded development (i.e., a microcontroller, rather than embedded Linux or similar).
Assuming that is correct, I recommend you do /not/ use "-ffreestanding". The distinction between "hosted" and "freestanding" C implementations might have made sense 50 years ago when it was written into the standards, but not now. Every microcontroller C or C++ run-time library I have seen over the decades has supported a substantial subset of the "hosted" library functions. There will be parts that are missing because they don't make sense (typical examples include locales and file I/O), but common sense should be your guide there.