Thread (15 messages) 15 messages, 6 authors, 2016-09-27

Re: [PATCH 00/26] constify local structures

From: Julia Lawall <hidden>
Date: 2016-09-11 19:11:46
Also in: alsa-devel, kernel-janitors, linux-acpi, linux-can, linux-media, linux-pm, linux-rdma, linux-renesas-soc, linux-scsi, linux-spi, linux-wireless, lkml, netdev, platform-driver-x86

On Sun, 11 Sep 2016, Joe Perches wrote:
On Sun, 2016-09-11 at 15:05 +0200, Julia Lawall wrote:
quoted
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.
OK.
Can you please compile the files modified using the
appropriate defconfig/allyesconfig and show the
I currently send patches for this issue only for files that compile using
the x86 allyesconfig.
movement from data to const by using
	$ size <object>.new/old
and include that in the changelogs (maybe next time)?
OK, thanks for the suggestion.
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)
Yes, this could be possible too.

Thanks for the feedback.

julia
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help