This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix up CFLAGS/CXXFLAGS gcc/configure adjustment (PR other/54692)
On Tue, Sep 25, 2012 at 1:19 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> Hi!
>
> On Thu, Sep 13, 2012 at 06:24:14PM +0200, Paolo Bonzini wrote:
>> Il 13/09/2012 17:57, Jakub Jelinek ha scritto:
>> >>> > > Can we get this change in? The current state is terribly annoying.
>> >> >
>> >> > Yes, please go ahead.
>> > Here it is, bootstrapped/regtested on x86_64-linux and i686-linux,
>> > additionally tested on --disable-bootstrap tree, both by make cc1 inside of
>> > gcc subdir (no -O2) and make all-gcc above it (with -O2).
>>
>> Ok.
>
> Seems the sed command was using " *" at the end, so it happily changed
> e.g. "-Og " into just "g " instead of either keeping "-Og " in, or
> removing it altogether. This patches fixes it, now
> -Ofast, -Og, -Os, -O, -O[0-9]* are removed when followed by whitespace
> and not otherwise. Bootstrapped/regtested on x86_64-linux and i686-linux,
> ok for trunk?
Looks good to me.
Thanks,
Richard.
> 2012-09-25 Jakub Jelinek <jakub@redhat.com>
>
> PR other/54692
> * configure.ac (CFLAGS, CXXFLAGS): Remove -Ofast or -Og
> properly.
> * configure: Regenerated.
>
> --- gcc/configure.ac.jj 2012-09-13 18:29:46.000000000 +0200
> +++ gcc/configure.ac 2012-09-24 21:47:41.606278259 +0200
> @@ -296,8 +296,8 @@ AC_SUBST(OUTPUT_OPTION)
> # optimizations to be activated explicitly by the toplevel.
> case "$CC" in
> */prev-gcc/xgcc*) ;;
> - *) CFLAGS=`echo $CFLAGS | sed "s/-O[[s0-9]]* *//" `
> - CXXFLAGS=`echo $CXXFLAGS | sed "s/-O[[s0-9]]* *//" ` ;;
> + *) CFLAGS=`echo "$CFLAGS " | sed -e "s/-Ofast[[ ]]//" -e "s/-O[[gs]][[ ]]//" -e "s/-O[[0-9]]*[[ ]]//" `
> + CXXFLAGS=`echo "$CXXFLAGS " | sed -e "s/-Ofast[[ ]]//" -e "s/-O[[gs]][[ ]]//" -e "s/-O[[0-9]]*[[ ]]//" ` ;;
> esac
> AC_SUBST(CFLAGS)
> AC_SUBST(CXXFLAGS)
> --- gcc/configure.jj 2012-09-17 11:13:13.119075354 +0200
> +++ gcc/configure 2012-09-24 21:49:02.900837573 +0200
> @@ -4863,8 +4863,8 @@ fi
> # optimizations to be activated explicitly by the toplevel.
> case "$CC" in
> */prev-gcc/xgcc*) ;;
> - *) CFLAGS=`echo $CFLAGS | sed "s/-O[s0-9]* *//" `
> - CXXFLAGS=`echo $CXXFLAGS | sed "s/-O[s0-9]* *//" ` ;;
> + *) CFLAGS=`echo "$CFLAGS " | sed -e "s/-Ofast[ ]//" -e "s/-O[gs][ ]//" -e "s/-O[0-9]*[ ]//" `
> + CXXFLAGS=`echo "$CXXFLAGS " | sed -e "s/-Ofast[ ]//" -e "s/-O[gs][ ]//" -e "s/-O[0-9]*[ ]//" ` ;;
> esac
>
>
>
>
> Jakub