From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andy Moreton Newsgroups: gmane.emacs.bugs Subject: bug#21953: Eliminate warnings in the emacs-25 release branch Date: Wed, 25 Nov 2015 20:58:10 +0000 Message-ID: <86io4pssnx.fsf@gmail.com> References: <081tbn5g02.fsf@fencepost.gnu.org> <564E0708.8090600@yandex.ru> <83a8q998oe.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1448485170 7833 80.91.229.3 (25 Nov 2015 20:59:30 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 25 Nov 2015 20:59:30 +0000 (UTC) To: 21953@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Nov 25 21:59:17 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1a1h9f-0007Cb-3g for geb-bug-gnu-emacs@m.gmane.org; Wed, 25 Nov 2015 21:59:07 +0100 Original-Received: from localhost ([::1]:47666 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a1h9h-0002QU-2f for geb-bug-gnu-emacs@m.gmane.org; Wed, 25 Nov 2015 15:59:09 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57958) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a1h9d-0002QP-Ly for bug-gnu-emacs@gnu.org; Wed, 25 Nov 2015 15:59:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a1h9a-00018C-F8 for bug-gnu-emacs@gnu.org; Wed, 25 Nov 2015 15:59:05 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:35260) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a1h9a-000188-Bf for bug-gnu-emacs@gnu.org; Wed, 25 Nov 2015 15:59:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1a1h9a-0001y0-8Z for bug-gnu-emacs@gnu.org; Wed, 25 Nov 2015 15:59:02 -0500 X-Loop: help-debbugs@gnu.org In-Reply-To: Resent-From: Andy Moreton Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 25 Nov 2015 20:59:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 21953 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.14484851287531 (code B ref -1); Wed, 25 Nov 2015 20:59:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 25 Nov 2015 20:58:48 +0000 Original-Received: from localhost ([127.0.0.1]:53201 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1a1h9L-0001xP-9R for submit@debbugs.gnu.org; Wed, 25 Nov 2015 15:58:47 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:47862) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1a1h9H-0001xB-BB for submit@debbugs.gnu.org; Wed, 25 Nov 2015 15:58:46 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a1h9C-0000yQ-MG for submit@debbugs.gnu.org; Wed, 25 Nov 2015 15:58:42 -0500 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:52822) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a1h9C-0000yM-Jr for submit@debbugs.gnu.org; Wed, 25 Nov 2015 15:58:38 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57846) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a1h98-0002C1-Mk for bug-gnu-emacs@gnu.org; Wed, 25 Nov 2015 15:58:38 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a1h94-0000wX-PW for bug-gnu-emacs@gnu.org; Wed, 25 Nov 2015 15:58:34 -0500 Original-Received: from plane.gmane.org ([80.91.229.3]:54048) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a1h94-0000v7-IU for bug-gnu-emacs@gnu.org; Wed, 25 Nov 2015 15:58:30 -0500 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1a1h8z-0005wK-N8 for bug-gnu-emacs@gnu.org; Wed, 25 Nov 2015 21:58:26 +0100 Original-Received: from 82-69-64-228.dsl.in-addr.zen.co.uk ([82.69.64.228]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 25 Nov 2015 21:58:20 +0100 Original-Received: from andrewjmoreton by 82-69-64-228.dsl.in-addr.zen.co.uk with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 25 Nov 2015 21:58:20 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 76 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 82-69-64-228.dsl.in-addr.zen.co.uk User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (windows-nt) Cancel-Lock: sha1:Jx6037TzaL2EB4UAAa//YkPAWwE= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:109264 Archived-At: On Thu 19 Nov 2015, Eli Zaretskii wrote: >> From: "John Wiegley" >> Date: Thu, 19 Nov 2015 09:37:16 -0800 >> Cc: Richard Stallman , 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);