From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.devel Subject: Re: C warning in MSYS2 build Date: Thu, 5 Oct 2017 12:32:26 -0700 Organization: UCLA Computer Science Department Message-ID: <281d43c7-b3a9-be40-a8e7-c8021c286f59@cs.ucla.edu> References: <83inftwhlb.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------5297C21A653B880DBE322FA7" X-Trace: blaine.gmane.org 1507231968 6144 195.159.176.226 (5 Oct 2017 19:32:48 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 5 Oct 2017 19:32:48 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 Cc: Richard Copley , Eli Zaretskii To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Oct 05 21:32:44 2017 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 1e0Bsu-0000bp-GD for ged-emacs-devel@m.gmane.org; Thu, 05 Oct 2017 21:32:40 +0200 Original-Received: from localhost ([::1]:41765 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e0Bt1-0003hU-KX for ged-emacs-devel@m.gmane.org; Thu, 05 Oct 2017 15:32:47 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60499) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e0Bsu-0003hO-Od for emacs-devel@gnu.org; Thu, 05 Oct 2017 15:32:41 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e0Bst-00074t-RV for emacs-devel@gnu.org; Thu, 05 Oct 2017 15:32:40 -0400 Original-Received: from zimbra.cs.ucla.edu ([131.179.128.68]:33420) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e0Bsq-00070b-1A; Thu, 05 Oct 2017 15:32:36 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 16CD7160E42; Thu, 5 Oct 2017 12:32:33 -0700 (PDT) Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id V6r173sBLLPb; Thu, 5 Oct 2017 12:32:32 -0700 (PDT) Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id E8344160E4E; Thu, 5 Oct 2017 12:32:31 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id EWfdoXJ-a1iK; Thu, 5 Oct 2017 12:32:31 -0700 (PDT) Original-Received: from Penguin.CS.UCLA.EDU (Penguin.CS.UCLA.EDU [131.179.64.200]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id C8498160E42; Thu, 5 Oct 2017 12:32:31 -0700 (PDT) In-Reply-To: <83inftwhlb.fsf@gnu.org> Content-Language: en-US X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 131.179.128.68 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:219139 Archived-At: This is a multi-part message in MIME format. --------------5297C21A653B880DBE322FA7 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit On 10/05/2017 11:54 AM, Eli Zaretskii wrote: > Thanks, but it isn't new. In my experience this kind of warning can appear and vanish almost at whim: compiling at a different optimization levels, or changing compilation in some other way, can cause GCC to omit or include the warning. So possibly Richard wasn't getting the warning a day ago, but got the warning after changing from -O2 to -O0 (or whatever), or by upgrading GCC. If it's a major annoyance we could disable --Wnull-dereference for indent.c. I hope that's not needed, though. Come to think of it, last year I filed a GCC bug report about a similar problem with lib-src/etags.c and -Wnull-dereference, here: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71157 The GCC bug is not fixed yet. etags.c confused GCC by using an assignment inside an 'if' expression, which is contrary to the usual GNU style, and last year I worked around the GCC bug by changing etags.c to use a cleaner style. I notice that indent.c also has an assignment inside an 'if' expression that is relevant to these warnings. Richard, does it help to recode indent.c to use the usual GNU style, as in the attached patch? If so, let's do that instead. (Perhaps we should do that anyway....) --------------5297C21A653B880DBE322FA7 Content-Type: text/x-patch; name="indent.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="indent.diff" diff --git a/src/indent.c b/src/indent.c index 26507b5eb5..79841a3d2c 100644 --- a/src/indent.c +++ b/src/indent.c @@ -76,15 +76,17 @@ buffer_display_table (void) static int character_width (int c, struct Lisp_Char_Table *dp) { - Lisp_Object elt; - /* These width computations were determined by examining the cases in display_text_line. */ /* Everything can be handled by the display table, if it's present and the element is right. */ - if (dp && (elt = DISP_CHAR_VECTOR (dp, c), VECTORP (elt))) - return ASIZE (elt); + if (dp) + { + Lisp_Object elt = DISP_CHAR_VECTOR (dp, c); + if (VECTORP (elt)) + return ASIZE (elt); + } /* Some characters are special. */ if (c == '\n' || c == '\t' || c == '\015') --------------5297C21A653B880DBE322FA7--