Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

enum constants in old-style function definition

9 views
Skip to first unread message

Jun Woong

unread,
Jul 14, 2011, 3:43:40 AM7/14/11
to
When lcc recognizes an old-style function definition, it checks if
every identifier declared in the declaration list (before the
function body) appears in the identifier list. For example, given

void foo(x) double x, y; { }

lcc balks at `y' because it does not appear in the identifier list
for parameters. The problem here is that the function to perform this
check is applied to every identifier in the ordinary namespace. This
results in issueing the following misleading diagnostic message:

declared parameter `A' is missing

for this code:

void foo(x) enum { A } x; { }

. (Of course, this function cannot be called in a portable way, but
that's not the point here)

This can be simply fixed by adding a check before the for loop in
oldparam() as follows:

if (p->sclass == ENUM)
return;
for (i = 0; callee[i]; i++)
...

Typedef names suffer no problem since their `sclass' is replaced with
`auto' before applying oldparam() to them.


Thanks.

0 new messages