Erik de Castro Lopo
2014-Nov-30 18:04 UTC
[flac-dev] [PATCH] configure.ac: don't try to unset -g from CFLAGS
Jan Stary wrote:> > if test "x$debug" = xtrue; then > > CPPFLAGS="-DDEBUG $CPPFLAGS" > > - CFLAGS=$(echo "$CFLAGS" | sed 's/-g//') > > - CFLAGS="-g $CFLAGS" > > + CFLAGS=$(echo "-g $CFLAGS") > > Just zap the sed line, and leave > > CFLAGS="-g $CFLAGS" > > there; no need to echo anything.Thats what I did.> > else > > CPPFLAGS="-DNDEBUG $CPPFLAGS" > > - CFLAGS=$(echo "$CFLAGS" | sed 's/-O2//;s/-g//') > > + CFLAGS=$(echo "$CFLAGS" | sed 's/-O2//') > > CFLAGS="-O3 -funroll-loops $CFLAGS" > > Why is a $debug setting messing with optimization flags at all?Because -O0 makes it easier to follow the logic when actually running it in a debugger. Erik -- ---------------------------------------------------------------------- Erik de Castro Lopo http://www.mega-nerd.com/
Jan Stary
2014-Nov-30 18:30 UTC
[flac-dev] [PATCH] configure.ac: don't try to unset -g from CFLAGS
On Nov 30 10:04:18, mle+la at mega-nerd.com wrote:> Jan Stary wrote: > > > > if test "x$debug" = xtrue; then > > > CPPFLAGS="-DDEBUG $CPPFLAGS" > > > - CFLAGS=$(echo "$CFLAGS" | sed 's/-g//') > > > - CFLAGS="-g $CFLAGS" > > > + CFLAGS=$(echo "-g $CFLAGS") > > > > Just zap the sed line, and leave > > > > CFLAGS="-g $CFLAGS" > > > > there; no need to echo anything. > > Thats what I did. > > > > else > > > CPPFLAGS="-DNDEBUG $CPPFLAGS" > > > - CFLAGS=$(echo "$CFLAGS" | sed 's/-O2//;s/-g//') > > > + CFLAGS=$(echo "$CFLAGS" | sed 's/-O2//') > > > CFLAGS="-O3 -funroll-loops $CFLAGS" > > > > Why is a $debug setting messing with optimization flags at all? > > Because -O0 makes it easier to follow the logic when actually running it > in a debugger.Yes, that's for DEBUG. But why does it strip -O2 and add -O3 with NDEBUG?
Erik de Castro Lopo
2014-Nov-30 18:40 UTC
[flac-dev] [PATCH] configure.ac: don't try to unset -g from CFLAGS
Jan Stary wrote:> Yes, that's for DEBUG. > But why does it strip -O2 and add -O3 with NDEBUG?Well thats something from before I took over as FLAC maintainer. My understanding is that '-O3 -funroll-loops' gives the next encoder and/or decoder performance. Erik -- ---------------------------------------------------------------------- Erik de Castro Lopo http://www.mega-nerd.com/