From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#23771: Eliminating compiler warnings Date: Thu, 16 Jun 2016 18:14:37 +0300 Message-ID: <83inx9cgiq.fsf@gnu.org> References: <08ec82d8-305e-5a95-7fbb-76162a49f5cc@cornell.edu> <83bn32eclh.fsf@gnu.org> <3f178870-9b99-8104-cb34-1967790436a5@cornell.edu> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1466091791 2496 80.91.229.3 (16 Jun 2016 15:43:11 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 16 Jun 2016 15:43:11 +0000 (UTC) Cc: 23771@debbugs.gnu.org, eggert@cs.ucla.edu To: Ken Brown Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Jun 16 17:42:56 2016 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 1bDZRW-0002Jn-Mh for geb-bug-gnu-emacs@m.gmane.org; Thu, 16 Jun 2016 17:42:54 +0200 Original-Received: from localhost ([::1]:50206 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bDZRV-0002G5-T5 for geb-bug-gnu-emacs@m.gmane.org; Thu, 16 Jun 2016 11:42:53 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34855) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bDYzd-0006k6-JH for bug-gnu-emacs@gnu.org; Thu, 16 Jun 2016 11:14:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bDYzZ-0008TT-TW for bug-gnu-emacs@gnu.org; Thu, 16 Jun 2016 11:14:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:59340) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bDYzZ-0008TP-Q2 for bug-gnu-emacs@gnu.org; Thu, 16 Jun 2016 11:14:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1bDYzZ-0005tL-Mt for bug-gnu-emacs@gnu.org; Thu, 16 Jun 2016 11:14:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 16 Jun 2016 15:14:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 23771 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 23771-submit@debbugs.gnu.org id=B23771.146609003222621 (code B ref 23771); Thu, 16 Jun 2016 15:14:01 +0000 Original-Received: (at 23771) by debbugs.gnu.org; 16 Jun 2016 15:13:52 +0000 Original-Received: from localhost ([127.0.0.1]:43444 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bDYzP-0005sn-Ss for submit@debbugs.gnu.org; Thu, 16 Jun 2016 11:13:52 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:43784) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bDYzO-0005sb-8A for 23771@debbugs.gnu.org; Thu, 16 Jun 2016 11:13:50 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bDYzH-0008OQ-UV for 23771@debbugs.gnu.org; Thu, 16 Jun 2016 11:13:45 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:47668) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bDYzD-0008Nn-64; Thu, 16 Jun 2016 11:13:39 -0400 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:3119 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1bDYzB-00082N-BG; Thu, 16 Jun 2016 11:13:37 -0400 In-reply-to: <3f178870-9b99-8104-cb34-1967790436a5@cornell.edu> (message from Ken Brown on Wed, 15 Jun 2016 21:38:19 -0400) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] 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" Xref: news.gmane.org gmane.emacs.bugs:119625 Archived-At: > Cc: 23771@debbugs.gnu.org, Paul Eggert > From: Ken Brown > Date: Wed, 15 Jun 2016 21:38:19 -0400 > > > What warnings does that option produce? I'm not sure I've seen any > > warnings about addresses, but maybe I misunderstand the nature of the > > warning. > > Here's a typical example: > > ../../master/src/menu.c: In function ‘digest_single_submenu’: > ../../master/src/menu.c:46:30: warning: the address of ‘AppendMenuW’ > will always evaluate as ‘true’ [-Waddress] > # define unicode_append_menu AppendMenuW > ^ > ../../master/src/menu.c:691:9: note: in expansion of macro > ‘unicode_append_menu’ > if (unicode_append_menu) > ^ For this one, I'd suggest to make unicode_append_menu a variable in the Cygwin build as well, and then do this: AppendMenuW_Proc unicode_append_menu = AppendMenuW; > >> +#else /* not HAVE_WINDOW_SYSTEM */ > >> + > >> +_Noreturn void > >> +decode_window_system_frame (Lisp_Object frame) > >> +{ > >> + error ("Window system is not in use"); > >> +} > >> + > >> +_Noreturn void > >> +check_window_system (struct frame *f) > >> +{ > >> + error ("Window system is not in use"); > >> +} > >> + > >> +#endif /* not HAVE_WINDOW_SYSTEM */ > > > > What kind of warnings do you get without these changes? I don't > > understand why this is needed. > > A build with no windows system yields these warnings: > > ../../warnings/src/frame.c: In function ‘decode_window_system_frame’: > ../../warnings/src/frame.c:119:1: warning: function might be candidate > for attribute ‘noreturn’ [-Wsuggest-attribute=noreturn] > decode_window_system_frame (Lisp_Object frame) > ^ How about making check_window_system compile in the no-X builds? > >> --- a/src/conf_post.h > >> +++ b/src/conf_post.h > >> @@ -211,7 +211,7 @@ You lose; /* Emacs for DOS must be compiled with DJGPP */ > >> extern void _DebPrint (const char *fmt, ...); > >> # define DebPrint(stuff) _DebPrint stuff > >> # else > >> -# define DebPrint(stuff) > >> +# define DebPrint(stuff) {} > >> # endif > >> #endif > > > > Yuck! Can we simply not use the "empty body" warning option? When is > > it important to flag an empty body of a function? > > Here's a typical example: > > Code like this: > > if (!f->output_data.w32->asked_for_visible) > DebPrint (("frame %p (%s) reexposed by WM_PAINT\n", f, > SDATA (f->name))); > > leads to this warning (if EMACSDEBUG is not defined): > > ../../warnings/src/w32term.c: In function ‘w32_read_socket’: > ../../warnings/src/w32term.c:4613:28: warning: suggest braces around > empty body in an ‘if’ statement [-Wempty-body] > SDATA (f->name))); > ^ One way of fixing this is to add those braces. > But I'd be fine with just disabling this warning, at least for the w32 > builds. Right.