Skip to content

Fix unused variable in module.h in Release builds - #2464

Merged
bettio merged 1 commit into
atomvm:release-0.7from
r3wretrhy:fix/module-h-release-unused
Nov 3, 2026
Merged

bettio merged 1 commit into
atomvm:release-0.7from
r3wretrhy:fix/module-h-release-unused

Conversation

@r3wretrhy

@r3wretrhy r3wretrhy commented Nov 2, 2026 •

Copy link
Copy Markdown

module_get_fun_arity_old_index_uniq reads funs_count only for assert(fun_index < funs_count). With NDEBUG the variable is unused, so a build with -DCMAKE_BUILD_TYPE=Release -DAVM_WARNINGS_ARE_ERRORS=ON fails in every file that includes module.h. This marks it with UNUSED(funs_count) after the assert, as other places in libAtomVM do.

Testing (generic_unix, gcc 14.2, based on release-0.7):

  • Release + AVM_WARNINGS_ARE_ERRORS=ON: libAtomVM failed with module.h:367:9: error: unused variable 'funs_count' before this change; libAtomVM and AtomVM now build.
  • clang-format clean.

I did not add a Release CI job as suggested in the issue: the C tests (for example test-structs) rely on assert and have their own unused-variable errors under NDEBUG, so such a job would need more than this change.

Fixes #2448

These changes are made under both the "Apache 2.0" and the "GNU Lesser General
Public License 2.1 or later" license terms (dual license).

SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later

module_get_fun_arity_old_index_uniq reads funs_count only for an
assert. With NDEBUG the assert is gone and funs_count is unused, so
every file that includes module.h fails to build with
-DCMAKE_BUILD_TYPE=Release -DAVM_WARNINGS_ARE_ERRORS=ON.

Mark it with UNUSED after the assert, as done elsewhere.

Fixes: atomvm#2448
Signed-off-by: Zhaoqi Xu <lzy00419@outlook.com>
@bettio
bettio merged commit 13b0eb8 into atomvm:release-0.7 Nov 3, 2026
227 of 266 checks passed
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