Skip to content

Commit 3d950c6

Browse files
committed
fix: clobbered warning
Signed-off-by: SIGMazer <mazinasd7@gmail.com>
1 parent c4b17aa commit 3d950c6

File tree

2 files changed

+20
-20
lines changed

2 files changed

+20
-20
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ flex -o lang.lex.c lang.l
9090
make
9191
```
9292

93+
NOTE: The gcc version we use to test is v13 if you get any warnings remove `-Werror` flag from the Makefile
94+
9395
## Installation
9496

9597
```bash

ast.c

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3360,32 +3360,30 @@ Function *create_function(char *name, VarType return_type, Parameter *params, AS
33603360

33613361
void execute_function_call(const char *name, ArgumentList *args)
33623362
{
3363-
// Find function in function table
3364-
Function *func = function_table;
3365-
while (func)
3363+
Function *func = NULL;
3364+
3365+
for (func = function_table; func != NULL; func = func->next)
33663366
{
33673367
if (strcmp(func->name, name) == 0)
3368-
{
3369-
// Create new scope for function
3370-
enter_function_scope(func, args);
3371-
current_return_value.type = func->return_type;
3368+
break;
3369+
}
33723370

3371+
if (!func)
3372+
{
3373+
yyerror("Undefined function");
3374+
return;
3375+
}
33733376

3374-
// Set up return handling
3375-
current_return_value.has_value = false;
3376-
PUSH_JUMP_BUFFER();
3377-
if (setjmp(CURRENT_JUMP_BUFFER()) == 0)
3378-
{
3379-
execute_statement(func->body);
3380-
}
3377+
enter_function_scope(func, args);
3378+
current_return_value.type = func->return_type;
3379+
current_return_value.has_value = false;
33813380

3382-
POP_JUMP_BUFFER();
3383-
return;
3384-
}
3385-
func = func->next;
3381+
PUSH_JUMP_BUFFER();
3382+
if (setjmp(CURRENT_JUMP_BUFFER()) == 0)
3383+
{
3384+
execute_statement(func->body);
33863385
}
3387-
3388-
yyerror("Undefined function");
3386+
POP_JUMP_BUFFER();
33893387
}
33903388

33913389
void handle_return_statement(ASTNode *expr)

0 commit comments

Comments
 (0)