You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since the previous parser may incorrectly handle a function with a
forward declaration before implementation, the code generator produces
wrong instructions for a function because the frontend provides
incorrect information.
For example, consider the following code:
int func(int *a);
int func(int *a)
{
return *a;
}
int main()
{
/* ... */
}
After parsing the forward declaration of 'func', it is added to the
function list, and its parameter 'a' is recorded with the type 'int *'.
When the function implementation is later parsed, the parser processes
the declaration again, but the pointer level of 'a' is accumulated,
causing the type of 'a' to become 'int **'.
Therefore, to resolve the above issue and enhance the function parsing,
these changes improve the parser to correctly handle functions with
forward declarations, and report an error message if a later declaration
differs from a previous one.
Close#305
0 commit comments