Repository navigation
Fix unused variable in module.h in Release builds - #2464
Merged
Merged
Conversation
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
approved these changes
Nov 3, 2026
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.
module_get_fun_arity_old_index_uniqreadsfuns_countonly forassert(fun_index < funs_count). WithNDEBUGthe variable is unused, so a build with-DCMAKE_BUILD_TYPE=Release -DAVM_WARNINGS_ARE_ERRORS=ONfails in every file that includesmodule.h. This marks it withUNUSED(funs_count)after the assert, as other places in libAtomVM do.Testing (generic_unix, gcc 14.2, based on
release-0.7):AVM_WARNINGS_ARE_ERRORS=ON:libAtomVMfailed withmodule.h:367:9: error: unused variable 'funs_count'before this change;libAtomVMandAtomVMnow build.I did not add a Release CI job as suggested in the issue: the C tests (for example
test-structs) rely onassertand have their own unused-variable errors underNDEBUG, 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