[ovs-dev] [PATCH] configure: Omit -O2 from $CFLAGS when configuring with --enable-coverage.
Ben Pfaff
blp at nicira.com
Fri Jan 2 23:06:53 UTC 2015
I think it'd be best to do that as a separate patch, though, since I
would want to get a review from the Windows developers to make sure
that whatever we do doesn't screw up something on their end.
On Fri, Jan 02, 2015 at 02:52:47PM -0800, Ben Pfaff wrote:
> Hmm. Currently --with-debug has no effect at all outside of Windows.
> I agree, it would make sense to do the same thing.
>
> On Fri, Jan 02, 2015 at 02:50:58PM -0800, Madhu Challa wrote:
> > It would be nice if we have the same behavior for --with-debug as well.
> > Today the debug build adds -g -O2, I manually change it to O0 since some of
> > the local variables get optimized out otherwise.
> >
> > Thanks.
> >
> > On Fri, Jan 2, 2015 at 2:39 PM, Ben Pfaff <blp at nicira.com> wrote:
> >
> > > CFLAGS follows OVS_CFLAGS in the compiler command line, and should, so that
> > > the user can override any automatically determined compiler options. That
> > > means that the -O0 that the code here added to OVS_CFLAGS didn't really
> > > have any effect since CFLAGS by default includes "-O2". However, we do
> > > really want to disable optimizations (because the coverage reports are hard
> > > to interpret with optimizations), so this commit changes the configure
> > > script to edit out -O2 from CFLAGS, leaving any other default or
> > > user-specified options.
> > >
> > > Reported-by: Mijo Safradin <mijo at linux.vnet.ibm.com>
> > > Signed-off-by: Ben Pfaff <blp at nicira.com>
> > > ---
> > > m4/openvswitch.m4 | 16 ++++++++++++++--
> > > 1 file changed, 14 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/m4/openvswitch.m4 b/m4/openvswitch.m4
> > > index 3f0d097..ba3ed9b 100644
> > > --- a/m4/openvswitch.m4
> > > +++ b/m4/openvswitch.m4
> > > @@ -1,6 +1,6 @@
> > > # -*- autoconf -*-
> > >
> > > -# Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014 Nicira, Inc.
> > > +# Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Nicira,
> > > Inc.
> > > #
> > > # Licensed under the Apache License, Version 2.0 (the "License");
> > > # you may not use this file except in compliance with the License.
> > > @@ -30,7 +30,19 @@ AC_DEFUN([OVS_CHECK_COVERAGE],
> > > esac],
> > > [coverage=false])
> > > if $coverage; then
> > > - OVS_CFLAGS="$OVS_CFLAGS -O0 --coverage"
> > > + # Autoconf by default puts "-g -O2" in CFLAGS. We need to remove
> > > the -O2
> > > + # option for coverage to be useful. This does it without otherwise
> > > + # interfering with anything that the user might have put there.
> > > + old_CFLAGS=$CFLAGS
> > > + CFLAGS=
> > > + for option in $old_CFLAGS; do
> > > + case $option in
> > > + (-O2) ;;
> > > + (*) CFLAGS="$CFLAGS $option" ;;
> > > + esac
> > > + done
> > > +
> > > + OVS_CFLAGS="$OVS_CFLAGS --coverage"
> > > OVS_LDFLAGS="$OVS_LDFLAGS --coverage"
> > > fi])
> > >
> > > --
> > > 1.7.10.4
> > >
> > > _______________________________________________
> > > dev mailing list
> > > dev at openvswitch.org
> > > http://openvswitch.org/mailman/listinfo/dev
> > >
More information about the dev
mailing list