This is the mail archive of the
mailing list for the newlib project.
Re: Remove noreturn attribute for __assert_func on embedded build
- From: PaweÅ <pawelwod at wp dot pl>
- To: "Schwarz, Konrad" <konrad dot schwarz at siemens dot com>, "newlib at sourceware dot org" <newlib at sourceware dot org>
- Date: Fri, 07 Feb 2014 09:46:25 +0100
- Subject: Re: Remove noreturn attribute for __assert_func on embedded build
- Authentication-results: sourceware.org; auth=none
- References: <52F33770 dot 9080208 at wp dot pl> <8A6D8E6D161CD644B982513286072E8D0B64FFB7 at DEFTHW99EJ1MSX dot ww902 dot siemens dot net>
On 06.02.2014 11:11, Schwarz, Konrad wrote:
> The whole point of the noreturn attribute is to reduce the amount of
> code produced and therefore be used only on functions that do not return.
> If your __assert_func() returns, obviously it must not be declared
> nonreturn. But this is your private change, and should not be merged
> into Newlib, because then everyone else suffers from increased code
> What is non-obvious about this?
I know that noreturn attribute is for code reduction. It is obvious that
functions like abort(), exit() should be declared with this attribute.
But (in some case, in my case embedded system) it can make coding and
debugging make more difficult. Since asserts are mostly used in debbug
bulds, there could be some way (maybe addtional __assert_func_returning
function ) to use assert() macro without noreturn attribute.
Do not take me wrong, I am not insist about this, but this was my
observation when I had to refactor whole my code to provide custom,
nonstandard assert() macro to show when my code is failing becouse stack
trace was broken.