From mboxrd@z Thu Jan 1 00:00:00 1970 From: Joe Perches Date: Sun, 11 Sep 2016 17:56:16 +0000 Subject: Re: [PATCH 00/26] constify local structures Message-Id: <1473616576.19464.10.camel@perches.com> List-Id: References: <1473599168-30561-1-git-send-email-Julia.Lawall@lip6.fr> In-Reply-To: <1473599168-30561-1-git-send-email-Julia.Lawall-L2FTfq7BK8M@public.gmane.org> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Julia Lawall , linux-renesas-soc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org Cc: alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw@public.gmane.org, Mustafa Ismail , Tatyana Nikolova , kernel-janitors-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-fbdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, platform-driver-x86-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, devel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b@public.gmane.org, linux-scsi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-acpi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org, linux-media-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-pm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-can-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Shiraz Saleem , Sergei Shtylyov , netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Chien Tin Tung , linux-wireless-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org 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)