Patchwork [1/2,pr53679] libgo: add a --enable-werror configure flag

login
register
mail settings
Submitter Mike Frysinger
Date Dec. 23, 2012, 11:30 p.m.
Message ID <1356305421-13533-1-git-send-email-vapier@gentoo.org>
Download mbox | patch
Permalink /patch/207995/
State New
Headers show

Comments

Mike Frysinger - Dec. 23, 2012, 11:30 p.m.
URL: http://gcc.gnu.org/PR53679
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
 libgo/configure    | 15 ++++++++++++---
 libgo/configure.ac |  7 +++++--
 2 files changed, 17 insertions(+), 5 deletions(-)
Ian Taylor - Jan. 15, 2013, 2:56 p.m.
On Sun, Dec 23, 2012 at 3:30 PM, Mike Frysinger <vapier@gentoo.org> wrote:

> diff --git a/libgo/configure.ac b/libgo/configure.ac
> index 8cde50b..63d8cbc 100644
> --- a/libgo/configure.ac
> +++ b/libgo/configure.ac
> @@ -50,8 +50,11 @@ AC_PROG_AWK
>  WARN_FLAGS='-Wall -Wextra -Wwrite-strings -Wcast-qual'
>  AC_SUBST(WARN_FLAGS)
>
> -dnl FIXME: This should be controlled by --enable-maintainer-mode.
> -WERROR="-Werror"
> +AC_ARG_ENABLE(werror, [AS_HELP_STRING([--enable-werror],
> +                                      [turns on -Werror @<:@default=yes@:>@])])
> +if test "x$enable_werror" != "xno"; then
> +  WERROR="-Werror"
> +fi
>  AC_SUBST(WERROR)
>
>  glibgo_toolexecdir=no


Can you say something about when you needed this?  What errors were you seeing?

Ian
Mike Frysinger - Jan. 15, 2013, 5:45 p.m.
On Tuesday 15 January 2013 09:56:06 Ian Lance Taylor wrote:
> On Sun, Dec 23, 2012 at 3:30 PM, Mike Frysinger <vapier@gentoo.org> wrote:
> > diff --git a/libgo/configure.ac b/libgo/configure.ac
> > index 8cde50b..63d8cbc 100644
> > --- a/libgo/configure.ac
> > +++ b/libgo/configure.ac
> > @@ -50,8 +50,11 @@ AC_PROG_AWK
> > 
> >  WARN_FLAGS='-Wall -Wextra -Wwrite-strings -Wcast-qual'
> >  AC_SUBST(WARN_FLAGS)
> > 
> > -dnl FIXME: This should be controlled by --enable-maintainer-mode.
> > -WERROR="-Werror"
> > +AC_ARG_ENABLE(werror, [AS_HELP_STRING([--enable-werror],
> > +                                      [turns on -Werror
> > @<:@default=yes@:>@])]) +if test "x$enable_werror" != "xno"; then
> > +  WERROR="-Werror"
> > +fi
> > 
> >  AC_SUBST(WERROR)
> >  
> >  glibgo_toolexecdir=no
> 
> Can you say something about when you needed this?  What errors were you
> seeing?

the referenced PR describes one:
/build/src/gcc-4.7.1/libgo/runtime/print.c: In function 'gwrite':
/build/src/gcc-4.7.1/libgo/runtime/print.c:20:3: error: ignoring return value
of 'write', declared with attribute warn_unused_result [-Werror=unused-result]
cc1: all warnings being treated as errors

this bites distros that enable security settings by default (such as fortify 
and ssp).  but ignoring even that, i don't believe releases should build all 
the time with -Werror -- i'm fine with defaulting to on as long as there is a 
configure flag to turn it off which is what this does like is already handled in 
much of the sourceware tree.  -Werror is great for development, but sucks when 
deployed on actual systems.  the assumptions made at time of checkin rarely 
stay constant forever (in this case, a changing lib C can easily break it).
-mike
Ian Taylor - Jan. 26, 2013, 12:13 a.m.
On Tue, Jan 15, 2013 at 9:45 AM, Mike Frysinger <vapier@gentoo.org> wrote:
> On Tuesday 15 January 2013 09:56:06 Ian Lance Taylor wrote:
>> On Sun, Dec 23, 2012 at 3:30 PM, Mike Frysinger <vapier@gentoo.org> wrote:
>> > diff --git a/libgo/configure.ac b/libgo/configure.ac
>> > index 8cde50b..63d8cbc 100644
>> > --- a/libgo/configure.ac
>> > +++ b/libgo/configure.ac
>> > @@ -50,8 +50,11 @@ AC_PROG_AWK
>> >
>> >  WARN_FLAGS='-Wall -Wextra -Wwrite-strings -Wcast-qual'
>> >  AC_SUBST(WARN_FLAGS)
>> >
>> > -dnl FIXME: This should be controlled by --enable-maintainer-mode.
>> > -WERROR="-Werror"
>> > +AC_ARG_ENABLE(werror, [AS_HELP_STRING([--enable-werror],
>> > +                                      [turns on -Werror
>> > @<:@default=yes@:>@])]) +if test "x$enable_werror" != "xno"; then
>> > +  WERROR="-Werror"
>> > +fi
>> >
>> >  AC_SUBST(WERROR)
>> >
>> >  glibgo_toolexecdir=no
>>
>> Can you say something about when you needed this?  What errors were you
>> seeing?
>
> the referenced PR describes one:
> /build/src/gcc-4.7.1/libgo/runtime/print.c: In function 'gwrite':
> /build/src/gcc-4.7.1/libgo/runtime/print.c:20:3: error: ignoring return value
> of 'write', declared with attribute warn_unused_result [-Werror=unused-result]
> cc1: all warnings being treated as errors
>
> this bites distros that enable security settings by default (such as fortify
> and ssp).  but ignoring even that, i don't believe releases should build all
> the time with -Werror -- i'm fine with defaulting to on as long as there is a
> configure flag to turn it off which is what this does like is already handled in
> much of the sourceware tree.  -Werror is great for development, but sucks when
> deployed on actual systems.  the assumptions made at time of checkin rarely
> stay constant forever (in this case, a changing lib C can easily break it).
> -mike

Thanks for the explanation.

Committed to mainline.

Ian
Mike Frysinger - Jan. 26, 2013, 3:20 a.m.
On Friday 25 January 2013 19:13:55 Ian Lance Taylor wrote:
> On Tue, Jan 15, 2013 at 9:45 AM, Mike Frysinger wrote:
> > On Tuesday 15 January 2013 09:56:06 Ian Lance Taylor wrote:
> >> On Sun, Dec 23, 2012 at 3:30 PM, Mike Frysinger wrote:
> >> > diff --git a/libgo/configure.ac b/libgo/configure.ac
> >> > index 8cde50b..63d8cbc 100644
> >> > --- a/libgo/configure.ac
> >> > +++ b/libgo/configure.ac
> >> > @@ -50,8 +50,11 @@ AC_PROG_AWK
> >> > 
> >> >  WARN_FLAGS='-Wall -Wextra -Wwrite-strings -Wcast-qual'
> >> >  AC_SUBST(WARN_FLAGS)
> >> > 
> >> > -dnl FIXME: This should be controlled by --enable-maintainer-mode.
> >> > -WERROR="-Werror"
> >> > +AC_ARG_ENABLE(werror, [AS_HELP_STRING([--enable-werror],
> >> > +                                      [turns on -Werror
> >> > @<:@default=yes@:>@])]) +if test "x$enable_werror" != "xno"; then
> >> > +  WERROR="-Werror"
> >> > +fi
> >> > 
> >> >  AC_SUBST(WERROR)
> >> >  
> >> >  glibgo_toolexecdir=no
> >> 
> >> Can you say something about when you needed this?  What errors were you
> >> seeing?
> > 
> > the referenced PR describes one:
> > /build/src/gcc-4.7.1/libgo/runtime/print.c: In function 'gwrite':
> > /build/src/gcc-4.7.1/libgo/runtime/print.c:20:3: error: ignoring return
> > value of 'write', declared with attribute warn_unused_result
> > [-Werror=unused-result] cc1: all warnings being treated as errors
> > 
> > this bites distros that enable security settings by default (such as
> > fortify and ssp).  but ignoring even that, i don't believe releases
> > should build all the time with -Werror -- i'm fine with defaulting to on
> > as long as there is a configure flag to turn it off which is what this
> > does like is already handled in much of the sourceware tree.  -Werror is
> > great for development, but sucks when deployed on actual systems.  the
> > assumptions made at time of checkin rarely stay constant forever (in
> > this case, a changing lib C can easily break it). -mike
> 
> Thanks for the explanation.
> 
> Committed to mainline.

thanks!  mind if i commit it to gcc-4.6 and gcc-4.7 too ?
-mike
Ian Taylor - Jan. 27, 2013, 2:40 a.m.
On Fri, Jan 25, 2013 at 7:20 PM, Mike Frysinger <vapier@gentoo.org> wrote:
> On Friday 25 January 2013 19:13:55 Ian Lance Taylor wrote:
>> On Tue, Jan 15, 2013 at 9:45 AM, Mike Frysinger wrote:
>> > On Tuesday 15 January 2013 09:56:06 Ian Lance Taylor wrote:
>> >> On Sun, Dec 23, 2012 at 3:30 PM, Mike Frysinger wrote:
>> >> > diff --git a/libgo/configure.ac b/libgo/configure.ac
>> >> > index 8cde50b..63d8cbc 100644
>> >> > --- a/libgo/configure.ac
>> >> > +++ b/libgo/configure.ac
>> >> > @@ -50,8 +50,11 @@ AC_PROG_AWK
>> >> >
>> >> >  WARN_FLAGS='-Wall -Wextra -Wwrite-strings -Wcast-qual'
>> >> >  AC_SUBST(WARN_FLAGS)
>> >> >
>> >> > -dnl FIXME: This should be controlled by --enable-maintainer-mode.
>> >> > -WERROR="-Werror"
>> >> > +AC_ARG_ENABLE(werror, [AS_HELP_STRING([--enable-werror],
>> >> > +                                      [turns on -Werror
>> >> > @<:@default=yes@:>@])]) +if test "x$enable_werror" != "xno"; then
>> >> > +  WERROR="-Werror"
>> >> > +fi
>> >> >
>> >> >  AC_SUBST(WERROR)
>> >> >
>> >> >  glibgo_toolexecdir=no
>> >>
>> >> Can you say something about when you needed this?  What errors were you
>> >> seeing?
>> >
>> > the referenced PR describes one:
>> > /build/src/gcc-4.7.1/libgo/runtime/print.c: In function 'gwrite':
>> > /build/src/gcc-4.7.1/libgo/runtime/print.c:20:3: error: ignoring return
>> > value of 'write', declared with attribute warn_unused_result
>> > [-Werror=unused-result] cc1: all warnings being treated as errors
>> >
>> > this bites distros that enable security settings by default (such as
>> > fortify and ssp).  but ignoring even that, i don't believe releases
>> > should build all the time with -Werror -- i'm fine with defaulting to on
>> > as long as there is a configure flag to turn it off which is what this
>> > does like is already handled in much of the sourceware tree.  -Werror is
>> > great for development, but sucks when deployed on actual systems.  the
>> > assumptions made at time of checkin rarely stay constant forever (in
>> > this case, a changing lib C can easily break it). -mike
>>
>> Thanks for the explanation.
>>
>> Committed to mainline.
>
> thanks!  mind if i commit it to gcc-4.6 and gcc-4.7 too ?

I certainly don't mind.  You should probably get agreement from the
release managers although this seems safe enough.

Ian
Mike Frysinger - March 5, 2013, 12:11 a.m.
On Saturday 26 January 2013 21:40:44 Ian Lance Taylor wrote:
> On Fri, Jan 25, 2013 at 7:20 PM, Mike Frysinger wrote:
> > On Friday 25 January 2013 19:13:55 Ian Lance Taylor wrote:
> >> On Tue, Jan 15, 2013 at 9:45 AM, Mike Frysinger wrote:
> >> > On Tuesday 15 January 2013 09:56:06 Ian Lance Taylor wrote:
> >> >> On Sun, Dec 23, 2012 at 3:30 PM, Mike Frysinger wrote:
> >> >> > diff --git a/libgo/configure.ac b/libgo/configure.ac
> >> >> > index 8cde50b..63d8cbc 100644
> >> >> > --- a/libgo/configure.ac
> >> >> > +++ b/libgo/configure.ac
> >> >> > @@ -50,8 +50,11 @@ AC_PROG_AWK
> >> >> > 
> >> >> >  WARN_FLAGS='-Wall -Wextra -Wwrite-strings -Wcast-qual'
> >> >> >  AC_SUBST(WARN_FLAGS)
> >> >> > 
> >> >> > -dnl FIXME: This should be controlled by --enable-maintainer-mode.
> >> >> > -WERROR="-Werror"
> >> >> > +AC_ARG_ENABLE(werror, [AS_HELP_STRING([--enable-werror],
> >> >> > +                                      [turns on -Werror
> >> >> > @<:@default=yes@:>@])]) +if test "x$enable_werror" != "xno"; then
> >> >> > +  WERROR="-Werror"
> >> >> > +fi
> >> >> > 
> >> >> >  AC_SUBST(WERROR)
> >> >> >  
> >> >> >  glibgo_toolexecdir=no
> >> >> 
> >> >> Can you say something about when you needed this?  What errors were
> >> >> you seeing?
> >> > 
> >> > the referenced PR describes one:
> >> > /build/src/gcc-4.7.1/libgo/runtime/print.c: In function 'gwrite':
> >> > /build/src/gcc-4.7.1/libgo/runtime/print.c:20:3: error: ignoring
> >> > return value of 'write', declared with attribute warn_unused_result
> >> > [-Werror=unused-result] cc1: all warnings being treated as errors
> >> > 
> >> > this bites distros that enable security settings by default (such as
> >> > fortify and ssp).  but ignoring even that, i don't believe releases
> >> > should build all the time with -Werror -- i'm fine with defaulting to
> >> > on as long as there is a configure flag to turn it off which is what
> >> > this does like is already handled in much of the sourceware tree. 
> >> > -Werror is great for development, but sucks when deployed on actual
> >> > systems.  the assumptions made at time of checkin rarely stay
> >> > constant forever (in this case, a changing lib C can easily break
> >> > it). -mike
> >> 
> >> Thanks for the explanation.
> >> 
> >> Committed to mainline.
> > 
> > thanks!  mind if i commit it to gcc-4.6 and gcc-4.7 too ?
> 
> I certainly don't mind.  You should probably get agreement from the
> release managers although this seems safe enough.

can you approve merges to the google branches ?  that's really where i want 
this :).
-mike
Ian Taylor - March 5, 2013, 5:31 a.m.
On Mon, Mar 4, 2013 at 4:11 PM, Mike Frysinger <vapier@gentoo.org> wrote:
> On Saturday 26 January 2013 21:40:44 Ian Lance Taylor wrote:
>> On Fri, Jan 25, 2013 at 7:20 PM, Mike Frysinger wrote:
>> > On Friday 25 January 2013 19:13:55 Ian Lance Taylor wrote:
>> >> On Tue, Jan 15, 2013 at 9:45 AM, Mike Frysinger wrote:
>> >> > On Tuesday 15 January 2013 09:56:06 Ian Lance Taylor wrote:
>> >> >> On Sun, Dec 23, 2012 at 3:30 PM, Mike Frysinger wrote:
>> >> >> > diff --git a/libgo/configure.ac b/libgo/configure.ac
>> >> >> > index 8cde50b..63d8cbc 100644
>> >> >> > --- a/libgo/configure.ac
>> >> >> > +++ b/libgo/configure.ac
>> >> >> > @@ -50,8 +50,11 @@ AC_PROG_AWK
>> >> >> >
>> >> >> >  WARN_FLAGS='-Wall -Wextra -Wwrite-strings -Wcast-qual'
>> >> >> >  AC_SUBST(WARN_FLAGS)
>> >> >> >
>> >> >> > -dnl FIXME: This should be controlled by --enable-maintainer-mode.
>> >> >> > -WERROR="-Werror"
>> >> >> > +AC_ARG_ENABLE(werror, [AS_HELP_STRING([--enable-werror],
>> >> >> > +                                      [turns on -Werror
>> >> >> > @<:@default=yes@:>@])]) +if test "x$enable_werror" != "xno"; then
>> >> >> > +  WERROR="-Werror"
>> >> >> > +fi
>> >> >> >
>> >> >> >  AC_SUBST(WERROR)
>> >> >> >
>> >> >> >  glibgo_toolexecdir=no
>> >> >>
>> >> >> Can you say something about when you needed this?  What errors were
>> >> >> you seeing?
>> >> >
>> >> > the referenced PR describes one:
>> >> > /build/src/gcc-4.7.1/libgo/runtime/print.c: In function 'gwrite':
>> >> > /build/src/gcc-4.7.1/libgo/runtime/print.c:20:3: error: ignoring
>> >> > return value of 'write', declared with attribute warn_unused_result
>> >> > [-Werror=unused-result] cc1: all warnings being treated as errors
>> >> >
>> >> > this bites distros that enable security settings by default (such as
>> >> > fortify and ssp).  but ignoring even that, i don't believe releases
>> >> > should build all the time with -Werror -- i'm fine with defaulting to
>> >> > on as long as there is a configure flag to turn it off which is what
>> >> > this does like is already handled in much of the sourceware tree.
>> >> > -Werror is great for development, but sucks when deployed on actual
>> >> > systems.  the assumptions made at time of checkin rarely stay
>> >> > constant forever (in this case, a changing lib C can easily break
>> >> > it). -mike
>> >>
>> >> Thanks for the explanation.
>> >>
>> >> Committed to mainline.
>> >
>> > thanks!  mind if i commit it to gcc-4.6 and gcc-4.7 too ?
>>
>> I certainly don't mind.  You should probably get agreement from the
>> release managers although this seems safe enough.
>
> can you approve merges to the google branches ?  that's really where i want
> this :).

No, I don't work on those branches.  Sorry.

CC'ed dnovillo@google.com.

Ian
Diego Novillo - March 6, 2013, 3:49 p.m.
On Tue, Mar 5, 2013 at 12:31 AM, Ian Lance Taylor <iant@google.com> wrote:
>
> On Mon, Mar 4, 2013 at 4:11 PM, Mike Frysinger <vapier@gentoo.org> wrote:
> > On Saturday 26 January 2013 21:40:44 Ian Lance Taylor wrote:
> >> On Fri, Jan 25, 2013 at 7:20 PM, Mike Frysinger wrote:
> >> > On Friday 25 January 2013 19:13:55 Ian Lance Taylor wrote:
> >> >> On Tue, Jan 15, 2013 at 9:45 AM, Mike Frysinger wrote:
> >> >> > On Tuesday 15 January 2013 09:56:06 Ian Lance Taylor wrote:
> >> >> >> On Sun, Dec 23, 2012 at 3:30 PM, Mike Frysinger wrote:
> >> >> >> > diff --git a/libgo/configure.ac b/libgo/configure.ac
> >> >> >> > index 8cde50b..63d8cbc 100644
> >> >> >> > --- a/libgo/configure.ac
> >> >> >> > +++ b/libgo/configure.ac
> >> >> >> > @@ -50,8 +50,11 @@ AC_PROG_AWK
> >> >> >> >
> >> >> >> >  WARN_FLAGS='-Wall -Wextra -Wwrite-strings -Wcast-qual'
> >> >> >> >  AC_SUBST(WARN_FLAGS)
> >> >> >> >
> >> >> >> > -dnl FIXME: This should be controlled by
> >> >> >> > --enable-maintainer-mode.
> >> >> >> > -WERROR="-Werror"
> >> >> >> > +AC_ARG_ENABLE(werror, [AS_HELP_STRING([--enable-werror],
> >> >> >> > +                                      [turns on -Werror
> >> >> >> > @<:@default=yes@:>@])]) +if test "x$enable_werror" != "xno";
> >> >> >> > then
> >> >> >> > +  WERROR="-Werror"
> >> >> >> > +fi
> >> >> >> >
> >> >> >> >  AC_SUBST(WERROR)
> >> >> >> >
> >> >> >> >  glibgo_toolexecdir=no
> >> >> >>
> >> >> >> Can you say something about when you needed this?  What errors
> >> >> >> were
> >> >> >> you seeing?
> >> >> >
> >> >> > the referenced PR describes one:
> >> >> > /build/src/gcc-4.7.1/libgo/runtime/print.c: In function 'gwrite':
> >> >> > /build/src/gcc-4.7.1/libgo/runtime/print.c:20:3: error: ignoring
> >> >> > return value of 'write', declared with attribute
> >> >> > warn_unused_result
> >> >> > [-Werror=unused-result] cc1: all warnings being treated as errors
> >> >> >
> >> >> > this bites distros that enable security settings by default (such
> >> >> > as
> >> >> > fortify and ssp).  but ignoring even that, i don't believe
> >> >> > releases
> >> >> > should build all the time with -Werror -- i'm fine with defaulting
> >> >> > to
> >> >> > on as long as there is a configure flag to turn it off which is
> >> >> > what
> >> >> > this does like is already handled in much of the sourceware tree.
> >> >> > -Werror is great for development, but sucks when deployed on
> >> >> > actual
> >> >> > systems.  the assumptions made at time of checkin rarely stay
> >> >> > constant forever (in this case, a changing lib C can easily break
> >> >> > it). -mike
> >> >>
> >> >> Thanks for the explanation.
> >> >>
> >> >> Committed to mainline.
> >> >
> >> > thanks!  mind if i commit it to gcc-4.6 and gcc-4.7 too ?
> >>
> >> I certainly don't mind.  You should probably get agreement from the
> >> release managers although this seems safe enough.
> >
> > can you approve merges to the google branches ?  that's really where i
> > want
> > this :).
>
> No, I don't work on those branches.  Sorry.

I committed this patch to google/gcc-4_7 rev 196494.  Feel free to
commit to google/gcc-4_6 if you need to.


Diego.
Mike Frysinger - March 7, 2013, 7:01 a.m.
On Wednesday 06 March 2013 10:49:23 Diego Novillo wrote:
> On Tue, Mar 5, 2013 at 12:31 AM, Ian Lance Taylor <iant@google.com> wrote:
> > On Mon, Mar 4, 2013 at 4:11 PM, Mike Frysinger <vapier@gentoo.org> wrote:
> > > On Saturday 26 January 2013 21:40:44 Ian Lance Taylor wrote:
> > >> On Fri, Jan 25, 2013 at 7:20 PM, Mike Frysinger wrote:
> > >> > On Friday 25 January 2013 19:13:55 Ian Lance Taylor wrote:
> > >> >> On Tue, Jan 15, 2013 at 9:45 AM, Mike Frysinger wrote:
> > >> >> > On Tuesday 15 January 2013 09:56:06 Ian Lance Taylor wrote:
> > >> >> >> On Sun, Dec 23, 2012 at 3:30 PM, Mike Frysinger wrote:
> > >> >> >> > diff --git a/libgo/configure.ac b/libgo/configure.ac
> > >> >> >> > index 8cde50b..63d8cbc 100644
> > >> >> >> > --- a/libgo/configure.ac
> > >> >> >> > +++ b/libgo/configure.ac
> > >> >> >> > @@ -50,8 +50,11 @@ AC_PROG_AWK
> > >> >> >> > 
> > >> >> >> >  WARN_FLAGS='-Wall -Wextra -Wwrite-strings -Wcast-qual'
> > >> >> >> >  AC_SUBST(WARN_FLAGS)
> > >> >> >> > 
> > >> >> >> > -dnl FIXME: This should be controlled by
> > >> >> >> > --enable-maintainer-mode.
> > >> >> >> > -WERROR="-Werror"
> > >> >> >> > +AC_ARG_ENABLE(werror, [AS_HELP_STRING([--enable-werror],
> > >> >> >> > +                                      [turns on -Werror
> > >> >> >> > @<:@default=yes@:>@])]) +if test "x$enable_werror" != "xno";
> > >> >> >> > then
> > >> >> >> > +  WERROR="-Werror"
> > >> >> >> > +fi
> > >> >> >> > 
> > >> >> >> >  AC_SUBST(WERROR)
> > >> >> >> >  
> > >> >> >> >  glibgo_toolexecdir=no
> > >> >> >> 
> > >> >> >> Can you say something about when you needed this?  What errors
> > >> >> >> were
> > >> >> >> you seeing?
> > >> >> > 
> > >> >> > the referenced PR describes one:
> > >> >> > /build/src/gcc-4.7.1/libgo/runtime/print.c: In function 'gwrite':
> > >> >> > /build/src/gcc-4.7.1/libgo/runtime/print.c:20:3: error: ignoring
> > >> >> > return value of 'write', declared with attribute
> > >> >> > warn_unused_result
> > >> >> > [-Werror=unused-result] cc1: all warnings being treated as errors
> > >> >> > 
> > >> >> > this bites distros that enable security settings by default (such
> > >> >> > as
> > >> >> > fortify and ssp).  but ignoring even that, i don't believe
> > >> >> > releases
> > >> >> > should build all the time with -Werror -- i'm fine with
> > >> >> > defaulting to
> > >> >> > on as long as there is a configure flag to turn it off which is
> > >> >> > what
> > >> >> > this does like is already handled in much of the sourceware tree.
> > >> >> > -Werror is great for development, but sucks when deployed on
> > >> >> > actual
> > >> >> > systems.  the assumptions made at time of checkin rarely stay
> > >> >> > constant forever (in this case, a changing lib C can easily break
> > >> >> > it). -mike
> > >> >> 
> > >> >> Thanks for the explanation.
> > >> >> 
> > >> >> Committed to mainline.
> > >> > 
> > >> > thanks!  mind if i commit it to gcc-4.6 and gcc-4.7 too ?
> > >> 
> > >> I certainly don't mind.  You should probably get agreement from the
> > >> release managers although this seems safe enough.
> > > 
> > > can you approve merges to the google branches ?  that's really where i
> > > want
> > > this :).
> > 
> > No, I don't work on those branches.  Sorry.
> 
> I committed this patch to google/gcc-4_7 rev 196494.  Feel free to
> commit to google/gcc-4_6 if you need to.

nope, we just need it in 4.7, thanks!
-mike

Patch

diff --git a/libgo/configure b/libgo/configure
index 04fa89d..49cc4a9 100755
--- a/libgo/configure
+++ b/libgo/configure
@@ -809,6 +809,7 @@  enable_static
 with_pic
 enable_fast_install
 enable_libtool_lock
+enable_werror
 enable_version_specific_runtime_libs
 with_libffi
 with_system_libunwind
@@ -1449,6 +1450,7 @@  Optional Features:
   --enable-fast-install[=PKGS]
                           optimize for fast installation [default=yes]
   --disable-libtool-lock  avoid locking (might break parallel builds)
+  --enable-werror         turns on -Werror [default=yes]
   --enable-version-specific-runtime-libs
                           Specify that runtime libraries should be installed
                           in a compiler-specific directory
@@ -11102,7 +11104,7 @@  else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11105 "configure"
+#line 11107 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11208,7 +11210,7 @@  else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11211 "configure"
+#line 11213 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -13386,7 +13388,14 @@  done
 WARN_FLAGS='-Wall -Wextra -Wwrite-strings -Wcast-qual'
 
 
-WERROR="-Werror"
+# Check whether --enable-werror was given.
+if test "${enable_werror+set}" = set; then :
+  enableval=$enable_werror;
+fi
+
+if test "x$enable_werror" != "xno"; then
+  WERROR="-Werror"
+fi
 
 
 glibgo_toolexecdir=no
diff --git a/libgo/configure.ac b/libgo/configure.ac
index 8cde50b..63d8cbc 100644
--- a/libgo/configure.ac
+++ b/libgo/configure.ac
@@ -50,8 +50,11 @@  AC_PROG_AWK
 WARN_FLAGS='-Wall -Wextra -Wwrite-strings -Wcast-qual'
 AC_SUBST(WARN_FLAGS)
 
-dnl FIXME: This should be controlled by --enable-maintainer-mode.
-WERROR="-Werror"
+AC_ARG_ENABLE(werror, [AS_HELP_STRING([--enable-werror],
+                                      [turns on -Werror @<:@default=yes@:>@])])
+if test "x$enable_werror" != "xno"; then
+  WERROR="-Werror"
+fi
 AC_SUBST(WERROR)
 
 glibgo_toolexecdir=no