Skip to content

Fix converting when calling functions#1

Merged
rsachetto merged 2 commits intomasterfrom
fix_convert
Sep 23, 2025
Merged

Fix converting when calling functions#1
rsachetto merged 2 commits intomasterfrom
fix_convert

Conversation

@rsachetto
Copy link
Copy Markdown
Owner

No description provided.

@rsachetto rsachetto requested a review from Copilot September 23, 2025 14:53
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 sdssplit function that was causing undefined behavior
  • Refactors the code converter to use a solver_config struct 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.

Comment thread src/string/sds.c

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);
Copy link

Copilot AI Sep 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The original code was missing a return statement, which would cause undefined behavior. This fix correctly returns the result of sdssplitlen.

Copilot uses AI. Check for mistakes.
Comment thread src/code_converter.c
Comment on lines +690 to +693
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);
Copy link

Copilot AI Sep 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The conditional statement should use braces for consistency and clarity, even for single statements. Consider formatting as: if (...) { fprintf(...); } else { ... }

Suggested change
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);
}

Copilot uses AI. Check for mistakes.
@rsachetto rsachetto merged commit 00aab5d into master Sep 23, 2025
0 of 2 checks passed
@rsachetto rsachetto deleted the fix_convert branch September 23, 2025 14:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants