From 4ca9a6b5766a64b5a2e8972f1b059a578d8388cd Mon Sep 17 00:00:00 2001 From: Yi Kong Date: Thu, 28 Feb 2019 14:14:30 -0800 Subject: [PATCH] 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 --- libc/bionic/strsignal.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libc/bionic/strsignal.cpp b/libc/bionic/strsignal.cpp index 563743157..05d349861 100644 --- a/libc/bionic/strsignal.cpp +++ b/libc/bionic/strsignal.cpp @@ -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" };