From: Trevor Saunders Date: Sun, 20 Mar 2016 01:48:35 +0000 (-0400) Subject: enable -Wwrite-strings for gas X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6757cf57697d30c73f4e3f314883ad2d8999eac6;p=binutils-gdb.git enable -Wwrite-strings for gas We add a new AC_SUBST to warning.m4 so that the test if the warning is supported is centralized, but the warning can be enabled per directory. binutils/ChangeLog: 2016-03-31 Trevor Saunders * configure: Regenerate. gprof/ChangeLog: 2016-03-31 Trevor Saunders * configure: Regenerate. ld/ChangeLog: 2016-03-31 Trevor Saunders * configure: Regenerate. opcodes/ChangeLog: 2016-03-31 Trevor Saunders * configure: Regenerate. bfd/ChangeLog: 2016-03-31 Trevor Saunders * configure: Regenerate. * warning.m4: Add WARN_WRITE_STRINGS AC_SUBST. gold/ChangeLog: 2016-03-31 Trevor Saunders * configure: Regenerate. gas/ChangeLog: 2016-03-31 Trevor Saunders * Makefile.am: Add WARN_WRITE_STRINGS to WARN_CFLAGS. * Makefile.in: Regenerate. * configure: Likewise. --- diff --git a/bfd/configure b/bfd/configure index d03b9962bde..51581baddf0 100755 --- a/bfd/configure +++ b/bfd/configure @@ -657,6 +657,7 @@ GENINSRC_NEVER_TRUE MAINT MAINTAINER_MODE_FALSE MAINTAINER_MODE_TRUE +WARN_WRITE_STRINGS NO_WERROR WARN_CFLAGS REPORT_BUGS_TEXI @@ -11421,7 +11422,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11424 "configure" +#line 11425 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11527,7 +11528,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11530 "configure" +#line 11531 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -12254,6 +12255,20 @@ fi rm -f conftest* +# Set WARN_WRITE_STRINGS if the compiler supports -Wwrite-strings. +WARN_WRITE_STRINGS="" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +__GNUC__ +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "^[0-3]$" >/dev/null 2>&1; then : + +else + WARN_WRITE_STRINGS="-Wwrite-strings" +fi +rm -f conftest* + # Check whether --enable-werror was given. if test "${enable_werror+set}" = set; then : @@ -12314,6 +12329,7 @@ fi + ac_config_headers="$ac_config_headers config.h:config.in" diff --git a/bfd/warning.m4 b/bfd/warning.m4 index 028d0792027..4c5b55d1f8c 100644 --- a/bfd/warning.m4 +++ b/bfd/warning.m4 @@ -30,6 +30,9 @@ AC_EGREP_CPP([^[0-3]$],[__GNUC__],,GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wshadow") # Add -Wstack-usage if the compiler is a sufficiently recent version of GCC. AC_EGREP_CPP([^[0-4]$],[__GNUC__],,GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wstack-usage=262144") +# Set WARN_WRITE_STRINGS if the compiler supports -Wwrite-strings. +WARN_WRITE_STRINGS="" +AC_EGREP_CPP([^[0-3]$],[__GNUC__],,WARN_WRITE_STRINGS="-Wwrite-strings") AC_ARG_ENABLE(werror, [ --enable-werror treat compile warnings as errors], @@ -84,4 +87,5 @@ fi AC_SUBST(WARN_CFLAGS) AC_SUBST(NO_WERROR) + AC_SUBST(WARN_WRITE_STRINGS) ]) diff --git a/binutils/configure b/binutils/configure index 6ff47084b5c..0e88476d0d9 100755 --- a/binutils/configure +++ b/binutils/configure @@ -650,6 +650,7 @@ LEX_OUTPUT_ROOT LEX YFLAGS YACC +WARN_WRITE_STRINGS NO_WERROR WARN_CFLAGS OTOOL64 @@ -11221,7 +11222,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11224 "configure" +#line 11225 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11327,7 +11328,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11330 "configure" +#line 11331 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11972,6 +11973,20 @@ fi rm -f conftest* +# Set WARN_WRITE_STRINGS if the compiler supports -Wwrite-strings. +WARN_WRITE_STRINGS="" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +__GNUC__ +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "^[0-3]$" >/dev/null 2>&1; then : + +else + WARN_WRITE_STRINGS="-Wwrite-strings" +fi +rm -f conftest* + # Check whether --enable-werror was given. if test "${enable_werror+set}" = set; then : @@ -12032,6 +12047,7 @@ fi + ac_config_headers="$ac_config_headers config.h:config.in" diff --git a/gas/Makefile.am b/gas/Makefile.am index 36ef7ed6704..596e469eadc 100644 --- a/gas/Makefile.am +++ b/gas/Makefile.am @@ -37,7 +37,7 @@ LEX = `if [ -f ../flex/flex ] ; then echo ../flex/flex ; else echo @LEX@ ; fi` am__skiplex = am__skipyacc = -WARN_CFLAGS = @WARN_CFLAGS@ +WARN_CFLAGS = @WARN_CFLAGS@ @WARN_WRITE_STRINGS@ NO_WERROR = @NO_WERROR@ AM_CFLAGS = $(WARN_CFLAGS) $(ZLIBINC) diff --git a/gas/Makefile.in b/gas/Makefile.in index c407d726ba5..0d1065fbf26 100644 --- a/gas/Makefile.in +++ b/gas/Makefile.in @@ -232,7 +232,7 @@ SHELL = @SHELL@ STRIP = @STRIP@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ -WARN_CFLAGS = @WARN_CFLAGS@ +WARN_CFLAGS = @WARN_CFLAGS@ @WARN_WRITE_STRINGS@ XGETTEXT = @XGETTEXT@ YACC = `if [ -f ../bison/bison ] ; then echo ../bison/bison -y -L../bison/bison ; else echo @YACC@ ; fi` YFLAGS = @YFLAGS@ diff --git a/gas/configure b/gas/configure index 11e6ed436a1..131dd2d22f4 100755 --- a/gas/configure +++ b/gas/configure @@ -640,6 +640,7 @@ target_cpu_type extra_objects cgen_cpu_prefix GDBINIT +WARN_WRITE_STRINGS NO_WERROR WARN_CFLAGS OTOOL64 @@ -10978,7 +10979,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 10981 "configure" +#line 10982 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11084,7 +11085,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11087 "configure" +#line 11088 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11745,6 +11746,20 @@ fi rm -f conftest* +# Set WARN_WRITE_STRINGS if the compiler supports -Wwrite-strings. +WARN_WRITE_STRINGS="" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +__GNUC__ +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "^[0-3]$" >/dev/null 2>&1; then : + +else + WARN_WRITE_STRINGS="-Wwrite-strings" +fi +rm -f conftest* + # Check whether --enable-werror was given. if test "${enable_werror+set}" = set; then : @@ -11805,6 +11820,7 @@ fi + # Generate a header file ac_config_headers="$ac_config_headers config.h:config.in" diff --git a/gold/configure b/gold/configure index 7fe771c60d1..d0cfc957c2c 100755 --- a/gold/configure +++ b/gold/configure @@ -607,6 +607,7 @@ LFS_CFLAGS GOLD_LDADD GOLD_LDFLAGS WARN_CXXFLAGS +WARN_WRITE_STRINGS NO_WERROR WARN_CFLAGS IFUNC_STATIC_FALSE @@ -6718,6 +6719,20 @@ fi rm -f conftest* +# Set WARN_WRITE_STRINGS if the compiler supports -Wwrite-strings. +WARN_WRITE_STRINGS="" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +__GNUC__ +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "^[0-3]$" >/dev/null 2>&1; then : + +else + WARN_WRITE_STRINGS="-Wwrite-strings" +fi +rm -f conftest* + # Check whether --enable-werror was given. if test "${enable_werror+set}" = set; then : @@ -6778,6 +6793,7 @@ fi + WARN_CXXFLAGS=`echo ${WARN_CFLAGS} | sed -e 's/-Wstrict-prototypes//' -e 's/-Wmissing-prototypes//' -e 's/-Wshadow//'` diff --git a/gprof/configure b/gprof/configure index 77bfe7febfb..5b8fbd7898f 100755 --- a/gprof/configure +++ b/gprof/configure @@ -602,6 +602,7 @@ ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS LIBOBJS +WARN_WRITE_STRINGS NO_WERROR WARN_CFLAGS GENINSRC_NEVER_FALSE @@ -10897,7 +10898,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 10900 "configure" +#line 10901 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11003,7 +11004,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11006 "configure" +#line 11007 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -12128,6 +12129,20 @@ fi rm -f conftest* +# Set WARN_WRITE_STRINGS if the compiler supports -Wwrite-strings. +WARN_WRITE_STRINGS="" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +__GNUC__ +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "^[0-3]$" >/dev/null 2>&1; then : + +else + WARN_WRITE_STRINGS="-Wwrite-strings" +fi +rm -f conftest* + # Check whether --enable-werror was given. if test "${enable_werror+set}" = set; then : @@ -12193,6 +12208,7 @@ fi + ac_config_files="$ac_config_files Makefile po/Makefile.in:po/Make-in" cat >confcache <<\_ACEOF diff --git a/ld/configure b/ld/configure index 572faa7d18f..24f9316155c 100755 --- a/ld/configure +++ b/ld/configure @@ -644,6 +644,7 @@ INCINTL LIBINTL_DEP LIBINTL USE_NLS +WARN_WRITE_STRINGS NO_WERROR WARN_CFLAGS installed_linker @@ -11716,7 +11717,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11719 "configure" +#line 11720 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11822,7 +11823,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11825 "configure" +#line 11826 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -15571,6 +15572,20 @@ fi rm -f conftest* +# Set WARN_WRITE_STRINGS if the compiler supports -Wwrite-strings. +WARN_WRITE_STRINGS="" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +__GNUC__ +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "^[0-3]$" >/dev/null 2>&1; then : + +else + WARN_WRITE_STRINGS="-Wwrite-strings" +fi +rm -f conftest* + # Check whether --enable-werror was given. if test "${enable_werror+set}" = set; then : @@ -15632,6 +15647,7 @@ fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for LC_MESSAGES" >&5 $as_echo_n "checking for LC_MESSAGES... " >&6; } if test "${am_cv_val_LC_MESSAGES+set}" = set; then : diff --git a/opcodes/configure b/opcodes/configure index da03f50817c..747c939c2ac 100755 --- a/opcodes/configure +++ b/opcodes/configure @@ -641,6 +641,7 @@ MAINT MAINTAINER_MODE_FALSE MAINTAINER_MODE_TRUE NO_WMISSING_FIELD_INITIALIZERS +WARN_WRITE_STRINGS NO_WERROR WARN_CFLAGS OTOOL64 @@ -11146,7 +11147,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11149 "configure" +#line 11150 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11252,7 +11253,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11255 "configure" +#line 11256 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11535,6 +11536,20 @@ fi rm -f conftest* +# Set WARN_WRITE_STRINGS if the compiler supports -Wwrite-strings. +WARN_WRITE_STRINGS="" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +__GNUC__ +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "^[0-3]$" >/dev/null 2>&1; then : + +else + WARN_WRITE_STRINGS="-Wwrite-strings" +fi +rm -f conftest* + # Check whether --enable-werror was given. if test "${enable_werror+set}" = set; then : @@ -11594,6 +11609,7 @@ fi + ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'