bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#21953: Eliminate warnings in the emacs-25 release branch


From: Andy Moreton
Subject: bug#21953: Eliminate warnings in the emacs-25 release branch
Date: Wed, 25 Nov 2015 20:58:10 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (windows-nt)

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);






reply via email to

[Prev in Thread] Current Thread [Next in Thread]