Make the widget/android JNI helper templates inline to fix -Wunused-template with clang 23
Categories
(GeckoView :: General, task)
Tracking
(firefox157 fixed)
| Tracking | Status | |
|---|---|---|
| firefox157 | --- | fixed |
People
(Reporter: RyanVM, Assigned: RyanVM)
References
(Blocks 1 open bug)
Details
Attachments
(1 external file)
Building with clang 23.1.0 fails in every translation unit that includes widget/android/jni/Natives.h without a weak-pointer native class:
widget/android/jni/Natives.h:40:24: error: unused function template 'NullWeakPtr' [-Werror,-Wunused-template]
clang 23.1.0 puts -Wunused-template under -Wall; it flags internal-linkage templates a translation unit never instantiates. NullHandle and NullWeakPtr are static function templates in a header, so the one a TU doesn't need is always reported. Declaring them inline like the rest of the header removes the warning at its source; the definitions are identical everywhere so external linkage raises no ODR concern.
The same warning also fires on the two CallAttachNative overloads in widget/android/nsWindow.cpp, which have had no callers since bug 1651705 removed them; delete them.
| Assignee | ||
Comment 1•2 months ago
|
||
clang 23.1.0 puts -Wunused-template under -Wall, which flags internal-linkage templates a
translation unit never instantiates. NullHandle/NullWeakPtr in Natives.h are static templates in
a header, so every TU that includes it without a weak-pointer native class trips on NullWeakPtr;
make them inline like the rest of the header. The CallAttachNative overloads in nsWindow.cpp have
had no callers since bug 1651705, so remove them.
Description
•