Re: Henry Thompson's patch for 64-bit Cygwin compatibility

Vin Shelton <[email protected]> Tue, 24 Mar 2015 10:14:17 -0400
Newsgroups gmane.emacs.xemacs.patches
Message-ID <CACeGjnWZkWKHOwrCKrt5N4Tdkqr_GrO1F8cAqaAXuKMV-D+Dfg@mail.gmail.com>
Henry et al,

Henry - as time permits, I will dig in on this, but I thought you
would like some early feedback.

On Sat, Mar 21, 2015 at 6:19 AM, Stephen J. Turnbull <[email protected]> wrote:
> I'm resending a patch by Henry, which somehow got trapped in the
> mail system (I think it's Henry's outgoing MTA that doesn't like to
> be greylisted, but I don't have enough information to diagnose).

Stephen - Thanks for sending this on.  Henry has been working hard on
this for awhile; it's great to see people get a chance to look at
this.

>
> Henry writes:
>
>  > Herewith a set of patches which
>  >  a) Allow xemacs to compile and run under 64-bit Cygwin (_and_
>  >     32-bit Cygwin);
>  >  b) Fix a long-standing problem with M-x shell (this one is Vin's).
>  >
>  > Getting the 64-bit compilation to work required editting
>  > intl-encap-win32.c to account for refactoring of w32api.h and re-running
>  > lib-src/make-mswin-unicode.pl.  I do _not_ have the necessary
>  > background to be confident that this has been done properly, so I hope
>  > that someone can persuade Ben Wing to review what I've done here!
>  >
>  > I've never submitted patches before, so please let me know if there's
>  > a better way I should have done this.
>
> For starters, thanks for providing ChangeLogs!

Yes.  The way to do this is to use the -U 0 option for ChangeLogs, so
there is no context.  Then the ChangeLog patches will apply cleanly.

> No big deal, a couple of minor pieces of advice:
>
> It's preferable to submit separate patches for each individual
> feature.  Easier to review and make specific changes.

This is entirely my fault.  I can't believe I didn't submit the
process-unix patch to the 21.5 branch.  Sorry!  I will try to submit
this in the next couple of days.

> Also, although committers need to commit the automatically generated
> files, I don't think you need to submit the patch (in fact, since
> practically the whole files are changed, it's probably shorter to
> submit the original files).
>
> Regarding the patch itself, I don't like the name DEVICE_TYPE_X,
> because it looks like it either has something to do with the X Window
> System or perhaps is the C implementation of a lisp function named
> `device-type*'.  Possibly just "DEVICE_TYPE_" (I think that's the
> convention Ben used to avoid C++ keywords like "class").

Henry - after applying the patch, I notice the following problems on
my 64-bit Win7 system.  Note that this is gcc-4.9.2 (Installation file
included below).

1. configure reports:
  checking build system type... x86_64-unknown-cygwin
  XEmacs has no builtin knowledge of `x86_64' machines.
  Using configure-time autodetection only.
  XEmacs has no builtin knowledge of `cygwin64' operating systems.
  Using configure-time autodetection only.

2. event-msw.c fails to compile:

  gcc -c -I/usr/include/noX -I/usr/include/noX -Wall -Wno-switch
-Wundef -Wsign-compare -Wno-char-subscripts -Wpacked -Wpointer-arith
-Wshadow -Wmissing-declarations -Wmissing-prototypes
-Wstrict-prototypes -Wdeclaration-after-statement  -Wunused-parameter
-g    -Demacs -I. -I/c/Cyg_acs/xemacs-21.5/src -DHAVE_CONFIG_H
event-msw.c
  event-msw.c:67:3: error: #error Something is wrong -- you are
neither Windows native (possibly MinGW) nor Cygwin.
   # error Something is wrong -- you are neither Windows native
(possibly MinGW) nor Cygwin.
     ^
  In file included from console-msw.h:39:0,
  from console-msw-impl.h:37,
  from event-msw.c:83:
  syswindows.h:1355:47: warning: 'struct stat' declared inside parameter list
   int mswindows_stat (const Ibyte *path, struct stat *buf);
^
  syswindows.h:1355:47: warning: its scope is only this definition or
declaration, which is probably not what you want
  syswindows.h:1356:39: warning: 'struct stat' declared inside parameter list
   int mswindows_fstat (int desc, struct stat *buf);
^
  event-msw.c:682:3: error: unknown type name 'SOCKET'
     SOCKET s;   /* Socket handle (which is a Win32 handle)   */
     ^
  event-msw.c: In function 'winsock_initiate_read':
  event-msw.c:703:18: warning: cast to pointer from integer of
different size [-Wint-to-pointer-cast]
     if (!ReadFile ((HANDLE)str->s, str->buffer, WINSOCK_READ_BUFFER_SIZE,
   ^
  event-msw.c: In function 'winsock_reader':
  event-msw.c:733:30: warning: cast to pointer from integer of
different size [-Wint-to-pointer-cast]
      if (!GetOverlappedResult ((HANDLE)str->s, &str->ov, &str->bufsize,
^
  event-msw.c: In function 'winsock_writer':
  event-msw.c:780:30: warning: cast to pointer from integer of
different size [-Wint-to-pointer-cast]
      if (!GetOverlappedResult ((HANDLE)str->s, &str->ov, &dw_unused,
^
  event-msw.c:807:18: warning: cast to pointer from integer of
different size [-Wint-to-pointer-cast]
     if (WriteFile ((HANDLE)str->s, str->buffer, size, &str->bufsize,
   ^
  event-msw.c: In function 'winsock_closer':
  event-msw.c:827:3: warning: implicit declaration of function
'closesocket' [-Wimplicit-function-declaration]
     closesocket (str->s);
     ^
  event-msw.c: At top level:
  event-msw.c:849:24: error: unknown type name 'SOCKET'
   make_winsock_stream_1 (SOCKET s, LPARAM param, const char *mode)
 ^
  event-msw.c:871:28: error: unknown type name 'SOCKET'
   make_winsock_input_stream (SOCKET s, LPARAM param)
     ^
  event-msw.c:877:29: error: unknown type name 'SOCKET'
   make_winsock_output_stream (SOCKET s, LPARAM param)
      ^
  event-msw.c: In function 'mswindows_unwait_process':
  event-msw.c:1119:3: warning: implicit declaration of function
'get_nt_process_handle' [-Wimplicit-function-declaration]
     remove_waitable_handle (get_nt_process_handle (p));
     ^
  event-msw.c:1119:27: warning: passing argument 1 of
'remove_waitable_handle' makes pointer from integer without a cast
     remove_waitable_handle (get_nt_process_handle (p));
    ^
  event-msw.c:1096:1: note: expected 'HANDLE' but argument is of type 'int'
   remove_waitable_handle (HANDLE h)
   ^
  event-msw.c: In function 'mswindows_need_event':
  event-msw.c:1537:7: error: '__try' undeclared (first use in this function)
__try
^
  event-msw.c:1537:7: note: each undeclared identifier is reported
only once for each function it appears in
  event-msw.c:1538:2: error: expected ';' before '{' token
    {
    ^
  event-msw.c:1643:57: warning: comparison between pointer and integer
if (get_nt_process_handle (XPROCESS (vaffanculo)) ==
  ^
  event-msw.c:1454:13: warning: variable 'what_events' set but not
used [-Wunused-but-set-variable]
DWORD what_events;
      ^
  In file included from event-msw.c:38:0:
  event-msw.c: In function 'mswindows_dde_callback':
  lisp.h:2166:23: warning: value computed is not used [-Wunused-value]
      ((((len & 1) != 0) && (tortoise = XCDR (tortoise), 0)), \
^
  lisp.h:2172:3: note: in expansion of macro 'PRIVATE_UNVERIFIED_LIST_LOOP_7'
     PRIVATE_UNVERIFIED_LIST_LOOP_7 (elt, list, len, hare, tortoise, \
     ^
  lisp.h:2098:1: note: in expansion of macro 'PRIVATE_EXTERNAL_LIST_LOOP_6'
   PRIVATE_EXTERNAL_LIST_LOOP_6 (elt, list, len_##elt, hare_##elt,  \
   ^
  event-msw.c:1935:6: note: in expansion of macro 'EXTERNAL_LIST_LOOP_2'
EXTERNAL_LIST_LOOP_2 (elt, Vdde_advise_items)
^
  lisp.h:2166:23: warning: value computed is not used [-Wunused-value]
      ((((len & 1) != 0) && (tortoise = XCDR (tortoise), 0)), \
^
  lisp.h:2172:3: note: in expansion of macro 'PRIVATE_UNVERIFIED_LIST_LOOP_7'
     PRIVATE_UNVERIFIED_LIST_LOOP_7 (elt, list, len, hare, tortoise, \
     ^
  lisp.h:2098:1: note: in expansion of macro 'PRIVATE_EXTERNAL_LIST_LOOP_6'
   PRIVATE_EXTERNAL_LIST_LOOP_6 (elt, list, len_##elt, hare_##elt,  \
   ^
  event-msw.c:1999:6: note: in expansion of macro 'EXTERNAL_LIST_LOOP_2'
EXTERNAL_LIST_LOOP_2 (elt, Vdde_advise_items)
^
  event-msw.c: In function 'emacs_mswindows_select_process':
  event-msw.c:4430:2: warning: implicit declaration of function
'get_nt_process_handle_only_first_time'
[-Wimplicit-function-declaration]
    HANDLE hprocess = get_nt_process_handle_only_first_time (process);
    ^
  event-msw.c:4430:20: warning: initialization makes pointer from
integer without a cast
    HANDLE hprocess = get_nt_process_handle_only_first_time (process);
     ^
  event-msw.c: In function 'emacs_mswindows_create_io_streams':
  event-msw.c:4569:9: warning: implicit declaration of function
'make_winsock_input_stream' [-Wimplicit-function-declaration]
  ? make_winsock_input_stream ((SOCKET) hin, fdi)
  ^
  event-msw.c:4569:39: error: 'SOCKET' undeclared (first use in this function)
  ? make_winsock_input_stream ((SOCKET) hin, fdi)
^
  event-msw.c:4569:47: error: expected ')' before 'hin'
  ? make_winsock_input_stream ((SOCKET) hin, fdi)
^
  event-msw.c:4579:3: warning: implicit declaration of function
'make_winsock_output_stream' [-Wimplicit-function-declaration]
     ? make_winsock_output_stream ((SOCKET)hout, fdo)
     ^
  event-msw.c:4579:41: error: expected ')' before 'hout'
     ? make_winsock_output_stream ((SOCKET)hout, fdo)
  ^
  event-msw.c: At top level:
  event-msw.c:374:1: warning: 'get_ntpipe_input_stream_param' defined
but not used [-Wunused-function]
   get_ntpipe_input_stream_param (Lstream *stream)
   ^
  event-msw.c:595:1: warning: 'get_ntpipe_output_stream_param' defined
but not used [-Wunused-function]
   get_ntpipe_output_stream_param (Lstream *stream)
   ^
  event-msw.c:890:1: warning: 'get_winsock_stream_param' defined but
not used [-Wunused-function]
   get_winsock_stream_param (Lstream *lstr)
   ^
  GNUmakefile:98: recipe for target 'event-msw.o' failed
  make[1]: *** [event-msw.o] Error 1
  make[1]: Leaving directory '/c/Cyg_acs/xemacs-21.5/src'
  GNUmakefile:98: recipe for target 'src' failed
  make: *** [src] Error 2

It looks like the cygwin detection is not working.

Here is my Installation file, in case it's relevant:

uname -a: CYGWIN_NT-6.1 acs-W7 1.7.35(0.287/5/3) 2015-03-04 12:09 x86_64 Cygwin

./configure


XEmacs 21.5-b34 "kale" 3ed83b4b4882+ configured for `x86_64-unknown-cygwin'.

Compilation Environment and Installation Defaults:
  Source code location:              /c/Cyg_acs/xemacs-21.5
  Installation prefix:               /usr/local
  Not using any operating system description file
  Not using any machine description file
  Compiler version:                  gcc (GCC) 4.9.2
    - GCC specs file:                specs.
    - Compiler command:              gcc -I/usr/include/noX
-I/usr/include/noX -Wall -Wno-switch -Wundef -Wsign-compare
-Wno-char-subscripts -Wpacked -Wpointer-arith -Wshadow
-Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes
-Wdeclaration-after-statement  -Wunused-parameter -g
  libc version:
  Relocating allocator for buffers:  no
  GNU version of malloc:             yes

Package Search (a 'root' contains '{xemacs,mule,site}-packages'):
  User package roots:    ~/.xemacs
  System package roots:  /usr/local/share/xemacs
    WARNING: /usr/local/share/xemacs was specified, but doesn't exist.
    WARNING: XEmacs functionality will be noticably limited until
    WARNING: some packages are installed.

Window System:
  Compiling in support for the Microsoft window system.
  Using MS-Windows menubars.
  Using MS-Windows scrollbars.
  Using MS-Windows dialog boxes.
  Using MS-Windows native widgets.
  Compiling in support for Drag'n'Drop (EXPERIMENTAL).
    -  Drag'n'Drop prototype:                              msw.

TTY:
  Compiling in support for ncurses.

Images:
  Compiling in support for XPM  images.
  Compiling in support for PNG  images.
  Compiling in support for JPEG images.
  Compiling in support for TIFF images.

Sound:
  Compiling in support for sound (native).

Databases:

Internationalization:

Mail:
  Compiling in support for POP mail retrieval.

Network:
  Inhibiting IPv6 canonicalization at startup.

Other Features:
  Compiling in support for dynamic shared object modules.
  Using the new GC mark algorithms (KKCC).
  WARNING: ---------------------------------------------------------
  WARNING: The new algorithms are experimental. They are enabled by
  WARNING: default for this release. Use `--disable-kkcc' to
  WARNING: turn it off.
  WARNING: ---------------------------------------------------------
  Using the new portable dumper.
  Dumping into executable.
  Compiling in support for extra debugging code.
  Compiling in support for runtime error checking.
  WARNING: ---------------------------------------------------------
  WARNING: XEmacs will run noticeably more slowly as a result.
  WARNING: Error checking is on by default for XEmacs beta releases.
  WARNING: ---------------------------------------------------------


Regards,
  Vin