You have the case: void __declspec(dllexport) __attribute__((__stdcall__)) Foo(void) __attribute__((noreturn)) { }
Sure you can have an exception if the name seems to be
__attribute__ but
then where might be other exceptions.
Yes, but a few preprocessor defines can get rid of that.
Well. You want to read the __attribute__ to know if the function should be stdcall or cdecl don't you?
The there might be cases I haven't though of.
The only problem is if you want to find the number of args for stdcall decoration, but we should
be able to do
without it.
That is not a problem. If you find the opening ( before the
function name,
it would be the number of , at nesting level 1 plus one
with the special
case of void between the parantesis which means 0.
Except for 64-bit data types...
And data structures. Forgot about that.
Perhaps. You will easily reach 99% correctness. However
beyond that it
is hard without a real C parser.
Well it's clear you can't get 100%, the thing is to make sure it fails in a reasonable way, not just silently breaks.
Agreed.
I think it is feasible;
Maybe.
whether it is worth the effort is an entirely different question...
It is MANY hours of work. Work I'm not going to be able to motivate myself to do especially not if you want it in C. The last time years ago I did parsing and string handling in C was a horrible experience one I'm not eager to experience again, especially since other tools (read: Perl) exists.
PS. I do agree it should be done in C though.