3ef2ca
To: vim_dev@googlegroups.com
3ef2ca
Subject: Patch 7.4.048
3ef2ca
Fcc: outbox
3ef2ca
From: Bram Moolenaar <Bram@moolenaar.net>
3ef2ca
Mime-Version: 1.0
3ef2ca
Content-Type: text/plain; charset=UTF-8
3ef2ca
Content-Transfer-Encoding: 8bit
3ef2ca
------------
3ef2ca
3ef2ca
Patch 7.4.048
3ef2ca
Problem:    Recent clang version complains about -fno-strength-reduce.
3ef2ca
Solution:   Add a configure check for the clang version. (Kazunobu Kuriyama)
3ef2ca
Files:	    src/configure.in, src/auto/configure
3ef2ca
3ef2ca
3ef2ca
*** ../vim-7.4.047/src/configure.in	2013-08-04 20:00:50.000000000 +0200
3ef2ca
--- src/configure.in	2013-10-02 17:56:25.000000000 +0200
3ef2ca
***************
3ef2ca
*** 62,67 ****
3ef2ca
--- 62,90 ----
3ef2ca
    fi
3ef2ca
  fi
3ef2ca
  
3ef2ca
+ dnl clang-500.2.75 or around has abandoned -f[no-]strength-reduce and issues a
3ef2ca
+ dnl warning when that flag is passed to.  Accordingly, adjust CFLAGS based on
3ef2ca
+ dnl the version number of the clang in use.
3ef2ca
+ dnl Note that this does not work to get the version of clang 3.1 or 3.2.
3ef2ca
+ AC_MSG_CHECKING(for recent clang version)
3ef2ca
+ CLANG_VERSION_STRING=`"$CC" --version 2>/dev/null | sed  -n -e 's/^.*clang.*\([[0-9]][[0-9]]*\.[[0-9]][[0-9]]*\.[[0-9]][[0-9]]*\).*$/\1/p'`
3ef2ca
+ if test x"$CLANG_VERSION_STRING" != x"" ; then
3ef2ca
+   CLANG_MAJOR=`echo "$CLANG_VERSION_STRING" | sed -n -e 's/\([[0-9]][[0-9]]*\)\.[[0-9]][[0-9]]*\.[[0-9]][[0-9]]*/\1/p'`
3ef2ca
+   CLANG_MINOR=`echo "$CLANG_VERSION_STRING" | sed -n -e 's/[[0-9]][[0-9]]*\.\([[0-9]][[0-9]]*\)\.[[0-9]][[0-9]]*/\1/p'`
3ef2ca
+   CLANG_REVISION=`echo "$CLANG_VERSION_STRING" | sed -n -e 's/[[0-9]][[0-9]]*\.[[0-9]][[0-9]]*\.\([[0-9]][[0-9]]*\)/\1/p'`
3ef2ca
+   CLANG_VERSION=`expr $CLANG_MAJOR '*' 1000000 '+' $CLANG_MINOR '*' 1000 '+' $CLANG_REVISION`
3ef2ca
+   AC_MSG_RESULT($CLANG_VERSION)
3ef2ca
+   dnl If you find the same issue with versions earlier than 500.2.75,
3ef2ca
+   dnl change the constant 500002075 below appropriately.  To get the
3ef2ca
+   dnl integer corresponding to a version number, refer to the
3ef2ca
+   dnl definition of CLANG_VERSION above.
3ef2ca
+   if test "$CLANG_VERSION" -ge 500002075 ; then
3ef2ca
+     CFLAGS=`echo "$CFLAGS" | sed -n -e 's/-fno-strength-reduce/ /p'`
3ef2ca
+   fi
3ef2ca
+ else
3ef2ca
+   AC_MSG_RESULT(no)
3ef2ca
+ fi
3ef2ca
+ 
3ef2ca
  dnl If configure thinks we are cross compiling, there might be something
3ef2ca
  dnl wrong with the CC or CFLAGS settings, give a useful warning message
3ef2ca
  if test "$cross_compiling" = yes; then
3ef2ca
*** ../vim-7.4.047/src/auto/configure	2013-08-04 20:01:06.000000000 +0200
3ef2ca
--- src/auto/configure	2013-10-02 17:56:52.000000000 +0200
3ef2ca
***************
3ef2ca
*** 3989,3994 ****
3ef2ca
--- 3989,4012 ----
3ef2ca
    fi
3ef2ca
  fi
3ef2ca
  
3ef2ca
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for recent clang version" >&5
3ef2ca
+ $as_echo_n "checking for recent clang version... " >&6; }
3ef2ca
+ CLANG_VERSION_STRING=`"$CC" --version 2>/dev/null | sed  -n -e 's/^.*clang.*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*$/\1/p'`
3ef2ca
+ if test x"$CLANG_VERSION_STRING" != x"" ; then
3ef2ca
+   CLANG_MAJOR=`echo "$CLANG_VERSION_STRING" | sed -n -e 's/\([0-9][0-9]*\)\.[0-9][0-9]*\.[0-9][0-9]*/\1/p'`
3ef2ca
+   CLANG_MINOR=`echo "$CLANG_VERSION_STRING" | sed -n -e 's/[0-9][0-9]*\.\([0-9][0-9]*\)\.[0-9][0-9]*/\1/p'`
3ef2ca
+   CLANG_REVISION=`echo "$CLANG_VERSION_STRING" | sed -n -e 's/[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\)/\1/p'`
3ef2ca
+   CLANG_VERSION=`expr $CLANG_MAJOR '*' 1000000 '+' $CLANG_MINOR '*' 1000 '+' $CLANG_REVISION`
3ef2ca
+   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CLANG_VERSION" >&5
3ef2ca
+ $as_echo "$CLANG_VERSION" >&6; }
3ef2ca
+           if test "$CLANG_VERSION" -ge 500002075 ; then
3ef2ca
+     CFLAGS=`echo "$CFLAGS" | sed -n -e 's/-fno-strength-reduce/ /p'`
3ef2ca
+   fi
3ef2ca
+ else
3ef2ca
+   { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
3ef2ca
+ $as_echo "no" >&6; }
3ef2ca
+ fi
3ef2ca
+ 
3ef2ca
  if test "$cross_compiling" = yes; then
3ef2ca
    { $as_echo "$as_me:${as_lineno-$LINENO}: result: cannot compile a simple program; if not cross compiling check CC and CFLAGS" >&5
3ef2ca
  $as_echo "cannot compile a simple program; if not cross compiling check CC and CFLAGS" >&6; }
3ef2ca
*** ../vim-7.4.047/src/version.c	2013-10-02 16:46:23.000000000 +0200
3ef2ca
--- src/version.c	2013-10-02 17:19:31.000000000 +0200
3ef2ca
***************
3ef2ca
*** 740,741 ****
3ef2ca
--- 740,743 ----
3ef2ca
  {   /* Add new patch number below this line */
3ef2ca
+ /**/
3ef2ca
+     48,
3ef2ca
  /**/
3ef2ca
3ef2ca
-- 
3ef2ca
I have to exercise early in the morning before my brain
3ef2ca
figures out what I'm doing.
3ef2ca
3ef2ca
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
3ef2ca
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
3ef2ca
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
3ef2ca
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///