commit:     2c9ed0ca7f95939d71b6db53760b85a72847d173
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Dec  4 20:40:19 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Dec  4 20:40:19 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=2c9ed0ca

15.0.0: rebase 28_all_drop_CFLAGS_sed.patch

It might be this can be dropped now but it's still so brittle.

Signed-off-by: Sam James <sam <AT> gentoo.org>

 15.0.0/gentoo/28_all_drop_CFLAGS_sed.patch | 48 +++++++++++++++++++++++++-----
 1 file changed, 40 insertions(+), 8 deletions(-)

diff --git a/15.0.0/gentoo/28_all_drop_CFLAGS_sed.patch 
b/15.0.0/gentoo/28_all_drop_CFLAGS_sed.patch
index fb514cb..b160c92 100644
--- a/15.0.0/gentoo/28_all_drop_CFLAGS_sed.patch
+++ b/15.0.0/gentoo/28_all_drop_CFLAGS_sed.patch
@@ -3,32 +3,64 @@ https://github.com/InBetweenNames/gentooLTO/issues/846
 https://github.com/vaeth/portage-bashrc-mv/issues/11
 --- a/gcc/configure
 +++ b/gcc/configure
-@@ -5473,13 +5473,6 @@ ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS 
$LDFLAGS conftest.$ac_ex
+@@ -5473,29 +5473,6 @@ ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS 
$LDFLAGS conftest.$ac_ex
  ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
  
  
--# Remove the -O2: for historical reasons, unless bootstrapping we prefer
+-# Remove all -O flags: for historical reasons, unless bootstrapping we prefer
 -# optimizations to be activated explicitly by the toplevel.
 -case "$CC" in
 -  */prev-gcc/xgcc*) ;;
--  *) 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]*[        ]//" ` ;;
+-  *)
+-    new_CFLAGS=
+-    for flag in $CFLAGS; do
+-      case $flag in
+-      -O*) ;;
+-      *) new_CFLAGS="$new_CFLAGS $flag" ;;
+-      esac
+-    done
+-    CFLAGS=$new_CFLAGS
+-    new_CXXFLAGS=
+-    for flag in $CXXFLAGS; do
+-      case $flag in
+-      -O*) ;;
+-      *) new_CXXFLAGS="$new_CXXFLAGS $flag" ;;
+-      esac
+-    done
+-    CXXFLAGS=$new_CXXFLAGS
+-    ;;
 -esac
  
  
  
 --- a/gcc/configure.ac
 +++ b/gcc/configure.ac
-@@ -463,13 +463,6 @@ ACX_PROG_GDC([-I"$srcdir"/d])
+@@ -463,29 +463,6 @@ ACX_PROG_GDC([-I"$srcdir"/d])
  # Do configure tests with the C++ compiler, since that's what we build with.
  AC_LANG(C++)
  
--# Remove the -O2: for historical reasons, unless bootstrapping we prefer
+-# Remove all -O flags: for historical reasons, unless bootstrapping we prefer
 -# optimizations to be activated explicitly by the toplevel.
 -case "$CC" in
 -  */prev-gcc/xgcc*) ;;
--  *) 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]]*[[  ]]//" ` ;;
+-  *)
+-    new_CFLAGS=
+-    for flag in $CFLAGS; do
+-      case $flag in
+-      -O*) ;;
+-      *) new_CFLAGS="$new_CFLAGS $flag" ;;
+-      esac
+-    done
+-    CFLAGS=$new_CFLAGS
+-    new_CXXFLAGS=
+-    for flag in $CXXFLAGS; do
+-      case $flag in
+-      -O*) ;;
+-      *) new_CXXFLAGS="$new_CXXFLAGS $flag" ;;
+-      esac
+-    done
+-    CXXFLAGS=$new_CXXFLAGS
+-    ;;
 -esac
  AC_SUBST(CFLAGS)
  AC_SUBST(CXXFLAGS)

Reply via email to