Skip to contentSkip to conversation

Please make "no member" error more informative

DISCUSSION Pavel Roskin 1 participant 1 message May 31, 2007 Sparse checker

lore
Share & tools
lore
#0 lore raw

Hello!

sparse reports the same error for two different situations. Suppose file test.c is:

struct ctl_table {
	int foo;
};

void test(struct ctl_table *sc)

{
	sc->ctl_name = 0;
}
$ sparse -Wall test.c 
test.c:7:4: error: no member 'ctl_name' in struct ctl_table

Rename the first ctl_table to ctl_table1, and the error will be the same.

In the first case, the structure is known and lacks the requested member. In the second case, the structure is unknown.

I'll appreciate if somebody makes the messages different. The message is printed in evaluate_member_dereference() in evaluate.c.

Please test the case when only a forward declaration is available. This should be reported like the undeclared case. Another test case is a structure with no members. It should be treated as declared.

Signature · 2 lines
Regards,
Pavel Roskin