[RFA,v2] Make it easy to make --disable-werror the default for both binutils and gdb
Commit Message
Hello,
This is V2 of the patch series. Hopefully, I incorporated all comments
made so far. The changes compared to the previous version are:
. Use "-a" instead of "&&" in the test expression; (H-P)
. Fix the little thinko in one of bfd's ChangeLog (H-P)
. Replace comment for "developement = " in development.sh
to be completely neutral, just explaining the general
intent of that variable (H-P and Alan)
. Transition the gdb and gdbserver to using bfd's development.sh
instead of keeping a separate one (Tom)
. Adjusted various Makefiles to register the dependency on
this file, so that a change there triggers a rebuild
with the expected options (Joel).
Note that gold/Makefile.am had no CONFIG_STATUS_DEPENDENCIES,
so I added it, but only added developement.sh. It would be
surprised if there weren't any other dependencies to be added
there, but that should be done independently of this patch,
so not done here.
The patch was again tested various different ways, with
developement both true and false, using both fresh builds
as well as rebuilds after modifying development.sh.
OK to push?
Thanks!
Comments
On Tue, Jun 03, 2014 at 08:57:10AM -0700, Joel Brobecker wrote:
> OK to push?
Looks OK to me.
On Tue, 3 Jun 2014, Joel Brobecker wrote:
> This is V2 of the patch series. Hopefully, I incorporated all comments
> made so far. The changes compared to the previous version are:
>
> . Use "-a" instead of "&&" in the test expression; (H-P)
I think Hans-Peter's suggestion was the other way round, its "&&" that is
portable while "-a" is likely not to work with non-GNU `test' or with
plain Bourne shells (where it is a builtin). This is what the autoconf
manual has to say about it in its portability section:
`test'
The `test' program is the way to perform many file and string
tests. It is often invoked by the alternate name `[', but using
that name in Autoconf code is asking for trouble since it is an M4
quote character.
The `-a', `-o', `(', and `)' operands are not portable and should
be avoided. Thus, portable uses of `test' should never have more
than four arguments, and scripts should use shell constructs like
`&&' and `||' instead. If you combine `&&' and `||' in the same
statement, keep in mind that they have equal precedence, so it is
often better to parenthesize even when this is redundant. For
example:
# Not portable:
test "X$a" = "X$b" -a \
'(' "X$c" != "X$d" -o "X$e" = "X$f" ')'
# Portable:
test "X$a" = "X$b" &&
{ test "X$c" != "X$d" || test "X$e" = "X$f"; }
Maciej
> > . Use "-a" instead of "&&" in the test expression; (H-P)
>
> I think Hans-Peter's suggestion was the other way round, its "&&" that is
> portable while "-a" is likely not to work with non-GNU `test' or with
> plain Bourne shells (where it is a builtin). This is what the autoconf
> manual has to say about it in its portability section:
Hmmm, I see. Thanks for theh clarification.
I propose the following: Keep the patch I propose as is for now, as it
does not make things worse, and also keep things consistent. And then
follow that up with a patch which switches the operators, all of them,
to using &&.
On Wed, 4 Jun 2014, Joel Brobecker wrote:
> > I think Hans-Peter's suggestion was the other way round, its "&&" that is
> > portable while "-a" is likely not to work with non-GNU `test' or with
> > plain Bourne shells (where it is a builtin). This is what the autoconf
> > manual has to say about it in its portability section:
>
> Hmmm, I see. Thanks for theh clarification.
>
> I propose the following: Keep the patch I propose as is for now, as it
> does not make things worse, and also keep things consistent. And then
> follow that up with a patch which switches the operators, all of them,
> to using &&.
Well, if that's a preexisting problem (I wasn't aware of that), then
sure, I have no objections.
Maciej
>>>>> "Joel" == Joel Brobecker <brobecker@adacore.com> writes:
Joel> This is V2 of the patch series. Hopefully, I incorporated all comments
Joel> made so far. The changes compared to the previous version are:
Thanks Joel.
FWIW the gdb changes looked fine to me.
Tom
Thanks, Alan and Tom.
I just pushed the patch to master.
Regarding the "-a" vs "&&", I am happy making the change, if you would
like me to. It seems from the text quoted by Maciej that "&&" might
be more portable, but since we've been using "-a" without issue (to
my knowledge) I am tempted to wait until a portability issue actually
shows up. The workaround in case of problem is fairly easy - use
another shell like bash, for instance.
@@ -741,7 +741,8 @@ OPTIONAL_BACKENDS_CFILES = \
CONFIG_STATUS_DEPENDENCIES = \
$(srcdir)/configure.in \
$(srcdir)/config.bfd \
- $(srcdir)/configure.host
+ $(srcdir)/configure.host \
+ $(srcdir)/development.sh
# These are defined by configure.in:
WORDSIZE = @wordsize@
@@ -1045,7 +1045,8 @@ OPTIONAL_BACKENDS_CFILES = \
CONFIG_STATUS_DEPENDENCIES = \
$(srcdir)/configure.in \
$(srcdir)/config.bfd \
- $(srcdir)/configure.host
+ $(srcdir)/configure.host \
+ $(srcdir)/development.sh
# These are defined by configure.in:
@@ -12158,6 +12158,9 @@ fi
+# Set the 'development' global.
+. $srcdir/../bfd/development.sh
+
GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
@@ -12192,8 +12195,8 @@ case "${host}" in
*) ;;
esac
-# Enable -Werror by default when using gcc
-if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then
+# Enable -Werror by default when using gcc. Turn it off for releases.
+if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" -a "$development" = true ; then
ERROR_ON_WARNING=yes
fi
new file mode 100644
@@ -0,0 +1,19 @@
+# Copyright (C) 2012-2014 Free Software Foundation, Inc.
+#
+# This file is part of GDB.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Controls whether to enable development-mode features by default.
+development=true
@@ -18,6 +18,9 @@ dnl <http://www.gnu.org/licenses/>.
dnl
AC_DEFUN([AM_BINUTILS_WARNINGS],[
+# Set the 'development' global.
+. $srcdir/../bfd/development.sh
+
GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
AC_EGREP_CPP([^[0-3]$],[__GNUC__],,GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wshadow")
@@ -39,8 +42,8 @@ case "${host}" in
*) ;;
esac
-# Enable -Werror by default when using gcc
-if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then
+# Enable -Werror by default when using gcc. Turn it off for releases.
+if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" -a "$development" = true ; then
ERROR_ON_WARNING=yes
fi
@@ -514,7 +514,8 @@ all: info
# We extract version from bfd/configure.in, make sure to rerun configure
# when BFD's version changes.
-CONFIG_STATUS_DEPENDENCIES = $(BFDDIR)/configure.in
+CONFIG_STATUS_DEPENDENCIES = $(BFDDIR)/configure.in \
+ $(BFDDIR)/development.sh
DISTCLEANFILES = sysroff.c sysroff.h site.exp site.bak embedspu
@@ -616,7 +616,9 @@ EXTRA_DIST = arparse.c arparse.h arlex.c nlmheader.c sysinfo.c sysinfo.h \
# We extract version from bfd/configure.in, make sure to rerun configure
# when BFD's version changes.
-CONFIG_STATUS_DEPENDENCIES = $(BFDDIR)/configure.in
+CONFIG_STATUS_DEPENDENCIES = $(BFDDIR)/configure.in \
+ $(BFDDIR)/development.sh
+
DISTCLEANFILES = sysroff.c sysroff.h site.exp site.bak embedspu
MOSTLYCLEANFILES = sysinfo$(EXEEXT_FOR_BUILD) bin2c$(EXEEXT_FOR_BUILD) \
binutils.log binutils.sum abcdefgh*
@@ -11592,6 +11592,9 @@ _ACEOF
+# Set the 'development' global.
+. $srcdir/../bfd/development.sh
+
GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
@@ -11626,8 +11629,8 @@ case "${host}" in
*) ;;
esac
-# Enable -Werror by default when using gcc
-if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then
+# Enable -Werror by default when using gcc. Turn it off for releases.
+if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" -a "$development" = true ; then
ERROR_ON_WARNING=yes
fi
@@ -693,4 +693,6 @@ de-stage3:
- (cd stage3 ; rm -f as$(EXEEXT) ; mv -f * ..)
- rmdir stage3
-CONFIG_STATUS_DEPENDENCIES = $(BFDDIR)/configure.in $(srcdir)/configure.tgt
+CONFIG_STATUS_DEPENDENCIES = $(BFDDIR)/configure.in \
+ $(srcdir)/configure.tgt \
+ $(BFDDIR)/development.sh
@@ -677,7 +677,10 @@ MOSTLYCLEANFILES = $(STAGESTUFF) core \
testsuite/site.exp site.bak site.exp stage stage1 stage2
against = stage2
-CONFIG_STATUS_DEPENDENCIES = $(BFDDIR)/configure.in $(srcdir)/configure.tgt
+CONFIG_STATUS_DEPENDENCIES = $(BFDDIR)/configure.in \
+ $(srcdir)/configure.tgt \
+ $(BFDDIR)/development.sh
+
all: config.h
$(MAKE) $(AM_MAKEFLAGS) all-recursive
@@ -11575,6 +11575,9 @@ fi
using_cgen=no
+# Set the 'development' global.
+. $srcdir/../bfd/development.sh
+
GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
@@ -11609,8 +11612,8 @@ case "${host}" in
*) ;;
esac
-# Enable -Werror by default when using gcc
-if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then
+# Enable -Werror by default when using gcc. Turn it off for releases.
+if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" -a "$development" = true ; then
ERROR_ON_WARNING=yes
fi
@@ -1474,7 +1474,7 @@ stamp-h: $(srcdir)/config.in config.status
CONFIG_LINKS= \
$(SHELL) config.status
-config.status: $(srcdir)/configure configure.tgt configure.host development.sh
+config.status: $(srcdir)/configure configure.tgt configure.host ../bfd/development.sh
$(SHELL) config.status --recheck
ACLOCAL = aclocal
@@ -2714,7 +2714,7 @@ fi
# Set the 'development' global.
-. $srcdir/development.sh
+. $srcdir/../bfd/development.sh
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
@@ -24,7 +24,7 @@ AC_CONFIG_HEADER(config.h:config.in)
AM_MAINTAINER_MODE
# Set the 'development' global.
-. $srcdir/development.sh
+. $srcdir/../bfd/development.sh
AC_PROG_CC
AC_USE_SYSTEM_EXTENSIONS
deleted file mode 100644
@@ -1,21 +0,0 @@
-# Copyright (C) 2012-2014 Free Software Foundation, Inc.
-#
-# This file is part of GDB.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-# Set to 'true' for development snapshots, 'false' for releases and
-# pre-releases. When true, provide more thorough testing with
-# -lmcheck.
-development=true
@@ -390,7 +390,7 @@ $(GNULIB_BUILDDIR)/Makefile: $(srcdir)/../gnulib/Makefile.in config.status
CONFIG_LINKS= \
$(SHELL) config.status
-config.status: configure configure.srv $(srcdir)/../development.sh
+config.status: configure configure.srv $(srcdir)/../../bfd/development.sh
$(SHELL) ./config.status --recheck
# automatic rebuilding in automake-generated Makefiles requires
@@ -4324,7 +4324,7 @@ fi
# Set the 'development' global.
-. $srcdir/../development.sh
+. $srcdir/../../bfd/development.sh
# Enable -lmcheck by default (it provides cheap-enough memory
# mangling), but turn it off for releases.
@@ -41,7 +41,7 @@ AC_HEADER_STDC
AC_FUNC_ALLOCA
# Set the 'development' global.
-. $srcdir/../development.sh
+. $srcdir/../../bfd/development.sh
# Enable -lmcheck by default (it provides cheap-enough memory
# mangling), but turn it off for releases.
@@ -197,6 +197,8 @@ dwp_LDADD = libgold.a $(LIBIBERTY) $(GOLD_LDADD) $(LIBINTL) $(THREADSLIB) \
$(LIBDL)
dwp_LDFLAGS = $(GOLD_LDFLAGS)
+CONFIG_STATUS_DEPENDENCIES = $(srcdir)/../bfd/development.sh
+
# Use an explicit dependency for the bison generated header file.
expression.$(OBJEXT): yyscript.h
script-sections.$(OBJEXT): yyscript.h
@@ -564,6 +564,7 @@ dwp_LDADD = libgold.a $(LIBIBERTY) $(GOLD_LDADD) $(LIBINTL) $(THREADSLIB) \
$(LIBDL)
dwp_LDFLAGS = $(GOLD_LDFLAGS)
+CONFIG_STATUS_DEPENDENCIES = $(srcdir)/../bfd/development.sh
POTFILES = $(CCFILES) $(HFILES) $(TARGETSOURCES)
@GCC_TRUE@@NATIVE_LINKER_TRUE@ld1_SOURCES = $(sources_var)
@GCC_TRUE@@NATIVE_LINKER_TRUE@ld1_DEPENDENCIES = $(deps_var) gcctestdir1/ld
@@ -6630,6 +6630,9 @@ fi
+# Set the 'development' global.
+. $srcdir/../bfd/development.sh
+
GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
@@ -6664,8 +6667,8 @@ case "${host}" in
*) ;;
esac
-# Enable -Werror by default when using gcc
-if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then
+# Enable -Werror by default when using gcc. Turn it off for releases.
+if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" -a "$development" = true ; then
ERROR_ON_WARNING=yes
fi
@@ -60,7 +60,8 @@ diststuff: $(BUILT_SOURCES) info $(man_MANS)
# We extract version from bfd/configure.in, make sure to rerun configure
# when BFD's version changes.
-CONFIG_STATUS_DEPENDENCIES = $(BFDDIR)/configure.in
+CONFIG_STATUS_DEPENDENCIES = $(BFDDIR)/configure.in \
+ $(BFDDIR)/development.sh
# This empty rule is a hack against gmake patched by Apple.
%.o:%.m
@@ -325,7 +325,9 @@ EXTRA_DIST = $(BUILT_SOURCES) bbconv.pl $(man_MANS)
# We extract version from bfd/configure.in, make sure to rerun configure
# when BFD's version changes.
-CONFIG_STATUS_DEPENDENCIES = $(BFDDIR)/configure.in
+CONFIG_STATUS_DEPENDENCIES = $(BFDDIR)/configure.in \
+ $(BFDDIR)/development.sh
+
POTFILES = $(sources) $(noinst_HEADERS)
MANCONF = -Dman
TEXI2POD = perl $(srcdir)/../etc/texi2pod.pl $(AM_MAKEINFOFLAGS)
@@ -12004,6 +12004,9 @@ fi
+# Set the 'development' global.
+. $srcdir/../bfd/development.sh
+
GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
@@ -12038,8 +12041,8 @@ case "${host}" in
*) ;;
esac
-# Enable -Werror by default when using gcc
-if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then
+# Enable -Werror by default when using gcc. Turn it off for releases.
+if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" -a "$development" = true ; then
ERROR_ON_WARNING=yes
fi
@@ -2057,7 +2057,8 @@ MAINTAINERCLEANFILES = configdoc.texi ld.1
# We want to reconfigure if configure.host or configure.tgt changes. We
# extract version from bfd/configure.in, so we must depend on that also.
CONFIG_STATUS_DEPENDENCIES = $(srcdir)/configure.host $(srcdir)/configure.tgt \
- $(srcdir)/../bfd/configure.in
+ $(srcdir)/../bfd/configure.in \
+ $(srcdir)/../bfd/development.sh
MOSTLYCLEANFILES = $(STAGESTUFF) ld1$(EXEEXT) ld2$(EXEEXT) ld3$(EXEEXT) \
ldemul-list.h crtbegin.@OBJEXT@ crtend.@OBJEXT@ ld.log ld.sum
@@ -888,7 +888,8 @@ MAINTAINERCLEANFILES = configdoc.texi ld.1 ld.info
# We want to reconfigure if configure.host or configure.tgt changes. We
# extract version from bfd/configure.in, so we must depend on that also.
CONFIG_STATUS_DEPENDENCIES = $(srcdir)/configure.host $(srcdir)/configure.tgt \
- $(srcdir)/../bfd/configure.in
+ $(srcdir)/../bfd/configure.in \
+ $(srcdir)/../bfd/development.sh
MOSTLYCLEANFILES = $(STAGESTUFF) ld1$(EXEEXT) ld2$(EXEEXT) ld3$(EXEEXT) \
ldemul-list.h crtbegin.@OBJEXT@ crtend.@OBJEXT@ ld.log ld.sum
@@ -4642,6 +4642,9 @@ $as_echo "$ac_cv_path_EGREP" >&6; }
+# Set the 'development' global.
+. $srcdir/../bfd/development.sh
+
GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
@@ -4676,8 +4679,8 @@ case "${host}" in
*) ;;
esac
-# Enable -Werror by default when using gcc
-if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then
+# Enable -Werror by default when using gcc. Turn it off for releases.
+if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" -a "$development" = true ; then
ERROR_ON_WARNING=yes
fi
@@ -12193,7 +12196,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12196 "configure"
+#line 12199 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12299,7 +12302,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12302 "configure"
+#line 12305 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -296,7 +296,8 @@ OFILES = @BFD_MACHINES@
# We should reconfigure whenever bfd/configure.in changes, because
# that's where the version number in Makefile comes from.
-CONFIG_STATUS_DEPENDENCIES = $(BFDDIR)/configure.in
+CONFIG_STATUS_DEPENDENCIES = $(BFDDIR)/configure.in \
+ $(BFDDIR)/development.sh
AM_CPPFLAGS = -I. -I$(srcdir) -I../bfd -I$(INCDIR) -I$(BFDDIR) @HDEFINES@ @INCINTL@
@@ -569,7 +569,9 @@ OFILES = @BFD_MACHINES@
# We should reconfigure whenever bfd/configure.in changes, because
# that's where the version number in Makefile comes from.
-CONFIG_STATUS_DEPENDENCIES = $(BFDDIR)/configure.in
+CONFIG_STATUS_DEPENDENCIES = $(BFDDIR)/configure.in \
+ $(BFDDIR)/development.sh
+
AM_CPPFLAGS = -I. -I$(srcdir) -I../bfd -I$(INCDIR) -I$(BFDDIR) @HDEFINES@ @INCINTL@
libopcodes_la_SOURCES = dis-buf.c disassemble.c dis-init.c
# It's desirable to list ../bfd/libbfd.la in DEPENDENCIES and LIBADD.
@@ -11504,6 +11504,9 @@ esac
fi
+# Set the 'development' global.
+. $srcdir/../bfd/development.sh
+
GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
@@ -11538,8 +11541,8 @@ case "${host}" in
*) ;;
esac
-# Enable -Werror by default when using gcc
-if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then
+# Enable -Werror by default when using gcc. Turn it off for releases.
+if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" -a "$development" = true ; then
ERROR_ON_WARNING=yes
fi