This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFC] Make it easy to make --disable-werror the default for binutils


Hello,

The goal of this patch is to provide an easy way to make
--disable-werror the default when building binutils, or the parts
of binutils that need to get built when building GDB. In development
mode, we want to continue making -Werror the default with GCC.
But, when making releases, I think we want to make it as easy as
possible for regular users to successfully build from sources.

GDB already has this kind of feature to turn -Werror as well as
the use of the libmcheck library. As GDB Release Manager, I take
advantage of it to turn those off after having cut the branch.
I'd like to be able to do the same for the binutils bits. And
perhaps Tristan will want to do the same for his releases too
(not sure, binutils builders might be a little savvier than GDB
builders).

This patch introduces a new file, called development.sh, which
just sets a variable called $development. In our development branches
(Eg. "master"), it's set to true. But setting it to false would allow
us to change the default behavior of various development-related
features to be turned off; in this case, it turns off the use of
-Werror by default (use --enable-werror to turn it back on).

The one part in this patch that's a little questionable is the fact
the change I made in bfd/warning.m4 assumes the bfd/ directory is
always located at ../bfd relative to the configure script that uses
it. This is the case now, and I went with the shortest route before
presenting something here. It can stay that way until we actually
face a situation where we need to lift that limitation. Or we may
want to explore alternatives now: Maybe we can use ac_top_srcdir
if that's kosher. Or else add a parameter providing the path to
the bfd dir from the configure script using AM_BINUTILS_WARNINGS.
Other ideas welcome, of course.

bfd/ChangeLog:

        * development.sh: New file.
        * warning.m4 (AM_BINUTILS_WARNINGS): Source bfd/development.sh.
        Make -Werror the default with GCC only if DEVELOPMENT is not true.
        * Makefile.am (CONFIG_STATUS_DEPENDENCIES): Add
        $(srcdir)/development.sh.
        * Makefile.in: Regenerate.
        * configure: Regenerate.

binutils/ChangeLog:

        * configure: Regenerate.

gas/ChangeLog:

        * configure: Regenerate.

gold/ChangeLog:

        * configure: Regenerate.

gprof/ChangeLog:

        * configure: Regenerate.

ld/ChangeLog:

        * configure: Regenerate.

opcodes/ChangeLog:

        * configure: Regenerate.

Tested on x86_64-linux by building two ways: One with DEVELOPMENT
set to true, and one with DEVELOPMENT set to false. In the first
case, I could see the use of -Werror, while it disappeared in
the second case.

Thoughts?

The GDB 7.8 branch is planned to be cut in a couple of weeks (Jun 2nd).
It would not be critical to have it before then, but if we can, that'd
be super.

Thanks!
-- 
Joel

---
 bfd/Makefile.am    |  3 ++-
 bfd/Makefile.in    |  3 ++-
 bfd/configure      |  7 +++++--
 bfd/development.sh | 21 +++++++++++++++++++++
 bfd/warning.m4     |  7 +++++--
 binutils/configure |  7 +++++--
 gas/configure      |  7 +++++--
 gold/configure     |  7 +++++--
 gprof/configure    |  7 +++++--
 ld/configure       | 11 +++++++----
 opcodes/configure  |  7 +++++--
 11 files changed, 67 insertions(+), 20 deletions(-)
 create mode 100644 bfd/development.sh

diff --git a/bfd/Makefile.am b/bfd/Makefile.am
index 2ba2180..595c489 100644
--- a/bfd/Makefile.am
+++ b/bfd/Makefile.am
@@ -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@
diff --git a/bfd/Makefile.in b/bfd/Makefile.in
index 8a2764d..2ea8516 100644
--- a/bfd/Makefile.in
+++ b/bfd/Makefile.in
@@ -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:
diff --git a/bfd/configure b/bfd/configure
index b4f8653..2c6bd88 100755
--- a/bfd/configure
+++ b/bfd/configure
@@ -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}" && $development; then
     ERROR_ON_WARNING=yes
 fi
 
diff --git a/bfd/development.sh b/bfd/development.sh
new file mode 100644
index 0000000..1c21efa
--- /dev/null
+++ b/bfd/development.sh
@@ -0,0 +1,21 @@
+# 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
diff --git a/bfd/warning.m4 b/bfd/warning.m4
index 28e9f8a..5029f1c 100644
--- a/bfd/warning.m4
+++ b/bfd/warning.m4
@@ -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}" && $development; then
     ERROR_ON_WARNING=yes
 fi
 
diff --git a/binutils/configure b/binutils/configure
index fcf9784..b792213 100755
--- a/binutils/configure
+++ b/binutils/configure
@@ -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}" && $development; then
     ERROR_ON_WARNING=yes
 fi
 
diff --git a/gas/configure b/gas/configure
index 2530377..27e06e8 100755
--- a/gas/configure
+++ b/gas/configure
@@ -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}" && $development; then
     ERROR_ON_WARNING=yes
 fi
 
diff --git a/gold/configure b/gold/configure
index f61307b..e737cf2 100755
--- a/gold/configure
+++ b/gold/configure
@@ -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}" && $development; then
     ERROR_ON_WARNING=yes
 fi
 
diff --git a/gprof/configure b/gprof/configure
index 5a9c81e..e7359e0 100755
--- a/gprof/configure
+++ b/gprof/configure
@@ -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}" && $development; then
     ERROR_ON_WARNING=yes
 fi
 
diff --git a/ld/configure b/ld/configure
index b6c3246..062bb1d 100755
--- a/ld/configure
+++ b/ld/configure
@@ -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}" && $development; 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
diff --git a/opcodes/configure b/opcodes/configure
index 9379bbf..e540547 100755
--- a/opcodes/configure
+++ b/opcodes/configure
@@ -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}" && $development; then
     ERROR_ON_WARNING=yes
 fi
 
-- 
1.9.1


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]