From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: New warnings on emacs-26 branch with gcc 8.2.0 Date: Sat, 11 Aug 2018 20:15:44 +0300 Message-ID: <83mutslt8f.fsf@gnu.org> References: <86a7q0ai2z.fsf@gmail.com> <6d36dc4c-1e14-b6c8-e2f0-911d08f759e1@cs.ucla.edu> <83in4os01j.fsf@gnu.org> <16f2754a-b40e-4bc4-f95a-9bada460d5a4@cs.ucla.edu> <83bma9mh3z.fsf@gnu.org> <86eff52njj.fsf@gmail.com> <83wosxkwfz.fsf@gnu.org> <864lg1rlp0.fsf@gmail.com> NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1534007705 8335 195.159.176.226 (11 Aug 2018 17:15:05 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 11 Aug 2018 17:15:05 +0000 (UTC) Cc: emacs-devel@gnu.org To: Andy Moreton Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Aug 11 19:15:01 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1foXTh-00023X-CQ for ged-emacs-devel@m.gmane.org; Sat, 11 Aug 2018 19:15:01 +0200 Original-Received: from localhost ([::1]:60904 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1foXVn-0002DY-MJ for ged-emacs-devel@m.gmane.org; Sat, 11 Aug 2018 13:17:11 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45564) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1foXUS-0002Cc-2J for emacs-devel@gnu.org; Sat, 11 Aug 2018 13:15:48 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1foXUN-0004ba-3g for emacs-devel@gnu.org; Sat, 11 Aug 2018 13:15:48 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:41291) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1foXUM-0004bS-WE; Sat, 11 Aug 2018 13:15:43 -0400 Original-Received: from [176.228.60.248] (port=1746 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1foXUK-0003ja-Na; Sat, 11 Aug 2018 13:15:41 -0400 In-reply-to: <864lg1rlp0.fsf@gmail.com> (message from Andy Moreton on Sat, 11 Aug 2018 16:02:03 +0100) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:228416 Archived-At: > From: Andy Moreton > Date: Sat, 11 Aug 2018 16:02:03 +0100 > > On Sat 11 Aug 2018, Eli Zaretskii wrote: > > >> From: Andy Moreton > >> Date: Sat, 11 Aug 2018 11:41:20 +0100 > >> > >> > OK, I've now done so. Andrew, please see if this fixes the original > >> > problem with this warning. > >> > >> Yes, that ha removed that batch of warnings. > > > > Thanks for testing. > > > >> There are still other warnings: one from -Wformat-overflow and 78 from > >> -Wcast-function-type. > > > > Can you show the warnings from -Wcast-function-type? > > Here are the warnings from commit ec6f588940e5, built with gcc 8.2.0. > Mostly this seems to be GetProcAddress results, where it complains that > FARPROC and the desired fuinction type don't match. The gcc manual says > that casting via "void (*)(void)" can be used to pacify the warning. > > > CC dynlib.o > C:/emacs/git/emacs/emacs-26/src/dynlib.c: In function 'dynlib_addr': > C:/emacs/git/emacs/emacs-26/src/dynlib.c:160:6: warning: cast between incompatible function types from 'FARPROC' {aka 'long long int (*)()'} to 'BOOL (*)(DWORD, const CHAR *, struct HINSTANCE__ **)' {aka 'int (*)(long unsigned int, const char *, struct HINSTANCE__ **)'} [-Wcast-function-type] > (GetModuleHandleExA_Proc) GetProcAddress (hm_kernel32, > ^ Does it help to take the GetProcAddress call in parentheses, like this: s_pfn_Get_Module_HandleExA = (GetModuleHandleExA_Proc) (GetProcAddress (hm_kernel32, "GetModuleHandleExA")); ? If this doesn't help, what about removing the cast entirely? In any case, I think it's a GCC bug: it thinks we are type-casting the function being called, which is GetProcAddress, whereas what we really want to do is cast the _value_ the function returns. Thanks.