Hi,
I've implemented -Wstring-plus-int (like the one in CLANG) for GCC. I've
bootstrapped GCC with my patches and runned dejaGNU tests.
My patches are for both C and C++ (like CLANG).
Unlike CLANG, this option is not enabled by default (or GCC won't
bootstrap with -Werror).
Xi Ruoyao (5):
Move char_type_p prototype into c-common.h
c++: New warning option -Wstring-plus-int
c: New warning option -Wstring-plus-int
Document warning option -Wstring-plus-int
New tests for option -Wstring-plus-int
gcc/c-family/c-common.h | 3 +++
gcc/c-family/c-warn.c | 34 ++
gcc/c-family/c.opt| 5
gcc/c/c-typeck.c | 32 +++-
gcc/cp/call.c | 35 +++
gcc/cp/cp-tree.h | 1 -
gcc/cp/tree.c | 2 +-
gcc/doc/invoke.texi | 8 +-
gcc/testsuite/c-c++-common/Wstring-plus-int.c | 35 +++
gcc/testsuite/g++.dg/Wstring-plus-int-1.C | 20 +++
gcc/testsuite/g++.dg/Wstring-plus-int-2.C | 32
gcc/testsuite/gcc.dg/Wstring-plus-int.c | 17 +
12 files changed, 220 insertions(+), 4 deletions(-)
create mode 100644 gcc/testsuite/c-c++-common/Wstring-plus-int.c
create mode 100644 gcc/testsuite/g++.dg/Wstring-plus-int-1.C
create mode 100644 gcc/testsuite/g++.dg/Wstring-plus-int-2.C
create mode 100644 gcc/testsuite/gcc.dg/Wstring-plus-int.c
--
Xi Ruoyao
School of Aerospace Science and Technology, Xidian University