all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Andy Moreton <andrewjmoreton@gmail.com>
To: 21953@debbugs.gnu.org
Subject: bug#21953: Eliminate warnings in the emacs-25 release branch
Date: Wed, 25 Nov 2015 20:58:10 +0000	[thread overview]
Message-ID: <86io4pssnx.fsf@gmail.com> (raw)
In-Reply-To: <m2oaercie3.fsf@newartisans.com>

On Thu 19 Nov 2015, Eli Zaretskii wrote:

>> From: "John Wiegley" <jwiegley@gmail.com>
>> Date: Thu, 19 Nov 2015 09:37:16 -0800
>> Cc: Richard Stallman <rms@gnu.org>, 21953@debbugs.gnu.org
>> 
>> By 25.2, anything that is built using "make" should be warning free, both C
>> and Emacs Lisp
>
> We can stop worrying about warnings in C: there are none, and a few
> people regularly compile with pedantic compiler switches and fix
> whatever they flag.

There are three in the mingw64 build (on emacs-25 or master branch):

../../src/w32.c: In function 'sys_socket':
../../src/w32.c:7435:14: warning: overflow in implicit constant conversion [-Woverflow]
       return INVALID_SOCKET;
              ^
../../src/w32.c: In function 'maybe_load_unicows_dll':
../../src/w32.c:9273:25: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types]
    pMultiByteToWideChar = GetProcAddress (ret, "MultiByteToWideChar");
                         ^
../../src/w32.c:9274:25: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types]
    pWideCharToMultiByte = GetProcAddress (ret, "WideCharToMultiByte");
                         ^

The following patch fixes them. Note that on 64bit windows a socket
handle is a 64bit type, so using int for socket handles is not entirely
correct, but does not seem to cause problems.


diff --git a/src/w32.c b/src/w32.c
index 9601012acd6a..bf91742ca405 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -7432,7 +7432,7 @@ sys_socket (int af, int type, int protocol)
   if (winsock_lib == NULL)
     {
       errno = ENETDOWN;
-      return INVALID_SOCKET;
+      return (int) INVALID_SOCKET;
     }
 
   check_errno ();
@@ -9270,8 +9270,10 @@ maybe_load_unicows_dll (void)
 	     pointers, and assign the correct addresses to these
 	     pointers at program startup (see emacs.c, which calls
 	     this function early on).  */
-	  pMultiByteToWideChar = GetProcAddress (ret, "MultiByteToWideChar");
-	  pWideCharToMultiByte = GetProcAddress (ret, "WideCharToMultiByte");
+	  pMultiByteToWideChar =
+            (MultiByteToWideChar_Proc) GetProcAddress (ret, "MultiByteToWideChar");
+	  pWideCharToMultiByte =
+            (WideCharToMultiByte_Proc) GetProcAddress (ret, "WideCharToMultiByte");
 	  return ret;
 	}
       else
diff --git a/src/w32.h b/src/w32.h
index 2c711502593a..ee321a388945 100644
--- a/src/w32.h
+++ b/src/w32.h
@@ -179,8 +179,11 @@ extern int _sys_wait_connect (int fd);
 
 extern HMODULE w32_delayed_load (Lisp_Object);
 
-extern int (WINAPI *pMultiByteToWideChar)(UINT,DWORD,LPCSTR,int,LPWSTR,int);
-extern int (WINAPI *pWideCharToMultiByte)(UINT,DWORD,LPCWSTR,int,LPSTR,int,LPCSTR,LPBOOL);
+typedef int (WINAPI *MultiByteToWideChar_Proc)(UINT,DWORD,LPCSTR,int,LPWSTR,int);
+extern MultiByteToWideChar_Proc pMultiByteToWideChar;
+
+typedef int (WINAPI *WideCharToMultiByte_Proc)(UINT,DWORD,LPCWSTR,int,LPSTR,int,LPCSTR,LPBOOL);
+extern WideCharToMultiByte_Proc pWideCharToMultiByte;
 
 extern void init_environment (char **);
 extern void check_windows_init_file (void);






  parent reply	other threads:[~2015-11-25 20:58 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-18 17:44 bug#21953: Eliminate warnings in the emacs-25 release branch John Wiegley
2015-11-18 17:58 ` Eli Zaretskii
2015-11-18 18:04 ` Dmitry Gutov
2015-11-18 18:17 ` Glenn Morris
2015-11-18 18:44   ` Eli Zaretskii
2015-11-23 19:10     ` Glenn Morris
2015-11-23 22:04       ` John Wiegley
2015-11-23 22:47         ` Drew Adams
2015-11-24  3:30         ` Eli Zaretskii
2015-11-24  3:40           ` John Wiegley
2015-11-24 17:40             ` Glenn Morris
2015-11-25  1:03               ` John Wiegley
2015-11-18 19:09   ` Artur Malabarba
2015-11-18 20:36     ` Eli Zaretskii
2015-11-18 20:57       ` Artur Malabarba
2015-11-19  2:06   ` John Wiegley
2015-11-19 17:20     ` Stephen Leake
2015-11-19 17:29     ` Dmitry Gutov
2015-11-19 17:37       ` John Wiegley
2015-11-19 17:46         ` Dmitry Gutov
2015-11-19 17:54         ` Eli Zaretskii
2015-11-19 18:18           ` John Wiegley
2015-11-19 18:34           ` Juanma Barranquero
2015-11-19 19:05             ` John Wiegley
2015-11-19 20:29               ` Eli Zaretskii
2015-11-19 20:25             ` Eli Zaretskii
2015-11-19 20:31               ` Juanma Barranquero
2015-11-19 20:51                 ` Eli Zaretskii
2015-11-20  0:26                   ` Juanma Barranquero
2015-11-25 20:58           ` Andy Moreton [this message]
2015-11-26 17:55             ` Eli Zaretskii
2015-11-19 20:01         ` David Engster
2015-11-19 20:26           ` John Wiegley
2015-11-19 20:32           ` Eli Zaretskii
2015-11-20 10:41         ` Stephen Leake
2015-11-19 17:45       ` Eli Zaretskii
2015-11-18 18:39 ` Ken Brown
2015-11-18 18:52   ` Eli Zaretskii
2015-11-18 19:19     ` Ken Brown
2015-11-18 20:38       ` Eli Zaretskii
2015-11-18 20:57 ` Stephen Berman
     [not found] ` <mailman.233.1447954214.31583.bug-gnu-emacs@gnu.org>
2015-11-24 19:55   ` Alan Mackenzie
2015-11-25  0:28     ` Dmitry Gutov
2015-11-25  9:31       ` Alan Mackenzie
2015-11-25 14:36         ` Dmitry Gutov
2015-11-25 15:50           ` Alan Mackenzie
2015-11-25 18:54         ` Glenn Morris
2015-11-26  8:33 ` Andreas Röhler
2015-11-26 15:51   ` Eli Zaretskii
2015-11-28 18:44     ` John Wiegley
2015-11-29  9:13       ` Andreas Röhler
2015-11-30  0:38         ` Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86io4pssnx.fsf@gmail.com \
    --to=andrewjmoreton@gmail.com \
    --cc=21953@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.