Return-path: Received: from smtprelay0219.hostedemail.com ([216.40.44.219]:49545 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1756190AbcIKR4d (ORCPT ); Sun, 11 Sep 2016 13:56:33 -0400 Message-ID: <1473616576.19464.10.camel@perches.com> (sfid-20160911_195644_722509_9A21E180) Subject: Re: [PATCH 00/26] constify local structures From: Joe Perches To: Julia Lawall , linux-renesas-soc@vger.kernel.org Cc: kernel-janitors@vger.kernel.org, Sergei Shtylyov , linux-pm@vger.kernel.org, platform-driver-x86@vger.kernel.org, linux-media@vger.kernel.org, linux-can@vger.kernel.org, Tatyana Nikolova , Shiraz Saleem , Mustafa Ismail , Chien Tin Tung , linux-rdma@vger.kernel.org, netdev@vger.kernel.org, devel@driverdev.osuosl.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, linux-fbdev@vger.kernel.org, linux-wireless@vger.kernel.org, Jason Gunthorpe , tpmdd-devel@lists.sourceforge.net, linux-scsi@vger.kernel.org, linux-spi@vger.kernel.org, linux-usb@vger.kernel.org, linux-acpi@vger.kernel.org Date: Sun, 11 Sep 2016 10:56:16 -0700 In-Reply-To: <1473599168-30561-1-git-send-email-Julia.Lawall@lip6.fr> References: <1473599168-30561-1-git-send-email-Julia.Lawall@lip6.fr> Content-Type: text/plain; charset="ISO-8859-1" Mime-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org List-ID: On Sun, 2016-09-11 at 15:05 +0200, Julia Lawall wrote: > Constify local structures. Thanks Julia. A few suggestions & questions: Perhaps the script should go into scripts/coccinelle/ so that future cases could be caught by the robot and commit message referenced by the patch instances. Can you please compile the files modified using the appropriate defconfig/allyesconfig and show the movement from data to const by using $ size .new/old and include that in the changelogs (maybe next time)? Is it possible for a rule to trace the instances where an address of a struct or struct member is taken by locally defined and declared function call where the callee does not modify any dereferenced object? ie: struct foo { int bar; char *baz; }; struct foo qux[] = { { 1, "description 1" }, { 2, "dewcription 2" }, [ n, "etc" ]..., }; void message(struct foo *msg) { printk("%d %s\n", msg->bar, msg->baz); } where some code uses message(qux[index]); So could a coccinelle script change: struct foo qux[] = { to const struct foo quz[] = { and void message(struct foo *msg) to void message(const struct foo *msg)