GNU bug report logs - #21953
Eliminate warnings in the emacs-25 release branch

Previous Next

Package: emacs;

Reported by: John Wiegley <jwiegley <at> gmail.com>

Date: Wed, 18 Nov 2015 17:45:01 UTC

Severity: normal

Done: John Wiegley <jwiegley <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #142 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Andy Moreton <andrewjmoreton <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: Re: bug#21953: Eliminate warnings in the emacs-25 release branch
Date: Wed, 25 Nov 2015 20:58:10 +0000
On Thu 19 Nov 2015, Eli Zaretskii wrote:

>> From: "John Wiegley" <jwiegley <at> gmail.com>
>> Date: Thu, 19 Nov 2015 09:37:16 -0800
>> Cc: Richard Stallman <rms <at> gnu.org>, 21953 <at> 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);





This bug report was last modified 9 years and 256 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.