libgloss/arm/libcfunc.c: alarm [PATCH]
Fri Jul 15 08:20:00 GMT 2005
>>This matters because the current implementation of _exit() ignores its
>>argument and always performs a SWI with ADP_StoppedApplicationExit, so
>>the user (or simulator) will never know that an abort has occurred.
> I didn't notice that the RDI implementation behaves differently than
> the RDP implementation of _exit, which does pass its argument on to
> the swi. In the RDP case, calling _exit explicitly makes it more
> apparent that abort is implemented in terms of _exit.
OK - well could you fix up the RDI case then please ?
>>>+ return errno = ENOSYS, -1;
>>Ugg! There is no need for clever coding here. Use two statements not a
>>comma, it is much clearer that way. (There are several places where
> I think of setting errno and returning -1 as a single conceptual
> operation, which is why I like the look of the above idiom, but fair
Well I guess we could argue about the exact significance of errno and
return values but it just felt wrong to me. Thanks for agreeing to
>>"(void)sig" ? What on earth ?
> Casting to (void) is legal C and is a common idiom  to explicitly
> point out that the coder does not intend to use the value of any
> particular expression, not just an unused identifier.
Well my bad. I did not know this. Thanks very much for pointing it out.
One thing though - since we are already using __attribute__((weak)) why
not also use __attribute__((unused)) ? (Or the ATTRIBUTE_UNUSED macro
from ansidecl.h). I am in two minds about whether this would be a good
idea though. On the one hand this macro is used in lots of other places
in other projects (gcc, binutils) but on the other hand it is less
portable and makes the source code bulkier. (Although it would reduce
the number of lines). I guess that there really is no good reason to
change over to using it, so please ignore this whole ramble. :)
More information about the Newlib