Skip to content

Give the Copy/ConstructDefault dispatch helpers external linkage (clang 23 -Wunused-template) - #860

Merged
kinetiknz merged 1 commit into
mozilla:masterfrom
rvandermeulen:utils-unused-template
Sep 4, 2026
Merged

kinetiknz merged 1 commit into
mozilla:masterfrom
rvandermeulen:utils-unused-template

Conversation

@rvandermeulen

Copy link
Copy Markdown
Contributor

The tag-dispatch overloads of Copy and ConstructDefault in cubeb_utils.h live in an anonymous namespace inside a header, so every translation unit that includes the header without using them gets internal-linkage function templates with no instantiations. clang 23.1.0 diagnoses exactly that under -Wall:

media/libcubeb/src/cubeb_utils.h:64:1: error: unused function template 'Copy' [-Werror,-Wunused-template]
media/libcubeb/src/cubeb_utils.h:95:1: error: unused function template 'ConstructDefault' [-Werror,-Wunused-template]

which breaks Firefox's -Werror build with clang 23. Move the helpers to a detail namespace so they have external linkage; behaviour is unchanged. clang-formatted with the repository's .clang-format.

They live in an anonymous namespace in a header, so every translation unit
that includes cubeb_utils.h without using them gets internal-linkage function
templates with no instantiations. clang 23.1.0 diagnoses that under -Wall
(-Wunused-template), breaking -Werror builds such as Firefox's. Move them to a
detail namespace instead.
@kinetiknz
kinetiknz merged commit 80dd0a2 into mozilla:master Sep 4, 2026
16 checks passed
@rvandermeulen
rvandermeulen deleted the utils-unused-template branch September 4, 2026 21:42
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