]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.0.1517: MacOS: configure removes -O2 from $CFLAGS v9.0.1517
authorRose <83477269+AtariDreams@users.noreply.github.com>
Sat, 6 May 2023 17:07:14 +0000 (18:07 +0100)
committerBram Moolenaar <Bram@vim.org>
Sat, 6 May 2023 17:07:14 +0000 (18:07 +0100)
Problem:    MacOS: configure removes -O2 from $CFLAGS.
Solution:   Only adjust $CFLAGS for gcc. (closes #12351)

src/auto/configure
src/configure.ac
src/version.c

index 28eb7f33830eb236d256b65a2f51a6be4a98fe2b..cdd00df00ff0d93d414acf54b692cd8c8cf275f0 100755 (executable)
@@ -4477,12 +4477,14 @@ if test -z "$CFLAGS"; then
   CFLAGS="-O"
   test "$GCC" = yes && CFLAGS="-O2 -fno-strength-reduce -Wall -Wno-deprecated-declarations"
 fi
+
 if test "$GCC" = yes; then
     gccversion=`$CC -dumpversion`
   if test "x$gccversion" = "x"; then
         gccversion=`$CC --version | sed -e '2,$d' -e 's/darwin.//' -e 's/^[^0-9]*\([0-9]\.[0-9.]*\).*$/\1/g'`
   fi
-    if test "$gccversion" = "3.0.1" -o "$gccversion" = "3.0.2" -o "$gccversion" = "4.0.1"; then
+
+          if test "$gccversion" = "3.0.1" -o "$gccversion" = "3.0.2" -o "$gccversion" = "4.0.1"; then
     echo 'GCC [34].0.[12] has a bug in the optimizer, disabling "-O#"'
     CFLAGS=`echo "$CFLAGS" | sed 's/-O[23456789]/-O/'`
   else
@@ -4777,11 +4779,6 @@ rm -f core conftest.err conftest.$ac_objext \
       with_x=no
      fi
   fi
-
-        if test "$MACARCH" = "intel" -o "$MACARCH" = "both"; then
-    CFLAGS=`echo "$CFLAGS" | sed 's/-O[23456789]/-Oz/'`
-  fi
-
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
index 6936ac9b7b14f4dc1ef4192fc46bbe41d03c3044..d56001f9b5cd8ab3055781feb33114f720601f07 100644 (file)
@@ -93,14 +93,19 @@ if test -z "$CFLAGS"; then
   CFLAGS="-O"
   test "$GCC" = yes && CFLAGS="-O2 -fno-strength-reduce -Wall -Wno-deprecated-declarations"
 fi
+
 if test "$GCC" = yes; then
-  dnl method that should work for nearly all versions
+  dnl Method that should work for nearly all gcc versions.
   gccversion=`$CC -dumpversion`
   if test "x$gccversion" = "x"; then
     dnl old method; fall-back for when -dumpversion doesn't work
     gccversion=`$CC --version | sed -e '2,$d' -e 's/darwin.//' -e 's/^[[^0-9]]*\([[0-9]]\.[[0-9.]]*\).*$/\1/g'`
   fi
-  dnl version 4.0.1 was reported to cause trouble on Macintosh by Marcin Dalecki
+
+  dnl Gcc version 4.0.1 was reported to cause trouble on Macintosh by Marcin
+  dnl Dalecki.  For Mac with Intel the symptom reported is: malloc() reports
+  dnl double free.  This happens in expand_filename(), because the optimizer
+  dnl swaps two blocks of code, both using "repl", that can't be swapped.
   if test "$gccversion" = "3.0.1" -o "$gccversion" = "3.0.2" -o "$gccversion" = "4.0.1"; then
     echo 'GCC [[34]].0.[[12]] has a bug in the optimizer, disabling "-O#"'
     CFLAGS=`echo "$CFLAGS" | sed 's/-O[[23456789]]/-O/'`
@@ -299,14 +304,6 @@ if test "$vim_cv_uname_output" = Darwin; then
       with_x=no
      fi
   fi
-
-  dnl Avoid a bug with -O2 with gcc 4.0.1.  Symptom: malloc() reports double
-  dnl free.  This happens in expand_filename(), because the optimizer swaps
-  dnl two blocks of code, both using "repl", that can't be swapped.
-  if test "$MACARCH" = "intel" -o "$MACARCH" = "both"; then
-    CFLAGS=`echo "$CFLAGS" | sed 's/-O[[23456789]]/-Oz/'`
-  fi
-
 else
   AC_MSG_RESULT(no)
 fi
index 260afa8eca4e60758eada3b97f0f324a96dea512..dc17976de8809a6e4955633dab11e68e3320b627 100644 (file)
@@ -695,6 +695,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1517,
 /**/
     1516,
 /**/