hartmannathan commented on code in PR #8867: URL: https://github.com/apache/nuttx/pull/8867#discussion_r1147977064
########## libs/libc/string/lib_strsignal.c: ########## @@ -22,53 +22,24 @@ * Included Files ****************************************************************************/ +#include <errno.h> #include <signal.h> +#include <stdio.h> #include <string.h> /**************************************************************************** - * Private Data + * Pre-processor Definitions ****************************************************************************/ -/* We don't know what signals names will be assigned to which signals in - * advance and we do not want to return a volatile value. One solution is - * this silly array of useless names: - */ - -static FAR const char *g_default_sigstr[32] = -{ - "Signal 0", - "Signal 1", - "Signal 2", - "Signal 3", - "Signal 4", - "Signal 5", - "Signal 6", - "Signal 7", - "Signal 8", - "Signal 9", - "Signal 10", - "Signal 11", - "Signal 12", - "Signal 13", - "Signal 14", - "Signal 15", - "Signal 16", - "Signal 17", - "Signal 18", - "Signal 19", - "Signal 20", - "Signal 21", - "Signal 22", - "Signal 23", - "Signal 24", - "Signal 25", - "Signal 26", - "Signal 27", - "Signal 28", - "Signal 29", - "Signal 30", - "Signal 31", -}; +#ifdef CONFIG_LIBC_STRSIGNAL_SHORT +# define CASE_SIG_STR(sig, msg) \ + case (sig): \ + return (FAR char *)#sig +#else +# define CASE_SIG_STR(sig, msg) \ + case (sig): \ + return (FAR char *)(msg) +#endif Review Comment: @acassis I think the macro should work correctly, but I cannot verify it at the moment. GCC can be made to build in C89 mode with the `-std=c89` flag, in case anyone wishes to verify it. ########## libs/libc/string/Kconfig: ########## @@ -90,3 +90,29 @@ config MEMSET_64BIT efficiently. endmenu # memcpy/memset Options + +menu "signal Decode Support" + +config LIBC_STRSIGNAL + bool "Enable strsignal" + default y + ---help--- + strsignal() is useful because it decodes signal number values into a + human readable strings. But it can also require additional memory. + If this option is not selected, strsignal() will still exist in the + build but it will not decode signal number values to a specific string Review Comment: ```suggestion build but it will not decode signal number values to specific string ``` ########## libs/libc/string/Kconfig: ########## @@ -90,3 +90,29 @@ config MEMSET_64BIT efficiently. endmenu # memcpy/memset Options + +menu "signal Decode Support" + +config LIBC_STRSIGNAL + bool "Enable strsignal" + default y + ---help--- + strsignal() is useful because it decodes signal number values into a Review Comment: ```suggestion strsignal() is useful because it decodes signal number values into ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org