Skrivet eo bet gant Patrick Texier:

> Le Fri, 22 May 2009 19:42:43 -0700 (PDT), Yongwei Wu a écrit dans le
> message
> <c3a50ae4-1f2e-4986-9669-b02639f6b...@r31g2000prh.googlegroups.com> :
>
>> Why the NULLs at the end? It breaks my MSVC build with:
>>
>> if_tcl.c(1690) : error C2078: too many initializers
>
> And using GCC 3.2 on Linux, I get warnings:
>
> ====================== compiling if_tcl.c =========
> gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK -I/usr/include/gtk-1.2
> -I/usr/include/glib-1.2 -I/usr/lib/glib/include -I/usr/X11R6/include
> -g -O2 -fno-strength-reduce  -I/usr/X11R6/include -D_REENTRANT
> -D_GNU_SOURCE  -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
> -I/usr/include/gdbm  -I/usr/lib/perl5/5.8.0/i386-linux-thread-multi/CORE
> -I/usr/include/python2.2 -pthread -I/usr/include    -o objects/if_tcl.o
> if_tcl.c
> if_tcl.c:1687: warning: excess elements in struct initializer
> if_tcl.c:1687: warning: (near initialization for `channel_type')
> if_tcl.c:1688: warning: excess elements in struct initializer
> if_tcl.c:1688: warning: (near initialization for `channel_type')
> if_tcl.c:1690: warning: excess elements in struct initializer
> if_tcl.c:1690: warning: (near initialization for `channel_type')
> ====================================================
>
> ======= gcc version ===============
> [...@localhost pt]$ gcc -v
> Reading specs from /usr/lib/gcc-lib/i586-mandrake-linux-gnu/3.2/specs
> Configured with: ../configure --prefix=/usr --libdir=/usr/lib
> --with-slibdir=/lib --mandir=/usr/share/man --infodir=/usr/share/info
> --enable-shared --enable-threads=posix --disable-checking
> --enable-long-long --enable-__cxa_atexit
> --enable-languages=c,c++,ada,f77,objc,java
> --host=i586-mandrake-linux-gnu --with-system-zlib
> Thread model: posix
> gcc version 3.2 (Mandrake Linux 9.0 3.2-1mdk)
> =====================================

...snip...

I don't have any warning when building with Tcl (using gcc -4.3.2).
But looking at /usr/include/tcl8.4/tcl.h, I see that the last few fields
of the struct Tcl_ChannelType don't necessarily exist everywhere
in very version of Tcl:

$ cat /usr/include/tcl8.4/tcl.h
...snip...
/*
 * struct Tcl_ChannelType:
 *
 * One such structure exists for each type (kind) of channel.
 * It collects together in one place all the functions that are
 * part of the specific channel type.
 *
 * It is recommend that the Tcl_Channel* functions are used to access
 * elements of this structure, instead of direct accessing.
 */
typedef struct Tcl_ChannelType {
    ...snip...

    /*
     * Only valid in TCL_CHANNEL_VERSION_2 channels or later
     */
    Tcl_DriverFlushProc *flushProc;     /* Procedure to call to flush a
                                         * channel. May be NULL. */
    Tcl_DriverHandlerProc *handlerProc; /* Procedure to call to handle a
                                         * channel event.  This will be passed
                                         * up the stacked channel chain. */
    /*
     * Only valid in TCL_CHANNEL_VERSION_3 channels or later
     */
    Tcl_DriverWideSeekProc *wideSeekProc;
                                        /* Procedure to call to seek
                                         * on the channel which can
                                         * handle 64-bit offsets. May be
                                         * NULL, and must be NULL if
                                         * seekProc is NULL. */

     /*
      * Only valid in TCL_CHANNEL_VERSION_4 channels or later
      * TIP #218, Channel Thread Actions
      */
     Tcl_DriverThreadActionProc *threadActionProc;
                                        /* Procedure to call to notify
                                         * the driver of thread specific
                                         * activity for a channel.
                                         * May be NULL. */
} Tcl_ChannelType;
...snip...


So the attached patch should fix the compilation warnings.
Also fixed some comments which incorrectly referred to Perl
in if_tcl.c.

Regards
-- Dominique

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Index: if_tcl.c
===================================================================
RCS file: /cvsroot/vim/vim7/src/if_tcl.c,v
retrieving revision 1.8
diff -c -r1.8 if_tcl.c
*** if_tcl.c	22 May 2009 19:08:31 -0000	1.8
--- if_tcl.c	23 May 2009 08:40:08 -0000
***************
*** 161,167 ****
  # endif
  
  /*
!  * Declare HANDLE for perl.dll and function pointers.
   */
  static HANDLE hTclLib = NULL;
  Tcl_Interp* (*dll_Tcl_CreateInterp)();
--- 161,167 ----
  # endif
  
  /*
!  * Declare HANDLE for tcl.dll and function pointers.
   */
  static HANDLE hTclLib = NULL;
  Tcl_Interp* (*dll_Tcl_CreateInterp)();
***************
*** 182,188 ****
   * Make all runtime-links of tcl.
   *
   * 1. Get module handle using LoadLibraryEx.
!  * 2. Get pointer to perl function by GetProcAddress.
   * 3. Repeat 2, until get all functions will be used.
   *
   * Parameter 'libname' provides name of DLL.
--- 182,188 ----
   * Make all runtime-links of tcl.
   *
   * 1. Get module handle using LoadLibraryEx.
!  * 2. Get pointer to tcl function by GetProcAddress.
   * 3. Repeat 2, until get all functions will be used.
   *
   * Parameter 'libname' provides name of DLL.
***************
*** 1683,1692 ****
      NULL,
      NULL,
      NULL,
!     NULL,
!     NULL,
!     NULL,
!     NULL
  };
  
  /**********************************
--- 1683,1698 ----
      NULL,
      NULL,
      NULL,
! #ifdef TCL_CHANNEL_VERSION_2
!     NULL,   /* flushProc */
!     NULL,   /* handlerProc */
! #endif
! #ifdef TCL_CHANNEL_VERSION_3
!     NULL,   /* wideSeekProc */
! #endif
! #ifdef TCL_CHANNEL_VERSION_4
!     NULL    /* threadActionProc */
! #endif
  };
  
  /**********************************

Raspunde prin e-mail lui