The function
void (*sigset(int signo, void (*func)(int signo)))(int signo)
{
return(0);
}
has two parameters. But SDCC compiles it as if the parameter func was not there. Inside the function, any use of func makes SDCC complain about an undefined identifier. On calls to sigset(), SDCC accepts only a single int parameter.
Philipp
Feature Requests: #809
Wiki: SDCC 4.3.0 Release
Wiki: SDCC-STD-UX
This bug is present in at least SDCC 3.6.9 #10034 and 3.6.9 #10039.
In revision [r10039], I added a disabled test for this bug in tests/bug-2556.c.
Philipp
Last edit: Philipp Klaus Krause 2017-10-08
Diff:
Diff:
Looking at this a bit more closely, in particular at the AST:
Apparently, the function sigset gets the parameters meant for the function returned by sigset. So SDCC treats sigset as if it had a single int parameter. On the other hand, the function returned by sigset doesn't have parameters in the AST at all - not even void.
P.S.: A smaller example:
f should be a function taking an int and returning a pointer to a function taking void and returning void. But SDCC treats it as a function taking void and returning a function with no parameters.
Last edit: Philipp Klaus Krause 2022-04-19
Looking at what happens in the parser, the int parameter is first correctly attached to f, but then the void is also attached to f (overwriting the earlier int) instead of to the return type of f.
Fixed in the parser branch in [r13620].
Related
Commit: [r13620]
Fixed in [r13625].
Related
Commit: [r13625]