From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Konstantin Kharlamov Newsgroups: gmane.emacs.bugs Subject: bug#35062: [PATCH 0/4] Trivial code cleanups Date: Mon, 01 Apr 2019 16:35:50 +0300 Message-ID: <1554125750.2712.1@yandex.ru> References: <1554071761.31929.0@yandex.ru> <20190331223742.1351-1-Hi-Angel@yandex.ru> <83d0m6gx30.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="145726"; mail-complaints-to="usenet@blaine.gmane.org" Cc: 35062@debbugs.gnu.org To: Robert Pluim Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Apr 01 15:37:18 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hAx7l-000bmp-0J for geb-bug-gnu-emacs@m.gmane.org; Mon, 01 Apr 2019 15:37:17 +0200 Original-Received: from localhost ([127.0.0.1]:52363 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hAx7k-0008Kf-05 for geb-bug-gnu-emacs@m.gmane.org; Mon, 01 Apr 2019 09:37:16 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:38547) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hAx7X-0008H2-9T for bug-gnu-emacs@gnu.org; Mon, 01 Apr 2019 09:37:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hAx7W-0004ii-6D for bug-gnu-emacs@gnu.org; Mon, 01 Apr 2019 09:37:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:53634) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hAx7W-0004ic-0a for bug-gnu-emacs@gnu.org; Mon, 01 Apr 2019 09:37:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hAx7V-0007gv-Pz for bug-gnu-emacs@gnu.org; Mon, 01 Apr 2019 09:37:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Konstantin Kharlamov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 01 Apr 2019 13:37:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 35062 X-GNU-PR-Package: emacs Original-Received: via spool by 35062-submit@debbugs.gnu.org id=B35062.155412576229491 (code B ref 35062); Mon, 01 Apr 2019 13:37:01 +0000 Original-Received: (at 35062) by debbugs.gnu.org; 1 Apr 2019 13:36:02 +0000 Original-Received: from localhost ([127.0.0.1]:38945 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hAx6Y-0007fZ-GN for submit@debbugs.gnu.org; Mon, 01 Apr 2019 09:36:02 -0400 Original-Received: from forward104p.mail.yandex.net ([77.88.28.107]:38400) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hAx6V-0007f2-IC for 35062@debbugs.gnu.org; Mon, 01 Apr 2019 09:36:01 -0400 Original-Received: from mxback21o.mail.yandex.net (mxback21o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::72]) by forward104p.mail.yandex.net (Yandex) with ESMTP id DDEDA4B00BA5; Mon, 1 Apr 2019 16:35:52 +0300 (MSK) Original-Received: from smtp2o.mail.yandex.net (smtp2o.mail.yandex.net [2a02:6b8:0:1a2d::26]) by mxback21o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id 7CXFBKFSc7-ZqtiucSd; Mon, 01 Apr 2019 16:35:52 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1554125752; bh=bLbTKJUYIxZx0lPQ7AuW8sI2kMBPRE8kmGKbLeo2ZdI=; h=In-Reply-To:Cc:To:Subject:From:References:Date:Message-Id; b=t2L1wlBn9Bk0EGoGLDJcL/if8piVQiXehxa2M26K+mLR0ylRqWiy9GPaqwde8QD1O RN7CCXSFcCT8cUx/2dHxDAOVKwMZuOm2/qxf4QcwKDmi0acghcYAw0ZdZcQGKEs/Dt mWM1HxzXqDWu7uW31htUmUJo590qgiTSxqk7qaF4= Authentication-Results: mxback21o.mail.yandex.net; dkim=pass header.i=@yandex.ru Original-Received: by smtp2o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id jDycksQG8h-ZpW8TR5t; Mon, 01 Apr 2019 16:35:51 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client certificate not present) In-Reply-To: X-Mailer: geary/master~gdb0eb345-dirty 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: 209.51.188.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:157023 Archived-At: On =D0=9F=D0=BD, Apr 1, 2019 at 15:27, Robert Pluim wrot= e: >>>>>> On Mon, 01 Apr 2019 07:37:23 +0300, Eli Zaretskii=20 >>>>>> said: >=20 > >> From: Konstantin Kharlamov Date: Mon, 1 > >> Apr 2019 01:37:38 +0300 > >> > >> These are mostly fixes of some of LGTM warnings > >>=20 > https://lgtm.com/projects/g/emacs-mirror/emacs/alerts/?mode=3Dtree > >> > >> Except the second patch, where I initially wanted to fix one > >> warning, and as part of it I had to constify a variable to see > >> that it is indeed immutable. And then I figured I could search > >> through the code and find more similar places, where variables > >> weren't marked as const. I like this cleanup because it is > >> simple and trivially testable (i.e. if it compiles, then it's > >> fine). FTR: there's still lots of opportunities for > >> constification, I just stopped at some point. >=20 > Eli> Thanks. >=20 > Eli> I think the general policy is not to fix those except when > Eli> making other changes in the same function, but I will let > Eli> others comment. >=20 > I=CA=BCd prefer it if the effort went to determining if eg the alert for > 'type =3D 2' below was correct or not, proving the constness of > variables is what we have a compiler for. >=20 > xterm.c:5346 >=20 > if (XSCROLL_BAR (bar)->x_window =3D=3D window_id > && FRAME_X_DISPLAY (XFRAME (frame)) =3D=3D display > && (type =3D 2 > || (type =3D=3D 1 && XSCROLL_BAR (bar)->horizontal) > || (type =3D=3D 0 && !XSCROLL_BAR (bar)->horizontal))) > return XSCROLL_BAR (bar); >=20 > Robert Well, not everything at once! :) I afraid that if I fix lots of=20 warnings in one patch-set, it may get stuck in review because of the=20 amount of changes; besides it's easier for my sanity to send small=20 patchsets because mailing-list based projects in general tend not to=20 accept patches too quickly. Also note: the constness here is not for compiler but for developers. =