fix(codegen): remove two unused-variable warnings#1600
Merged
SchoolyB merged 2 commits intoSchoolyB:devfrom May 1, 2026
Merged
fix(codegen): remove two unused-variable warnings#1600SchoolyB merged 2 commits intoSchoolyB:devfrom
SchoolyB merged 2 commits intoSchoolyB:devfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Removes two
-Wunused-variablewarnings fromezc/src/codegen/codegen.cby deleting two leftover declarations that were assigned but never read. After the change,make buildcompiles with zero warnings.Why this matters
Issue #1597 reports both warnings explicitly with line numbers. Reproducing on
main(commit 5cd0dba):The issue's "Fix" section asks first whether each variable was meant to be used downstream and to remove only if it was a leftover.
For
if_depth: a grep across the whole file shows the name appears once (the assignment itself) and nowhere else. Nothing reads it. The surrounding block managescg->loop_scope_depthdirectly withcg->loop_scope_depth++, so the temporary copy is not part of any unfinished scope-restore logic.For
ctat line 7365: there are twoconst char *ct = ez_type_to_c_cg(...)declarations in the file. The one at line 6085 is read on the very next line (emitf(cg, "{ %s %s = ", ct, src_var);) and is not the one the warning points to. The warning is about the second one, inside thefor (int j = 0; j < fc; j++)loop that buildsez_json_parse_<struct>. The loop body emits viaemitfwith literal C type names ("EzString",ez_builtin_string_to_int, etc.) and never referencesct. So thisctis also a leftover from work that ended up taking a different code path.Both deletions are safe.
Changes
ezc/src/codegen/codegen.c: deletesint if_depth = cg->loop_scope_depth;(was line 6282) andconst char *ct = ez_type_to_c_cg(cg, f->type_name);(was line 7365). Net: 2 lines removed, 0 added.Testing
make buildruns clean on the change. The pre-existingctdeclaration at line 6085 (which is used) is left alone.Closes #1597