Mercurial > hg > xemacs-beta
view notes.txt @ 5934:e2fae7783046 cygwin
lots of use of EMACS_INT, a few others, to eliminate all pointer truncation warnings
author | Henry Thompson <ht@markup.co.uk> |
---|---|
date | Sat, 12 Dec 2015 19:08:46 +0000 |
parents | c1e8f3294298 |
children | d5eb0914ca1f |
line wrap: on
line source
Brute-forced a set of changes which allowed make unicode-encapsulate to work 1) Patched make-mswin-unicode.pl to match macros with pointer return types; 2) Updated intl-encap-win32.c to deal with a) added functions; b) refactoring of w32api include files. Renamed DEVICE_TYPE to DEVICE_TYPE_X in device-impl.h and everywhere it is used to avoid collision with DEVICE_TYPE in winioctl.h Minimal fixes to get to compile wrt int vs. intptr_t in 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. Ah, need a more up-to-date config.{sub,guess}, got one from somewhere dated timestamp='2013-06-10' Copy src/s/cygwin32.h to cygwin64.h and src/m/intel386.h to x86_64.h And a configure.ac which recognises cygwin64 Remove cygwin_conv_to_posix_path from lib-src/gnuclient.c Replace calls to qxeGetWindowLong(... GWL_..) with qxeGetWindowLongPtr(... GWLP_...) (w. LONG_PTR result if used) after re-making unicode-encapsulate And one LONG l = qxeGetWindowLong (hwnd, XWL_FRAMEOBJ) to LONG_PTR l = qxeGetWindowLongPtr (hwnd, XWL_FRAMEOBJ) Ah, several bugs in new header files in w32api, required some additions to wfun_re in make-mswin-unicode.pl That's enough to get event-msw.c to compile, although there are some size-related warnings. similar problem in frame-msw.c: qxeSetClassLong (FRAME_MSWINDOWS_HANDLE (f), GCL_HICON and in glyphs-msw.c: qxeGetWindowLong (FRAME_MSWINDOWS_HANDLE (XFRAME (frame)), GWL_HINSTANCE), and scrollbar-msw.c also (void *) opaque = (void *)qxeGetWindowLong (SCROLLBAR_MSW_HANDLE (sb), GWL_USERDATA); LONG_PTR opaque = qxeGetWindowLongPtr (SCROLLBAR_MSW_HANDLE (sb), GWLP_USERDATA); and dialog-msw.c:197:31: error: ‘DWL_USER’ undeclared (first use in this function) qxeSetWindowLong (hwnd, DWL_USER, l_param); Compiles all the way through, links OK, temacs runs! Build completes xemacs -nw works but xemacs as such does not: > ./xemacs Fatal error: assertion failed, file event-msw.c, line 4149, !NILP (Vmswindows_frame_being_created) -------------- console-msw.c:116:3: warning: format '%ld' expects argument of type 'long int', but argument 3 has type 'DWORD' [-Wformat=] resolution: cast the DWORDs to long ---- event-msw.c: In function 'mswindows_wnd_proc': event-msw.c:2741:6: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] ((LCID) GetKeyboardLayout (0) & 0xFFFF), cast to intptr_t first event-msw.c:2825:50: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] virtual_key = qxeMapVirtualKeyEx (scan, 1, (HKL) lcid); cast to intptr_t first ^ event-msw.c:2839:6: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] (HKL) lcid); ^ ditto event-msw.c:2861:7: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] (HKL) lcid); ^ ditto [I _really_ don't understand the size hacking going on between LCIDs and HKLs here!] event-msw.c: In function 'emacs_mswindows_remove_timeout': event-msw.c:4200:6: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] (void *) id, MECR_DEALLOCATE_EVENT); ^ This is a hack!!! Use intptr_t instead, still a hack. frame-msw.c: In function ‘mswindows_init_frame_1’: frame-msw.c:274:41: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] qxeSetWindowLong (hwnd, XWL_FRAMEOBJ, (LONG)STORE_LISP_IN_VOID (frame_obj)); intptr_t frame-msw.c: In function ‘mswindows_get_mouse_position’: frame-msw.c:554:32: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] *frame = GET_LISP_FROM_VOID ((void *) qxeGetWindowLong (hwnd, XWL_FRAMEOBJ)); qxeGetWindowLongPtr (hwnd, XWL_FRAMEOBJ frame-msw.c: In function ‘mswindows_get_frame_parent’: frame-msw.c:822:36: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] parent = GET_LISP_FROM_VOID ((void *) qxeGetWindowLong (hwnd, XWL_FRAMEOBJ)); ditto glyphs-msw.c: In function 'mswindows_widget_instantiate': glyphs-msw.c:2261:8: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] (HMENU)id, /* No menu */ intptr_t id = -1; menubar-msw.c: In function 'empty_menu': menubar-msw.c:98:24: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] #define EMPTY_ITEM_ID ((UINT)STORE_LISP_IN_VOID (Qunbound)) menubar-msw.c:181:49: note: in expansion of macro 'EMPTY_ITEM_ID' qxeAppendMenu (menu, MF_STRING | MF_GRAYED, EMPTY_ITEM_ID, resolved:#define EMPTY_ITEM_ID ((UINT)STORE_LISP_IN_VOID (Qunbound)) intptr_t dialog-msw.c:764:9: warning: passing argument 4 of 'qxeCreateDialogIndirectParam' from incompatible pointer type [enabled by default] (LPARAM) STORE_LISP_IN_VOID (obj)); ^ intptr_t toolbar-msw.c: In function 'mswindows_clear_toolbar': toolbar-msw.c:100:55: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] qxeSendMessage (toolbarwnd, TB_GETIMAGELIST, 0, (LONG) &ilist); ^ intptr_t toolbar-msw.c: In function 'mswindows_output_toolbar': toolbar-msw.c:370:10: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] (HMENU)(TOOLBAR_ID_BIAS + pos), ^ (intptr_t) In file included from mule-coding.c:32:0: mule-coding.c: In function 'parse_charset_conversion_specs': win32.c: In function 'mswindows_lisp_error_1': win32.c:259:9: warning: format '%ld' expects argument of type 'long int', but argument 3 has type 'DWORD' [-Wformat=] errnum, GetLastError ()); ^ (long) win32.c: In function 'Fmswindows_shell_execute': win32.c:352:11: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] ret = (int) qxeShellExecute (NULL, opext, doc, parmext, path, ^ intptr-t win32.c: In function 'setitimer_helper': win32.c:847:7: warning: passing argument 3 of 'timeSetEvent' from incompatible pointer type [enabled by default] event_type); ^ resoluion: pblm is elsewhere? setitimer_helper_proc (UINT UNUSED (uID), UINT UNUSED (uMsg), DWORD[_PTR] dwUser, DWORD[_PTR] UNUSED (dw1), DWORD[_PTR] UNUSED (dw2)) > make clean, try again /usr/local/src/xemacs-21.5-64bit/lib-src/winclient.c: In function 'doFile': /usr/local/src/xemacs-21.5-64bit/lib-src/winclient.c:299:4: warning: pointer targ ets in passing argument 1 of 'DdeClientTransaction' differ in signedness [-Wpoint er-sign] 0, XTYP_EXECUTE, TRANSACTION_TIMEOUT, NULL); ^ In file included from /usr/local/src/xemacs-21.5-64bit/lib-src/winclient.c:27:0: /usr/include/w32api/ddeml.h:208:19: note: expected 'LPBYTE' but argument is of ty pe 'char *' HDDEDATA WINAPI DdeClientTransaction(LPBYTE pData,DWORD cbData,HCONV hConv,HSZ hszItem,UINT wFmt,UINT wType,DWORD dwTimeout,LPDWORD pdwResult); ^ [note it's arg1 that's the problem, cast to LPBYTE] event-msw.c:4200:6: warning: passing argument 4 of 'map_event_chain_remove' makes pointer from integer without a cast [enabled by default] (intptr_t)id, MECR_DEALLOCATE_EVENT); ^ In file included from event-msw.c:72:0: events.h:956:5: note: expected 'void *' but argument is of type 'long int' int map_event_chain_remove (int (*fn) (Lisp_Object ev, void *user_data), resolution: hack, but cast _again_, i.e. (void *)(intptr_t) dialog-msw.c:764:9: warning: passing argument 4 of 'qxeCreateDialogIndirectParam' from incompatible pointer type [enabled by default] (intptr_t) STORE_LISP_IN_VOID (obj)); ^ In file included from syswindows.h:642:0, from console-msw.h:39, from console-msw-impl.h:37, from dialog-msw.c:37: intl-auto-encap-win32.h:627:6: note: expected 'DLGPROC' but argument is of type 'BOOL (*)(struct HWND__ *, UINT, WPARAM, LPARAM)' HWND qxeCreateDialogIndirectParam (HINSTANCE hInstance, LPCDLGTEMPLATEW lpTemplate, HWND hWndParent, DLGPROC lpDialogFunc, LPARAM dwInitParam); resolved by adding a cast: (DLGPROC)dialog_proc, but not at all sure that's right > make clean, try again intl-win32.c:1509:27: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] TranslateCharsetInfo ((DWORD *) (DWORD) old_logfont.lfCharSet, &info, ^ resolution: do nothing -- I think this is necessary because of extremely aggressive argument overloading by MS intl-auto-encap-win32.c:126:5: warning: passing argument 1 of 'ShellExecuteExA' from incompatible pointer type [enabled by default] return ShellExecuteExA (pExecInfo); ^ In file included from syswindows.h:220:0, from intl-auto-encap-win32.c:12: /usr/include/w32api/shellapi.h:345:22: note: expected 'struct SHELLEXECUTEINFOA *' but argument is of type 'struct SHELLEXECUTEINFOW *' SHSTDAPI_(WINBOOL) ShellExecuteExA (SHELLEXECUTEINFOA *pExecInfo); ^ resolution: ignored, never used, removed from intl-encap-win32.c intl-auto-encap-win32.c: In function 'qxeFreeEnvironmentStrings': intl-auto-encap-win32.c:1771:5: warning: passing argument 1 of 'FreeEnvironmentStringsA' from incompatible pointer type [enabled by default] return FreeEnvironmentStringsA (penv); ^ In file included from /usr/include/w32api/winbase.h:28:0, from /usr/include/w32api/windows.h:70, from syswindows.h:204, from intl-auto-encap-win32.c:12: /usr/include/w32api/processenv.h:29:29: note: expected 'LPCH' but argument is of type 'LPWCH' WINBASEAPI WINBOOL WINAPI FreeEnvironmentStringsA (LPCH penv); ^ intl-encap-win32.c: In function 'qxeUpdateICMRegKey': intl-encap-win32.c:1426:36: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] return UpdateICMRegKeyW (arg1, (DWORD) arg2, (LPWSTR) arg3, arg4); ^ intl-encap-win32.c:1426:5: warning: passing argument 2 of 'UpdateICMRegKeyW' makes pointer from integer without a cast [enabled by default] return UpdateICMRegKeyW (arg1, (DWORD) arg2, (LPWSTR) arg3, arg4); ^ In file included from /usr/include/w32api/windows.h:71:0, from syswindows.h:204, from console-msw.h:39, from intl-encap-win32.c:44: /usr/include/w32api/wingdi.h:3425:28: note: expected 'LPWSTR' but argument is of type 'unsigned int' WINGDIAPI WINBOOL WINAPI UpdateICMRegKeyW(DWORD reserved,LPWSTR lpszCMID,LPWSTR lpszFileName,UINT command); resolution: nothing, known problem Similarly wrt qxeEnumResourceTypes, qxeEnumResourceNames, qxeEnumResourceLanguages, qxeImmSetCompositionString --------- make clean, recompile, all looks OK, try to track down the problem -- the error in event-msw.c inside mswindow_find_frame, inside intercepted_wnd_proc (a signal handler?), where we have a window with no frame saved, appears to happen when the main thread is in mswindows_init_frame_1 at frame-msw.c:139 at recompute_all_cached_specifiers_in_frame at specifier.c:3483 at recompute_one_cached_specifier_in_frame at specifier.c:3444 around the sixth one --- April 2014 above here ---- After a tiny spark on interest on xemacs-beta, did pull -u, merge and commit, make distclean, configure '--with-pdump=yes' '--with-modules=no' '--with-mule=yes' '--with-ncurses=yes' '--with-msw=yes' '--without-png' '--without-xpm' '--without-jpeg' '--with-cflags-debugging=-ggdb' No change -- -nw works, w/o -nw gives the same assertion failed. ----- Trying again, make distclean followed by > didn't work!, had to add --without-x (why???) ------ Force debug printing on by debug_mswindows_events = 3; at the end of event-msw.c Added more printing, removed frame printing, from debug_output_mswin_message ditto Narrowed it down to the qxeSetWindowLong (hwnd, XWL_FRAMEOBJ, (intptr_t)STORE_LISP_IN_VOID (frame_obj)); at the end of mswindows_init_frame_1 in frame-msw.c a) Should be ...LongtPtr b) Not enough room allocated for a 64-bit long ptr -- fixed in console-msw-impl.h ---- Trying to get a clean diff to send to Vin Need Change log entries! Working with /c/C32/usr/local/src/xemacs-21.5-mine vs. -upstream (now pulled from xemacs, not xemacs-beta) _Only_ new files are src/s/cygwin64.h src/m/x86_64.h Changed files are > diff -rq --exclude=.hg --exclude=info --exclude=*.{o,i,exe,elc} xemacs-21.5-{upstream,mine}|egrep -v Only | cut -f 2 -d ' ' | cut -f 2- -d / ChangeLog README configure configure.ac lib-src/gnuclient.c lib-src/make-mswin-unicode.pl lib-src/winclient.c src/console-msw-impl.h src/console-msw.c src/device-impl.h src/device.c src/dialog-msw.c src/event-msw.c src/frame-msw.c src/frame.c src/glyphs-msw.c src/glyphs.c src/intl-auto-encap-win32.c src/intl-auto-encap-win32.h src/intl-encap-win32.c src/menubar-msw.c src/process-unix.c src/scrollbar-msw.c src/specifier.c src/toolbar-msw.c src/win32.c --- default branch, abandoned cygwin64 as system-type Trying to compile with vs2015: > patch -p 1 < ../xemacs-21.5-upstream/vs2015_3.patch patching file nt/xemacs.mak Hunk #4 FAILED at 796. 1 out of 19 hunks FAILED -- saving rejects to file nt/xemacs.mak.rej patching file src/intl-auto-encap-win32.c Hunk #1 FAILED at 36. Hunk #2 succeeded at 3147 with fuzz 2 (offset -199 lines). Hunk #3 succeeded at 3156 with fuzz 2 (offset -199 lines). 1 out of 3 hunks FAILED -- saving rejects to file src/intl-auto-encap-win32.c.rej patching file src/s/windowsnt.h patching file src/sysproc.h OK, did first (.mak) by hand, other was there, in a different place, already. Compilation produces _lots_ of warnings about type/size conversions, slowly figuring out fixes, possible not all correct :-( Some further forward and back hacking wrt timeval and tv_sec, finally had to actually edit /c/Program Files (x86)/Windows Kits/8.1/Include/um/winsock.h to get things moving :-( Lots of EMACS_INT (long long) == 8-bytes -> int or long == 4-bytes warnings, whose equivalent (long (8) -> int (4)) are _not_ notified by Cygwin, are coming up, sort-of overpowering the compiler output, so fttb I've set ERROR_CHECK_ALL=0 in config.inc, which turned off -TP (CPP, which I thought was raising the warnings), but still getting many warnings: down from 567 to 423! More small fixes, in process-nt.c very speculative, get me to through compilation to (lots of) linking errors Clean and rebuild and only Xpm lib linking errors, turn off Xpm and build completes except for makeinfo (shell script pblm) Using VS for the winlibs, to set flags etc. use the wrench icon in the Property Manager window. Copied all but WIN32 preprocessor flag from the 32-bit VS-built solution. Needed to fuss with linker debugging flags and input (module definition file) to get it all to work for Xpm, but now it does! Installs under Program Files, but not finding packages despite load-path being ("c:\\C64\\home\\ht\\lib\\emacs\\" "c:/C64/usr/local/share/xemacs/xemacs-packages/lisp" "c:\\Program Files\\XEmacs\\XEmacs-21.5-b34\\lisp\\") Backed out change to winsock.h, and updated corresponding comments in systime.h Now getting 2192 conversion warnings, makes me v. nervous! But it runs. . . Using various means to locate and attempt to correct warnings. Have now eliminated all pointer truncation warnings. 1254 remain, of which 1246 are conversion from [64 bits] to [32 bits], possible loss of data