Skip to content

Missing matches for struct initalizations #21

@mripard

Description

@mripard

If we have the following code

struct test {
	unsigned long first;
	unsigned long second;
};

const static struct test const_struct = {
	.first = 42,
};

int func(struct test *test)
{
	test->first = 42;

	return 0;
}

int main()
{
	struct test new_struct = {
		.first = 14,
	};
	struct test other_struct;

	other_struct.first = 84;

	return 0;
}

Then, coccigrep -t "struct test" -a first -o set test.c only returns the first assignments in the code:

test.c:12 (struct test *test):		test->first = 42;
test.c:24 (struct test other_struct):		other_struct.first = 84;

However, all the ones done in the structures initialization are missing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions