Closed Bug 2069463 Opened 2 months ago Closed 2 months ago

Make the widget/android JNI helper templates inline to fix -Wunused-template with clang 23

Categories

(GeckoView :: General, task)

All
Android
task

Tracking

(firefox157 fixed)

RESOLVED FIXED
157 Branch
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.

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.

Pushed by rvandermeulen@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/8ca447d1f670 https://hg.mozilla.org/integration/autoland/rev/5b147f3ec460 Make the widget/android JNI helper templates inline to fix -Wunused-template with clang 23. r=geckoview-reviewers,m_kato
Status: NEW → RESOLVED
Closed: 2 months ago
Resolution: --- → FIXED
Target Milestone: --- → 157 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: