This is the mail archive of the mailing list for the newlib project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Remove noreturn attribute for __assert_func on embedded build

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
> size.
> 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.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]