Patch 8.0.1709
Problem:    Some non-C89 code may slip through.
Solution:   Enforce C89 in configure. Fix detected problems. (James McCoy,
            closes #2735)
Files:      src/channel.c, src/configure.ac, src/auto/configure,
            src/gui_gtk_x11.c, src/if_python3.c


*** ../vim-8.0.1708/src/channel.c       2018-04-10 15:59:04.291392629 +0200
--- src/channel.c       2018-04-14 13:59:53.395200113 +0200
***************
*** 672,680 ****
      {
        char            *p;
  
!       /* When using host->h_addr directly ubsan warns for it to not be
!        * aligned.  First copy the pointer to aviod that. */
!       memcpy(&p, &host->h_addr, sizeof(p));
        memcpy((char *)&server.sin_addr, p, host->h_length);
      }
  
--- 672,680 ----
      {
        char            *p;
  
!       /* When using host->h_addr_list[0] directly ubsan warns for it to not
!        * be aligned.  First copy the pointer to avoid that. */
!       memcpy(&p, &host->h_addr_list[0], sizeof(p));
        memcpy((char *)&server.sin_addr, p, host->h_length);
      }
  
*** ../vim-8.0.1708/src/configure.ac    2018-04-11 22:19:30.620025674 +0200
--- src/configure.ac    2018-04-14 14:24:32.917580431 +0200
***************
*** 11,17 ****
  AC_PROG_MAKE_SET
  
  dnl Checks for programs.
! AC_PROG_CC            dnl required by almost everything
  AC_PROG_CPP           dnl required by header file checks
  AC_PROGRAM_EGREP      dnl required by AC_EGREP_CPP
  AC_PROG_FGREP         dnl finds working grep -F
--- 11,17 ----
  AC_PROG_MAKE_SET
  
  dnl Checks for programs.
! AC_PROG_CC_C89                dnl required by almost everything
  AC_PROG_CPP           dnl required by header file checks
  AC_PROGRAM_EGREP      dnl required by AC_EGREP_CPP
  AC_PROG_FGREP         dnl finds working grep -F
***************
*** 61,66 ****
--- 61,69 ----
        CFLAGS="$CFLAGS -fno-strength-reduce"
      fi
    fi
+ 
+   dnl Declare what standards the code should comply with
+   CPPFLAGS="$CPPFLAGS -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700"
  fi
  
  dnl clang-500.2.75 or around has abandoned -f[no-]strength-reduce and issues a
***************
*** 135,141 ****
  if test "`(uname) 2>/dev/null`" = Darwin; then
    AC_MSG_RESULT(yes)
    MACOS_X=yes
!   CPPFLAGS="$CPPFLAGS -DMACOS_X"
  
    AC_MSG_CHECKING(--disable-darwin argument)
    AC_ARG_ENABLE(darwin,
--- 138,144 ----
  if test "`(uname) 2>/dev/null`" = Darwin; then
    AC_MSG_RESULT(yes)
    MACOS_X=yes
!   CPPFLAGS="$CPPFLAGS -D_DARWIN_C_SOURCE -DMACOS_X"
  
    AC_MSG_CHECKING(--disable-darwin argument)
    AC_ARG_ENABLE(darwin,
***************
*** 4400,4405 ****
--- 4403,4414 ----
        CFLAGS="-D_ALL_SOURCE -Wc,float\(ieee\),dll"
  fi
  
+ dnl Declare what standards the code should comply with.  But not when using
+ dnl GTK, the header files cause all kinds of warnings.
+ if test "$GCC" = yes -a "$GUITYPE" != "GTK"; then
+   CFLAGS="$CFLAGS -ansi"
+ fi
+ 
  dnl write output files
  AC_OUTPUT(auto/config.mk:config.mk.in)
  
*** ../vim-8.0.1708/src/auto/configure  2018-04-11 22:19:30.624025646 +0200
--- src/auto/configure  2018-04-14 14:24:39.273537508 +0200
***************
*** 3449,3454 ****
--- 3449,3545 ----
  ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
  ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS 
conftest.$ac_ext $LIBS >&5'
  ac_compiler_gnu=$ac_cv_c_compiler_gnu
+ 
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept 
ISO C89" >&5
+ $as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
+ if ${ac_cv_prog_cc_c89+:} false; then :
+   $as_echo_n "(cached) " >&6
+ else
+   ac_cv_prog_cc_c89=no
+ ac_save_CC=$CC
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+ #include <stdarg.h>
+ #include <stdio.h>
+ struct stat;
+ /* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
+ struct buf { int x; };
+ FILE * (*rcsopen) (struct buf *, struct stat *, int);
+ static char *e (p, i)
+      char **p;
+      int i;
+ {
+   return p[i];
+ }
+ static char *f (char * (*g) (char **, int), char **p, ...)
+ {
+   char *s;
+   va_list v;
+   va_start (v,p);
+   s = g (p, va_arg (v,int));
+   va_end (v);
+   return s;
+ }
+ 
+ /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default.  It has
+    function prototypes and stuff, but not '\xHH' hex character constants.
+    These don't provoke an error unfortunately, instead are silently treated
+    as 'x'.  The following induces an error, until -std is added to get
+    proper ANSI mode.  Curiously '\x00'!='x' always comes out true, for an
+    array size at least.  It's necessary to write '\x00'==0 to get something
+    that's true only with -std.  */
+ int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+ 
+ /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
+    inside strings and character constants.  */
+ #define FOO(x) 'x'
+ int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
+ 
+ int test (int i, double x);
+ struct s1 {int (*f) (int a);};
+ struct s2 {int (*f) (double a);};
+ int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), 
int, int);
+ int argc;
+ char **argv;
+ int
+ main ()
+ {
+ return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
+   ;
+   return 0;
+ }
+ _ACEOF
+ for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
+       -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+ do
+   CC="$ac_save_CC $ac_arg"
+   if ac_fn_c_try_compile "$LINENO"; then :
+   ac_cv_prog_cc_c89=$ac_arg
+ fi
+ rm -f core conftest.err conftest.$ac_objext
+   test "x$ac_cv_prog_cc_c89" != "xno" && break
+ done
+ rm -f conftest.$ac_ext
+ CC=$ac_save_CC
+ 
+ fi
+ # AC_CACHE_VAL
+ case "x$ac_cv_prog_cc_c89" in
+   x)
+     { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
+ $as_echo "none needed" >&6; } ;;
+   xno)
+     { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
+ $as_echo "unsupported" >&6; } ;;
+   *)
+     CC="$CC $ac_cv_prog_cc_c89"
+     { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5
+ $as_echo "$ac_cv_prog_cc_c89" >&6; } ;;
+ esac
+ if test "x$ac_cv_prog_cc_c89" != xno; then :
+ 
+ fi
+ 
                ac_ext=c
  ac_cpp='$CPP $CPPFLAGS'
  ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
***************
*** 4115,4120 ****
--- 4206,4213 ----
        CFLAGS="$CFLAGS -fno-strength-reduce"
      fi
    fi
+ 
+     CPPFLAGS="$CPPFLAGS -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700"
  fi
  
  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for clang version" >&5
***************
*** 4187,4193 ****
    { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
  $as_echo "yes" >&6; }
    MACOS_X=yes
!   CPPFLAGS="$CPPFLAGS -DMACOS_X"
  
    { $as_echo "$as_me:${as_lineno-$LINENO}: checking --disable-darwin 
argument" >&5
  $as_echo_n "checking --disable-darwin argument... " >&6; }
--- 4280,4286 ----
    { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
  $as_echo "yes" >&6; }
    MACOS_X=yes
!   CPPFLAGS="$CPPFLAGS -D_DARWIN_C_SOURCE -DMACOS_X"
  
    { $as_echo "$as_me:${as_lineno-$LINENO}: checking --disable-darwin 
argument" >&5
  $as_echo_n "checking --disable-darwin argument... " >&6; }
***************
*** 14341,14346 ****
--- 14434,14443 ----
        CFLAGS="-D_ALL_SOURCE -Wc,float\(ieee\),dll"
  fi
  
+ if test "$GCC" = yes -a "$GUITYPE" != "GTK"; then
+   CFLAGS="$CFLAGS -ansi"
+ fi
+ 
  ac_config_files="$ac_config_files auto/config.mk:config.mk.in"
  
  cat >confcache <<\_ACEOF
*** ../vim-8.0.1708/src/gui_gtk_x11.c   2018-03-20 21:24:40.953118253 +0100
--- src/gui_gtk_x11.c   2018-04-14 13:54:46.197359769 +0200
***************
*** 5607,5621 ****
      guicolor_T
  gui_mch_get_color(char_u *name)
  {
      if (!gui.in_use)          /* can't do this when GUI not running */
!       return INVALCOLOR;
  
  #if GTK_CHECK_VERSION(3,0,0)
!     return name != NULL ? gui_get_color_cmn(name) : INVALCOLOR;
  #else
-     guicolor_T color;
- 
-     color = (name != NULL) ? gui_get_color_cmn(name) : INVALCOLOR;
      if (color == INVALCOLOR)
        return INVALCOLOR;
  
--- 5607,5623 ----
      guicolor_T
  gui_mch_get_color(char_u *name)
  {
+     guicolor_T color = INVALCOLOR;
+ 
      if (!gui.in_use)          /* can't do this when GUI not running */
!       return color;
! 
!     if (name != NULL)
!       color = gui_get_color_cmn(name);
  
  #if GTK_CHECK_VERSION(3,0,0)
!     return color;
  #else
      if (color == INVALCOLOR)
        return INVALCOLOR;
  
*** ../vim-8.0.1708/src/if_python3.c    2018-03-29 18:15:21.850258760 +0200
--- src/if_python3.c    2018-04-14 13:54:46.197359769 +0200
***************
*** 815,821 ****
  #endif
      if (Py_IsInitialized())
      {
!       // acquire lock before finalizing
        PyGILState_Ensure();
  
        Py_Finalize();
--- 818,824 ----
  #endif
      if (Py_IsInitialized())
      {
!       /* acquire lock before finalizing */
        PyGILState_Ensure();
  
        Py_Finalize();
*** ../vim-8.0.1708/src/version.c       2018-04-14 13:51:51.982588340 +0200
--- src/version.c       2018-04-14 14:35:21.061080893 +0200
***************
*** 764,765 ****
--- 764,767 ----
  {   /* Add new patch number below this line */
+ /**/
+     1709,
  /**/

-- 
If Microsoft would build a car...
... Occasionally, executing a maneuver such as a left turn
would cause your car to shut down and refuse to restart, in
which case you would have to reinstall the engine.

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui