Skip to content

Fix unused-but-set-variable warnings#1494

Closed
andreasrosdal wants to merge 1 commit into
quickjs-ng:masterfrom
nordstjernen-web:claude/fix-compiler-warnings-e10Na
Closed

Fix unused-but-set-variable warnings#1494
andreasrosdal wants to merge 1 commit into
quickjs-ng:masterfrom
nordstjernen-web:claude/fix-compiler-warnings-e10Na

Conversation

@andreasrosdal
Copy link
Copy Markdown
Contributor

Build with -Wunused-but-set-variable enabled (drop the suppression in CMakeLists.txt) and silence the four resulting warnings:

  • mark_weak_map_value: inline mr->map->is_weak instead of stashing the pointer in a local that is only consulted from an assert
  • num_keys_cmp / js_array_toSpliced: mark assert-only locals with __maybe_unused so they survive NDEBUG builds without warnings

Verified with a clean build under gcc 13 and run-test262 -c tests.conf (0 failures).

Build with -Wunused-but-set-variable enabled (drop the suppression in
CMakeLists.txt) and silence the four resulting warnings:

- mark_weak_map_value: inline mr->map->is_weak instead of stashing the
  pointer in a local that is only consulted from an assert
- num_keys_cmp / js_array_toSpliced: mark assert-only locals with
  __maybe_unused so they survive NDEBUG builds without warnings

Verified with a clean build under gcc 13 and run-test262 -c tests.conf
(0 failures).
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