Fix compilation errors when ARCH=riscv #130
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When ARCH=riscv, the following compilation errors occur:
In file included from src/main.c:41:
src/codegen.c: In function ‘cfg_flatten’:
src/codegen.c:111:9: error: ‘flatten_ir’ undeclared (first use in this function); did you mean ‘fflatten_ir’?
111 | flatten_ir->src0 = fn->func->stack_size;
| ^~~~~~~~~~
| fflatten_ir
src/codegen.c:111:9: note: each undeclared identifier is reported only once for each function it appears in
src/codegen.c:110:19: warning: unused variable ‘fflatten_ir’ [-Wunused-variable]
110 | ph2_ir_t *fflatten_ir = add_ph2_ir(OP_define);
| ^~~~~~~~~~~
Fix the erroneous variable name 'fflatten_ir' to 'flatten_ir' to avoid compilation errors.
The reason this error wasn't discovered in the past is because the current CI doesn't actually test the ARCH=riscv scenario. The 'make clean' command does not delete config files. This led to an issue during testing with ARCH=riscv, where 'make' used the ARCH=arm config because the config file already existed. Consequently, ARCH=arm was tested twice while ARCH=riscv wasn't tested at all.
Fix the CI by changing 'make clean' to 'make distclean' to ensure that ARCH=riscv undergoes complete testing.