aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/.gdbinit21
-rw-r--r--src/ChangeLog39
-rw-r--r--src/lisp.h6
-rw-r--r--src/w32fns.c42
-rw-r--r--src/w32heap.c2
-rw-r--r--src/w32menu.c23
-rw-r--r--src/w32proc.c11
-rw-r--r--src/w32term.h4
8 files changed, 107 insertions, 41 deletions
diff --git a/src/.gdbinit b/src/.gdbinit
index 1a2a973e694..91beaef8d73 100644
--- a/src/.gdbinit
+++ b/src/.gdbinit
@@ -70,14 +70,18 @@ define xgettype
70 set $type = (enum Lisp_Type) (USE_LSB_TAG ? $bugfix & (1 << GCTYPEBITS) - 1 : (EMACS_UINT) $bugfix >> VALBITS) 70 set $type = (enum Lisp_Type) (USE_LSB_TAG ? $bugfix & (1 << GCTYPEBITS) - 1 : (EMACS_UINT) $bugfix >> VALBITS)
71end 71end
72 72
73define xgetsym
74 xgetptr $arg0
75 if (!USE_LSB_TAG)
76 set $ptr = ($ptr << GCTYPEBITS)
77 end
78 set $ptr = ((struct Lisp_Symbol *) ((char *)lispsym + $ptr))
79end
80
73# Access the name of a symbol 81# Access the name of a symbol
74define xsymname 82define xsymname
75 if (CHECK_LISP_OBJECT_TYPE) 83 xgetsym $arg0
76 set $bugfix = $arg0.i 84 set $symname = $ptr->name
77 else
78 set $bugfix = $arg0
79 end
80 set $symname = ((struct Lisp_Symbol *) ((char *)lispsym + $bugfix))->name
81end 85end
82 86
83# Set up something to print out s-expressions. 87# Set up something to print out s-expressions.
@@ -760,7 +764,7 @@ end
760 764
761define xsymbol 765define xsymbol
762 set $sym = $ 766 set $sym = $
763 xgetptr $sym 767 xgetsym $sym
764 print (struct Lisp_Symbol *) $ptr 768 print (struct Lisp_Symbol *) $ptr
765 xprintsym $sym 769 xprintsym $sym
766 echo \n 770 echo \n
@@ -1082,8 +1086,7 @@ define xprintstr
1082end 1086end
1083 1087
1084define xprintsym 1088define xprintsym
1085 xgetptr $arg0 1089 xsymname $arg0
1086 xsymname $ptr
1087 xgetptr $symname 1090 xgetptr $symname
1088 set $sym_name = (struct Lisp_String *) $ptr 1091 set $sym_name = (struct Lisp_String *) $ptr
1089 xprintstr $sym_name 1092 xprintstr $sym_name
diff --git a/src/ChangeLog b/src/ChangeLog
index 81d6772bc23..2f40a463ed4 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,42 @@
12015-01-13 Eli Zaretskii <eliz@gnu.org>
2
3 Fix problems with 32-bit wide-int build exposed by MinGW.
4 * lisp.h (XPNTR): Move definition to after XTYPE, to avoid
5 compilation error in an unoptimized build when !USE_LSB_TAG.
6
7 * w32heap.c (DUMPED_HEAP_SIZE): For 32-bit wide-int build, use the
8 same larger value as for the 64-bit build.
9
10 * w32term.h (SCROLL_BAR_PACK): Cast the result to UINT_PTR to
11 avoid compiler warnings.
12
13 * w32proc.c (Fw32_get_codepage_charset, Fw32_set_keyboard_layout):
14 Avoid compiler warnings about cast from integer to pointer of
15 different size.
16
17 * w32menu.c (menubar_selection_callback, w32_menu_show): Cast to
18 UINT_PTR instead of EMACS_INT, to avoid compiler warnings about
19 casting from integer to pointer of different size.
20 (add_menu_item): Pass the help-echo string as a pointer to
21 Lisp_String, not as a Lisp_Object.
22 (w32_menu_display_help): Use make_lisp_ptr to reconstruct a Lisp
23 string object from its C pointer.
24
25 * w32fns.c (w32_msg_pump) <WM_EMACS_UNREGISTER_HOT_KEY>: Use
26 make_lisp_ptr instead of XIL, to reconstruct a Lisp_Cons from its
27 C pointer.
28 <WM_EMACS_TOGGLE_LOCK_KEY>: msg.lparam is now a C integer.
29 (Fx_create_frame): Type-cast the result of XFASTINT to avoild
30 compiler warnings about size differences.
31 (Fw32_unregister_hot_key): Pass the tail of w32_grabbed_keys as a
32 pointer to a Lisp_Cons struct, not as a disguised EMACS_INT.
33 (Fw32_toggle_lock_key): Pass the new state of the key as a C
34 integer; use -1 for nil. Doc fix.
35
36 * .gdbinit (xgetsym): New subroutine.
37 (xsymname, xsymbol): Use it.
38 (xprintsym): No need to call xgetptr.
39
12015-01-13 Martin Rudalics <rudalics@gmx.at> 402015-01-13 Martin Rudalics <rudalics@gmx.at>
2 41
3 * frame.c (adjust_frame_size): Make sure new numbers of 42 * frame.c (adjust_frame_size): Make sure new numbers of
diff --git a/src/lisp.h b/src/lisp.h
index a11e61213dc..ba1aff8e796 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -820,9 +820,6 @@ DEFINE_GDB_SYMBOL_END (VALMASK)
820#define MOST_POSITIVE_FIXNUM (EMACS_INT_MAX >> INTTYPEBITS) 820#define MOST_POSITIVE_FIXNUM (EMACS_INT_MAX >> INTTYPEBITS)
821#define MOST_NEGATIVE_FIXNUM (-1 - MOST_POSITIVE_FIXNUM) 821#define MOST_NEGATIVE_FIXNUM (-1 - MOST_POSITIVE_FIXNUM)
822 822
823/* Extract the pointer hidden within A. */
824LISP_MACRO_DEFUN (XPNTR, void *, (Lisp_Object a), (a))
825
826#if USE_LSB_TAG 823#if USE_LSB_TAG
827 824
828LISP_MACRO_DEFUN (make_number, Lisp_Object, (EMACS_INT n), (n)) 825LISP_MACRO_DEFUN (make_number, Lisp_Object, (EMACS_INT n), (n))
@@ -912,6 +909,9 @@ XUNTAG (Lisp_Object a, int type)
912 909
913#endif /* ! USE_LSB_TAG */ 910#endif /* ! USE_LSB_TAG */
914 911
912/* Extract the pointer hidden within A. */
913LISP_MACRO_DEFUN (XPNTR, void *, (Lisp_Object a), (a))
914
915/* Extract A's value as an unsigned integer. */ 915/* Extract A's value as an unsigned integer. */
916INLINE EMACS_UINT 916INLINE EMACS_UINT
917XUINT (Lisp_Object a) 917XUINT (Lisp_Object a)
diff --git a/src/w32fns.c b/src/w32fns.c
index 3b8346a07fd..2dd92ff8a3a 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -2543,7 +2543,7 @@ w32_msg_pump (deferred_msg * msg_buf)
2543 thread-safe. The next line is okay because the cons 2543 thread-safe. The next line is okay because the cons
2544 cell is never made into garbage and is not relocated by 2544 cell is never made into garbage and is not relocated by
2545 GC. */ 2545 GC. */
2546 XSETCAR (XIL ((EMACS_INT) msg.lParam), Qnil); 2546 XSETCAR (make_lisp_ptr ((void *)msg.lParam, Lisp_Cons), Qnil);
2547 if (!PostThreadMessage (dwMainThreadId, WM_EMACS_DONE, 0, 0)) 2547 if (!PostThreadMessage (dwMainThreadId, WM_EMACS_DONE, 0, 0))
2548 emacs_abort (); 2548 emacs_abort ();
2549 break; 2549 break;
@@ -2551,16 +2551,10 @@ w32_msg_pump (deferred_msg * msg_buf)
2551 { 2551 {
2552 int vk_code = (int) msg.wParam; 2552 int vk_code = (int) msg.wParam;
2553 int cur_state = (GetKeyState (vk_code) & 1); 2553 int cur_state = (GetKeyState (vk_code) & 1);
2554 Lisp_Object new_state = XIL ((EMACS_INT) msg.lParam); 2554 int new_state = msg.lParam;
2555 2555
2556 /* NB: This code must be thread-safe. It is safe to 2556 if (new_state == -1
2557 call NILP because symbols are not relocated by GC, 2557 || ((new_state & 1) != cur_state))
2558 and pointer here is not touched by GC (so the markbit
2559 can't be set). Numbers are safe because they are
2560 immediate values. */
2561 if (NILP (new_state)
2562 || (NUMBERP (new_state)
2563 && ((XUINT (new_state)) & 1) != cur_state))
2564 { 2558 {
2565 one_w32_display_info.faked_key = vk_code; 2559 one_w32_display_info.faked_key = vk_code;
2566 2560
@@ -4523,7 +4517,9 @@ This function is an internal primitive--use `make-frame' instead. */)
4523 /* Specify the parent under which to make this window. */ 4517 /* Specify the parent under which to make this window. */
4524 if (!NILP (parent)) 4518 if (!NILP (parent))
4525 { 4519 {
4526 f->output_data.w32->parent_desc = (Window) XFASTINT (parent); 4520 /* Cast to UINT_PTR shuts up compiler warnings about cast to
4521 pointer from integer of different size. */
4522 f->output_data.w32->parent_desc = (Window) (UINT_PTR) XFASTINT (parent);
4527 f->output_data.w32->explicit_parent = 1; 4523 f->output_data.w32->explicit_parent = 1;
4528 } 4524 }
4529 else 4525 else
@@ -7260,10 +7256,17 @@ DEFUN ("w32-unregister-hot-key", Fw32_unregister_hot_key,
7260 7256
7261 if (!NILP (item)) 7257 if (!NILP (item))
7262 { 7258 {
7259 LPARAM lparam;
7260
7261 eassert (CONSP (item));
7262 /* Pass the tail of the list as a pointer to a Lisp_Cons cell,
7263 so that it works in a --with-wide-int build as well. */
7264 lparam = (LPARAM) XUNTAG (item, Lisp_Cons);
7265
7263 /* Notify input thread about hot-key definition being removed, so 7266 /* Notify input thread about hot-key definition being removed, so
7264 that it takes effect without needing focus switch. */ 7267 that it takes effect without needing focus switch. */
7265 if (PostThreadMessage (dwWindowsThreadId, WM_EMACS_UNREGISTER_HOT_KEY, 7268 if (PostThreadMessage (dwWindowsThreadId, WM_EMACS_UNREGISTER_HOT_KEY,
7266 (WPARAM) XINT (XCAR (item)), (LPARAM) XLI (item))) 7269 (WPARAM) XINT (XCAR (item)), lparam))
7267 { 7270 {
7268 MSG msg; 7271 MSG msg;
7269 GetMessage (&msg, NULL, WM_EMACS_DONE, WM_EMACS_DONE); 7272 GetMessage (&msg, NULL, WM_EMACS_DONE, WM_EMACS_DONE);
@@ -7318,10 +7321,15 @@ DEFUN ("w32-toggle-lock-key", Fw32_toggle_lock_key,
7318 doc: /* Toggle the state of the lock key KEY. 7321 doc: /* Toggle the state of the lock key KEY.
7319KEY can be `capslock', `kp-numlock', or `scroll'. 7322KEY can be `capslock', `kp-numlock', or `scroll'.
7320If the optional parameter NEW-STATE is a number, then the state of KEY 7323If the optional parameter NEW-STATE is a number, then the state of KEY
7321is set to off if the low bit of NEW-STATE is zero, otherwise on. */) 7324is set to off if the low bit of NEW-STATE is zero, otherwise on.
7325If NEW-STATE is omitted or nil, the function toggles the state,
7326
7327Value is the new state of the key, or nil if the function failed
7328to change the state. */)
7322 (Lisp_Object key, Lisp_Object new_state) 7329 (Lisp_Object key, Lisp_Object new_state)
7323{ 7330{
7324 int vk_code; 7331 int vk_code;
7332 LPARAM lparam;
7325 7333
7326 if (EQ (key, intern ("capslock"))) 7334 if (EQ (key, intern ("capslock")))
7327 vk_code = VK_CAPITAL; 7335 vk_code = VK_CAPITAL;
@@ -7335,8 +7343,12 @@ is set to off if the low bit of NEW-STATE is zero, otherwise on. */)
7335 if (!dwWindowsThreadId) 7343 if (!dwWindowsThreadId)
7336 return make_number (w32_console_toggle_lock_key (vk_code, new_state)); 7344 return make_number (w32_console_toggle_lock_key (vk_code, new_state));
7337 7345
7346 if (NILP (new_state))
7347 lparam = -1;
7348 else
7349 lparam = (XUINT (new_state)) & 1;
7338 if (PostThreadMessage (dwWindowsThreadId, WM_EMACS_TOGGLE_LOCK_KEY, 7350 if (PostThreadMessage (dwWindowsThreadId, WM_EMACS_TOGGLE_LOCK_KEY,
7339 (WPARAM) vk_code, (LPARAM) XLI (new_state))) 7351 (WPARAM) vk_code, lparam))
7340 { 7352 {
7341 MSG msg; 7353 MSG msg;
7342 GetMessage (&msg, NULL, WM_EMACS_DONE, WM_EMACS_DONE); 7354 GetMessage (&msg, NULL, WM_EMACS_DONE, WM_EMACS_DONE);
diff --git a/src/w32heap.c b/src/w32heap.c
index f68332319c1..d5a9dae0aa4 100644
--- a/src/w32heap.c
+++ b/src/w32heap.c
@@ -114,7 +114,7 @@ typedef struct _RTL_HEAP_PARAMETERS {
114 than half of the size stated below. It would be nice to find a way 114 than half of the size stated below. It would be nice to find a way
115 to build only the first bootstrap-emacs.exe with the large size, 115 to build only the first bootstrap-emacs.exe with the large size,
116 and reset that to a lower value afterwards. */ 116 and reset that to a lower value afterwards. */
117#ifdef _WIN64 117#if defined _WIN64 || defined WIDE_EMACS_INT
118# define DUMPED_HEAP_SIZE (18*1024*1024) 118# define DUMPED_HEAP_SIZE (18*1024*1024)
119#else 119#else
120# define DUMPED_HEAP_SIZE (11*1024*1024) 120# define DUMPED_HEAP_SIZE (11*1024*1024)
diff --git a/src/w32menu.c b/src/w32menu.c
index a65e399ba5b..2742276d3f6 100644
--- a/src/w32menu.c
+++ b/src/w32menu.c
@@ -217,9 +217,9 @@ menubar_selection_callback (struct frame *f, void * client_data)
217 else 217 else
218 { 218 {
219 entry = AREF (vector, i + MENU_ITEMS_ITEM_VALUE); 219 entry = AREF (vector, i + MENU_ITEMS_ITEM_VALUE);
220 /* The EMACS_INT cast avoids a warning. There's no problem 220 /* The UINT_PTR cast avoids a warning. There's no problem
221 as long as pointers have enough bits to hold small integers. */ 221 as long as pointers have enough bits to hold small integers. */
222 if ((int) (EMACS_INT) client_data == i) 222 if ((int) (UINT_PTR) client_data == i)
223 { 223 {
224 int j; 224 int j;
225 struct input_event buf; 225 struct input_event buf;
@@ -706,7 +706,7 @@ w32_menu_show (struct frame *f, int x, int y, int menuflags,
706 wv->key = SSDATA (descrip); 706 wv->key = SSDATA (descrip);
707 /* Use the contents index as call_data, since we are 707 /* Use the contents index as call_data, since we are
708 restricted to 16-bits. */ 708 restricted to 16-bits. */
709 wv->call_data = !NILP (def) ? (void *) (EMACS_INT) i : 0; 709 wv->call_data = !NILP (def) ? (void *) (UINT_PTR) i : 0;
710 710
711 if (NILP (type)) 711 if (NILP (type))
712 wv->button_type = BUTTON_TYPE_NONE; 712 wv->button_type = BUTTON_TYPE_NONE;
@@ -1401,17 +1401,21 @@ add_menu_item (HMENU menu, widget_value *wv, HMENU item)
1401 info.cbSize = sizeof (info); 1401 info.cbSize = sizeof (info);
1402 info.fMask = MIIM_DATA; 1402 info.fMask = MIIM_DATA;
1403 1403
1404 /* Set help string for menu item. Leave it as a Lisp_Object 1404 /* Set help string for menu item. Leave it as a pointer to
1405 until it is ready to be displayed, since GC can happen while 1405 a Lisp_String until it is ready to be displayed, since GC
1406 menus are active. */ 1406 can happen while menus are active. */
1407 if (!NILP (wv->help)) 1407 if (!NILP (wv->help))
1408 { 1408 {
1409 /* We use XUNTAG below because in a 32-bit build
1410 --with-wide-int we cannot pass a Lisp_Object
1411 via a DWORD member of MENUITEMINFO. */
1409 /* As of Jul-2012, w32api headers say that dwItemData 1412 /* As of Jul-2012, w32api headers say that dwItemData
1410 has DWORD type, but that's a bug: it should actually 1413 has DWORD type, but that's a bug: it should actually
1411 be ULONG_PTR, which is correct for 32-bit and 64-bit 1414 be ULONG_PTR, which is correct for 32-bit and 64-bit
1412 Windows alike. MSVC headers get it right; hopefully, 1415 Windows alike. MSVC headers get it right; hopefully,
1413 MinGW headers will, too. */ 1416 MinGW headers will, too. */
1414 info.dwItemData = (ULONG_PTR) XLI (wv->help); 1417 eassert (STRINGP (wv->help));
1418 info.dwItemData = (ULONG_PTR) XUNTAG (wv->help, Lisp_String);
1415 } 1419 }
1416 if (wv->button_type == BUTTON_TYPE_RADIO) 1420 if (wv->button_type == BUTTON_TYPE_RADIO)
1417 { 1421 {
@@ -1487,7 +1491,10 @@ w32_menu_display_help (HWND owner, HMENU menu, UINT item, UINT flags)
1487 info.fMask = MIIM_DATA; 1491 info.fMask = MIIM_DATA;
1488 get_menu_item_info (menu, item, FALSE, &info); 1492 get_menu_item_info (menu, item, FALSE, &info);
1489 1493
1490 help = info.dwItemData ? XIL (info.dwItemData) : Qnil; 1494 help =
1495 info.dwItemData
1496 ? make_lisp_ptr ((void *) info.dwItemData, Lisp_String)
1497 : Qnil;
1491 } 1498 }
1492 1499
1493 /* Store the help echo in the keyboard buffer as the X toolkit 1500 /* Store the help echo in the keyboard buffer as the X toolkit
diff --git a/src/w32proc.c b/src/w32proc.c
index 26cfa2996d0..74731db2426 100644
--- a/src/w32proc.c
+++ b/src/w32proc.c
@@ -3077,13 +3077,18 @@ yield nil. */)
3077 (Lisp_Object cp) 3077 (Lisp_Object cp)
3078{ 3078{
3079 CHARSETINFO info; 3079 CHARSETINFO info;
3080 DWORD dwcp;
3080 3081
3081 CHECK_NUMBER (cp); 3082 CHECK_NUMBER (cp);
3082 3083
3083 if (!IsValidCodePage (XINT (cp))) 3084 if (!IsValidCodePage (XINT (cp)))
3084 return Qnil; 3085 return Qnil;
3085 3086
3086 if (TranslateCharsetInfo ((DWORD *) XINT (cp), &info, TCI_SRCCODEPAGE)) 3087 /* Going through a temporary DWORD variable avoids compiler warning
3088 about cast to pointer from integer of different size, when
3089 building --with-wide-int. */
3090 dwcp = XINT (cp);
3091 if (TranslateCharsetInfo ((DWORD *) dwcp, &info, TCI_SRCCODEPAGE))
3087 return make_number (info.ciCharset); 3092 return make_number (info.ciCharset);
3088 3093
3089 return Qnil; 3094 return Qnil;
@@ -3142,8 +3147,8 @@ If successful, the new layout id is returned, otherwise nil. */)
3142 CHECK_NUMBER_CAR (layout); 3147 CHECK_NUMBER_CAR (layout);
3143 CHECK_NUMBER_CDR (layout); 3148 CHECK_NUMBER_CDR (layout);
3144 3149
3145 kl = (HKL) ((XINT (XCAR (layout)) & 0xffff) 3150 kl = (HKL) (UINT_PTR) ((XINT (XCAR (layout)) & 0xffff)
3146 | (XINT (XCDR (layout)) << 16)); 3151 | (XINT (XCDR (layout)) << 16));
3147 3152
3148 /* Synchronize layout with input thread. */ 3153 /* Synchronize layout with input thread. */
3149 if (dwWindowsThreadId) 3154 if (dwWindowsThreadId)
diff --git a/src/w32term.h b/src/w32term.h
index 042d7abd945..c905ef15737 100644
--- a/src/w32term.h
+++ b/src/w32term.h
@@ -493,8 +493,8 @@ struct scroll_bar {
493 (XSETINT ((low), ((DWORDLONG)(int64)) & 0xffffffff), \ 493 (XSETINT ((low), ((DWORDLONG)(int64)) & 0xffffffff), \
494 XSETINT ((high), ((DWORDLONG)(int64) >> 32) & 0xffffffff)) 494 XSETINT ((high), ((DWORDLONG)(int64) >> 32) & 0xffffffff))
495#else /* not _WIN64 */ 495#else /* not _WIN64 */
496/* Building a 32-bit C integer from two 16-bit lisp integers. */ 496/* Building a 32-bit C unsigned integer from two 16-bit lisp integers. */
497#define SCROLL_BAR_PACK(low, high) (XINT (high) << 16 | XINT (low)) 497#define SCROLL_BAR_PACK(low, high) ((UINT_PTR)(XINT (high) << 16 | XINT (low)))
498 498
499/* Setting two lisp integers to the low and high words of a 32-bit C int. */ 499/* Setting two lisp integers to the low and high words of a 32-bit C int. */
500#define SCROLL_BAR_UNPACK(low, high, int32) \ 500#define SCROLL_BAR_UNPACK(low, high, int32) \