From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Bruno Haible Newsgroups: gmane.comp.lib.gnulib.bugs,gmane.emacs.devel Subject: Re: New warnings on emacs-26 branch with gcc 8.2.0 Date: Sat, 18 Aug 2018 18:09:27 +0200 Message-ID: <4195986.6xTypejAr3@omega> References: <86a7q0ai2z.fsf@gmail.com> <86y3d88x1u.fsf@gmail.com> <9ab72594-da61-a3f4-cac4-6e61cda67da3@cs.ucla.edu> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7Bit X-Trace: blaine.gmane.org 1534608459 15590 195.159.176.226 (18 Aug 2018 16:07:39 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 18 Aug 2018 16:07:39 +0000 (UTC) User-Agent: KMail/5.1.3 (Linux/4.4.0-130-generic; KDE/5.18.0; x86_64; ; ) Cc: Paul Eggert , Andy Moreton , emacs-devel@gnu.org To: bug-gnulib@gnu.org Original-X-From: bug-gnulib-bounces+gnu-bug-gnulib=m.gmane.org@gnu.org Sat Aug 18 18:07:35 2018 Return-path: Envelope-to: gnu-bug-gnulib@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 1fr3lE-0003rk-Ci for gnu-bug-gnulib@m.gmane.org; Sat, 18 Aug 2018 18:07:32 +0200 Original-Received: from localhost ([::1]:39650 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fr3nK-0000ci-Ug for gnu-bug-gnulib@m.gmane.org; Sat, 18 Aug 2018 12:09:42 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:42349) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fr3nB-0000cR-9t for bug-gnulib@gnu.org; Sat, 18 Aug 2018 12:09:33 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fr3nA-0002rD-J7 for bug-gnulib@gnu.org; Sat, 18 Aug 2018 12:09:33 -0400 Original-Received: from mo6-p01-ob.smtp.rzone.de ([2a01:238:20a:202:5301::7]:32708) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fr3nA-0002qD-2K; Sat, 18 Aug 2018 12:09:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1534608570; s=strato-dkim-0002; d=clisp.org; h=References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: X-RZG-CLASS-ID:X-RZG-AUTH:From:Subject:Sender; bh=tXcrqcK0lCSM1DNMgvTl2lR9ybVZBzuWdRnVdb6YrnE=; b=Z0r856u9fhjytBSDAgVgVIstjZMDrBpaANKWZ1Tan5z9+MS3B9cv/EvEA2hXQ0Quiz QduXbRK2d0fwF0n11Ppo3bkToW3l6u8o/981bIKpH7LarHFcCddFPOXrsh6LOIzC6q6c 5wuXCfovqRSKBFq3rkql6xuUIWSWkOQSr8Y8TK/zbLr3cTL2gW/q1r2Rws5fDhHyilMf SL9VEwk6bD2PR8enl0m+sXZSZiGN6oMOMme7ncUqfhTJvJM7zetEGydpx2G6LHfWsUaF YVKK0UYbRw0Ig3COs49GdzMOzksjVPUDlQtbK/RAhcGsqTyx77tbQonKin1wJZxNctip 40VA== X-RZG-AUTH: ":Ln4Re0+Ic/6oZXR1YgKryK8brlshOcZlIWs+iCP5vnk6shH+AHjwLuWOHqf9yfs=" X-RZG-CLASS-ID: mo00 Original-Received: from bruno.haible.de by smtp.strato.de (RZmta 43.18 DYNA|AUTH) with ESMTPSA id n0457au7IG9RKzH (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (curve secp521r1 with 521 ECDH bits, eq. 15360 bits RSA)) (Client did not present a certificate); Sat, 18 Aug 2018 18:09:27 +0200 (CEST) In-Reply-To: <9ab72594-da61-a3f4-cac4-6e61cda67da3@cs.ucla.edu> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a01:238:20a:202:5301::7 X-BeenThere: bug-gnulib@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Gnulib discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnulib-bounces+gnu-bug-gnulib=m.gmane.org@gnu.org Original-Sender: "bug-gnulib" Xref: news.gmane.org gmane.comp.lib.gnulib.bugs:39207 gmane.emacs.devel:228660 Archived-At: > > There is also one function cast warning from gnulib code: > > C:/emacs/git/emacs/master/lib/gettimeofday.c: In function 'initialize': > > C:/emacs/git/emacs/master/lib/gettimeofday.c:48:9: warning: cast between incompatible function types from 'FARPROC' {aka 'long long int (*)()'} to 'void (*)(FILETIME *)' {aka 'void (*)(struct _FILETIME *)'} [-Wcast-function-type] > > (GetSystemTimePreciseAsFileTimeFuncType) GetProcAddress (kernel32, "GetSystemTimePreciseAsFileTime"); > > ^ The cast is there, because the results of GetProcAddress or dlsym need to be cast to the proper function type before they can be invoked. This code uses GetProcAddress so that it can exploit features of newer Windows versions while at the same time still work on older Windows versions. The warning is there because you specified -Wcast-function-type. You *wanted* to get informed about the cast. You got informed. So, there are 4 options: 1) Use static reference to Windows API functions. 2) Use '#pragma GCC diagnostic ignored "-Wcast-function-type"' 3) Remove -Wcast-function-type from the compiler options. 4) Live with the warning. I'm opposed to 1), since it removes either features or portability. I could do 2), but it does not feel like the right thing, to silence a compiler warning when the user has explicitly requested a warning. So, please choose among 3) and 4). Bruno