Closed HobbitDur closed 3 years ago
Please try with the just released Hawkmoth 0.6, and if it's still failing, please provide a small example that reproduces the issue.
Hi. Thank you for the update. I just tried and it is still falling. A small example is simply a file with a typedef:
typedef struct drv_rtc_func_s
{
/** Test */
int (*tutu)(int tata);
} drv_rtc_func_t;
And the error:
WARNING: Error in declarator If declarator-id with parameters: Invalid C declaration: Expected identifier in nested name. [error at 4] int (*)(int) tutu ----^ If parenthesis in noptr-declarator: Error in declarator or parameters Invalid C declaration: Expected identifier in nested name. [error at 6] int (*)(int) tutu ------^
Thanks for the minimal example. The quick fix is in the function-pointer-fix
branch.
https://github.com/jnikula/hawkmoth/tree/function-pointer-fix
@jnikula On my windows, I did a pip install git+https://github.com/jnikula/hawkmoth.git@function-pointer-fix, and got the answer: Collecting git+https://github.com/jnikula/hawkmoth.git@function-pointer-fix Cloning https://github.com/jnikula/hawkmoth.git (to revision function-pointer-fix)
So I guess the cloning worked fine. But I still got the same error.
What did I miss ?
I am not sure, but if you're installing in a (virtual) environment where you have hawkmoth already installed, the branch would actually still have the same version, and pip perhaps does not know to upgrade. Maybe you'd also need to use -U
. Anyway, perhaps try removing and reinstalling?
Removed and reinstalled. It worked ! The bug is solved then.
Thanks for testing! Again, I'll give @BrunoMSantos a little bit of time before going ahead and pushing and releasing.
Hey. I do have a comment on this one. I can't figure out where to place the comments though. Maybe this should have been a pull request in order to get the github machinery working? Of course I'm so used to gitlab and mailing lists I may just be missing something really obvious :/
For now I'll just leave my comment here. It relates to this line: fptr_type = ttype.replace('(*)', '(*{})'.format(name), 1)
. This will still break if it is a pointer to a pointer of a function, and so on. I don't suppose that's the kind of code that gets written often, but a regex would fix it.
Forgive me, I'm definitely being dumb. I should have looked over all of my inbox :facepalm:
I got an error parsing comments for function pointer. The code is not released yet so maybe there is an error in those declaration, but at least the compiler doesn't give me any error and I don't see any obvious mistake.
Here the code:
Here the error: