Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR fixes converting when calling functions by addressing a missing return statement and refactoring the code converter to use a configuration struct instead of global variables.
- Removes debug sanitizer flags from multiple Makefiles for cleaner builds
- Fixes a missing return statement in the
sdssplitfunction that was causing undefined behavior - Refactors the code converter to use a
solver_configstruct parameter instead of global variables and separate indentation parameters
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/Makefile | Removes sanitizer flags from debug configuration |
| teste | Deletes entire test file (309 lines of C code) |
| src/string/sds.c | Adds missing return statement in sdssplit function |
| src/libfort/src/Makefile | Removes -fsanitize=address flag from debug configuration |
| src/compiler/Makefile | Removes -fsanitize=address flag and adds -DDEBUG_INFO flag |
| src/code_converter.h | Reorders includes and adds solver_config struct definition |
| src/code_converter.c | Major refactoring to use solver_config struct instead of global variables |
| Makefile | Removes sanitizer flags from debug configuration |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
|
||
| sds *sdssplit(const char *s, const char *sep, int *count) { | ||
| sdssplitlen(s, strlen(s), sep, strlen(sep), count); | ||
| return sdssplitlen(s, strlen(s), sep, strlen(sep), count); |
There was a problem hiding this comment.
The original code was missing a return statement, which would cause undefined behavior. This fix correctly returns the result of sdssplitlen.
| if (a->tag == ast_expression_stmt && a->expr_stmt != NULL && a->expr_stmt->tag == ast_call_expression) | ||
| fprintf(file, "%s;\n", buf); | ||
| else | ||
| fprintf(file, "%s\n", buf); |
There was a problem hiding this comment.
[nitpick] The conditional statement should use braces for consistency and clarity, even for single statements. Consider formatting as: if (...) { fprintf(...); } else { ... }
| if (a->tag == ast_expression_stmt && a->expr_stmt != NULL && a->expr_stmt->tag == ast_call_expression) | |
| fprintf(file, "%s;\n", buf); | |
| else | |
| fprintf(file, "%s\n", buf); | |
| if (a->tag == ast_expression_stmt && a->expr_stmt != NULL && a->expr_stmt->tag == ast_call_expression) { | |
| fprintf(file, "%s;\n", buf); | |
| } else { | |
| fprintf(file, "%s\n", buf); | |
| } |
No description provided.