Workaround string-plus-int warning

The upcoming compiler warns against adding string and int:
In file included from bionic/libc/bionic/strsignal.cpp:41:
  bionic/libc/private/bionic_sigdefs.h:58:1: error: adding 'int' to a string does not append to the string [-Werror,-Wstring-plus-int]
  __BIONIC_SIGDEF(SIGWINCH,  "Window size changed")
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  bionic/libc/bionic/strsignal.cpp:40:83: note: expanded from macro '__BIONIC_SIGDEF'
  #define __BIONIC_SIGDEF(signal_number, unused) [ signal_number ] = #signal_number + 3,
                                                                     ~~~~~~~~~~~~~~~^~~

Use array indexing index to avoid this warning.

Test: m checkbuild
Change-Id: Ib5e20edbf5bac76352df0484dd233d0621beb4e9
This commit is contained in:
Yi Kong 2019-02-28 14:14:30 -08:00
parent 6b65e07809
commit 4ca9a6b576

View file

@ -37,7 +37,7 @@ const char* const sys_siglist[NSIG] = {
};
const char* const sys_signame[NSIG] = {
#define __BIONIC_SIGDEF(signal_number, unused) [ signal_number ] = #signal_number + 3,
#define __BIONIC_SIGDEF(signal_number, unused) [ signal_number ] = &(#signal_number)[3],
#include "private/bionic_sigdefs.h"
};