Closed Bug 2069465 Opened 2 months ago Closed 2 months ago

Fix clang 23 unused warnings in js

Categories

(Core :: JavaScript Engine, task, P2)

task

Tracking

()

RESOLVED FIXED
157 Branch
Tracking Status
firefox157 --- fixed

People

(Reporter: RyanVM, Assigned: RyanVM)

References

(Blocks 1 open bug)

Details

Attachments

(1 external file)

clang 23.1.0 puts -Wunused-template under -Wall; it flags internal-linkage templates a translation unit never instantiates. It also nests -Wunused-but-set-global under -Wunused-but-set-variable, so file-scope statics that are written but never read are reported too. SpiderMonkey's -Werror builds fail on:

js/src/gc/Memory.cpp:293:21: error: unused function template 'MapMemoryAtFuzzy' [-Werror,-Wunused-template]
js/src/jsapi-tests/testCompileScript.cpp:20:13: error: unused function template 'dump' [-Werror,-Wunused-template]

plus StringFlagsForCharType in js/src/vm/StringType.cpp (no callers) and xpcshell's reportWarnings flag in js/xpconnect/src/XPCShellImpl.cpp, which -W/-w set but nothing reads.

MapMemoryAtFuzzy is only called from FindAddressLimitInner and MapAlignedPagesRandom, both under #ifdef JS_64BIT, so 32-bit builds (android-arm, win32) never instantiate it; guard the definition the same way. The dump helper came in with bug 1773319 and has never had a caller; remove it and the vm/JSONPrinter.h include it needed. Remove StringFlagsForCharType and reportWarnings; -W and -w stay accepted as no-ops.

Summary: Guard MapMemoryAtFuzzy with JS_64BIT and drop the unused dump helper to fix -Wunused-template with clang 23 → Fix clang 23 unused warnings in js

MapMemoryAtFuzzy is only called on 64-bit, so guard it with JS_64BIT. The dump helper in
testCompileScript.cpp and StringFlagsForCharType in StringType.cpp have no callers, and xpcshell's
reportWarnings flag has not been read in years; -W and -w are still accepted as no-ops.

Severity: -- → N/A
Priority: -- → P2
Status: NEW → RESOLVED
Closed: 2 months ago
Resolution: --- → FIXED
Target Milestone: --- → 157 Branch
QA Whiteboard: [qa-triage-done-c158/b157]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: