all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#14043: 24.3.50; Compiler warning in cygw32 build on x86_64-cygwin
@ 2013-03-23 16:40 Ken Brown
  2013-03-23 18:25 ` Eli Zaretskii
  0 siblings, 1 reply; 4+ messages in thread
From: Ken Brown @ 2013-03-23 16:40 UTC (permalink / raw
  To: 14043

[-- Attachment #1: Type: text/plain, Size: 848 bytes --]

In w32term.c:w32_initialize, the line

   DWORD input_locale_id = (DWORD) GetKeyboardLayout (0);

(line 6666 in the current trunk) generates a "cast from pointer to 
integer of different size" warning in the cygw32 build on 64-bit Cygwin. 
  I think that the warning can be safely ignored in this case, but I 
would prefer to avoid it.

The attached patch fixes this.  I'm wondering, however, whether the same 
warning occurs on 64-bit Windows.  If so, maybe that should be fixed at 
the same time, but I don't know enough about Windows programming to do this.

Ken

In GNU Emacs 24.3.50.2 (x86_64-pc-cygwin)
  of 2013-03-20 on fiona
Bzr revision: 112086 eggert@cs.ucla.edu-20130318210234-bpg2y8i713w6uqhr
Windowing system distributor `Microsoft Corp.', version 6.1.7601
Configured using:
  `configure --without-makeinfo --with-w32 CFLAGS=-g3 -O0'

[-- Attachment #2: w32term.patch --]
[-- Type: text/plain, Size: 465 bytes --]

=== modified file 'src/w32term.c'
--- src/w32term.c	2013-03-15 10:07:29 +0000
+++ src/w32term.c	2013-03-23 05:52:28 +0000
@@ -6651,7 +6651,11 @@
   Fset_input_mode (Qnil, Qnil, make_number (2), Qnil);
 
   {
+#ifdef CYGWIN
+    uintptr_t input_locale_id = (uintptr_t) GetKeyboardLayout (0);
+#else
     DWORD input_locale_id = (DWORD) GetKeyboardLayout (0);
+#endif
     w32_keyboard_codepage =
       codepage_for_locale ((LCID) (input_locale_id & 0xffff));
   }


^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#14043: 24.3.50; Compiler warning in cygw32 build on x86_64-cygwin
  2013-03-23 16:40 bug#14043: 24.3.50; Compiler warning in cygw32 build on x86_64-cygwin Ken Brown
@ 2013-03-23 18:25 ` Eli Zaretskii
  2013-03-23 22:33   ` Ken Brown
  0 siblings, 1 reply; 4+ messages in thread
From: Eli Zaretskii @ 2013-03-23 18:25 UTC (permalink / raw
  To: Ken Brown; +Cc: 14043

> Date: Sat, 23 Mar 2013 12:40:38 -0400
> From: Ken Brown <kbrown@cornell.edu>
> 
> In w32term.c:w32_initialize, the line
> 
>    DWORD input_locale_id = (DWORD) GetKeyboardLayout (0);
> 
> (line 6666 in the current trunk) generates a "cast from pointer to 
> integer of different size" warning in the cygw32 build on 64-bit Cygwin. 
>   I think that the warning can be safely ignored in this case, but I 
> would prefer to avoid it.
> 
> The attached patch fixes this.

Does the alternative patch below also work?  I'd like to avoid
ifdef's, if possible.  If you still see a warning, please show the
64-bit Cygwin definitions for DWORD, DWORD_PTR, HANDLE, and HKL.

> I'm wondering, however, whether the same warning occurs on 64-bit
> Windows.

The Microsoft compiler emits much more warnings than even the latest
picky versions of GCC, so I'm quite sure it also warns here, and the
warning is (quite correctly) ignored.

=== modified file 'src/w32term.c'
--- src/w32term.c	2013-03-23 09:01:14 +0000
+++ src/w32term.c	2013-03-23 18:19:24 +0000
@@ -6663,7 +6663,7 @@ w32_initialize (void)
   Fset_input_mode (Qnil, Qnil, make_number (2), Qnil);
 
   {
-    DWORD input_locale_id = (DWORD) GetKeyboardLayout (0);
+    DWORD input_locale_id = ((DWORD_PTR) GetKeyboardLayout (0) & 0xffffffff);
     w32_keyboard_codepage =
       codepage_for_locale ((LCID) (input_locale_id & 0xffff));
   }






^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#14043: 24.3.50; Compiler warning in cygw32 build on x86_64-cygwin
  2013-03-23 18:25 ` Eli Zaretskii
@ 2013-03-23 22:33   ` Ken Brown
  2013-03-24  0:17     ` Ken Brown
  0 siblings, 1 reply; 4+ messages in thread
From: Ken Brown @ 2013-03-23 22:33 UTC (permalink / raw
  To: Eli Zaretskii; +Cc: 14043

On 3/23/2013 2:25 PM, Eli Zaretskii wrote:
> Does the alternative patch below also work?  I'd like to avoid
> ifdef's, if possible.

Yes, it does.  I too am glad to see a solution that avoids the ifdefs.

Thanks.

Ken






^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#14043: 24.3.50; Compiler warning in cygw32 build on x86_64-cygwin
  2013-03-23 22:33   ` Ken Brown
@ 2013-03-24  0:17     ` Ken Brown
  0 siblings, 0 replies; 4+ messages in thread
From: Ken Brown @ 2013-03-24  0:17 UTC (permalink / raw
  To: Eli Zaretskii; +Cc: 14043-done

On 3/23/2013 6:33 PM, Ken Brown wrote:
> On 3/23/2013 2:25 PM, Eli Zaretskii wrote:
>> Does the alternative patch below also work?  I'd like to avoid
>> ifdef's, if possible.
>
> Yes, it does.  I too am glad to see a solution that avoids the ifdefs.

I've committed the change as bzr revision 112120 and am closing the bug 
report.

Ken





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-03-24  0:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-23 16:40 bug#14043: 24.3.50; Compiler warning in cygw32 build on x86_64-cygwin Ken Brown
2013-03-23 18:25 ` Eli Zaretskii
2013-03-23 22:33   ` Ken Brown
2013-03-24  0:17     ` Ken Brown

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.