llvm-project
92da80b7 - [Flang][#212316] Fix -Wunused-template errors under -Werror (#218985)

Commit
2 days ago
[Flang][#212316] Fix -Wunused-template errors under -Werror (#218985) Some function templates with internal linkage are never instantiated in their translation unit, which triggers -Wunused-template. When the warning (-Wunused-template) and warning as error (-Werror, e.g. -DFLANG_ENABLE_WERROR=ON) are enabled, these become fatal errors. Fix each case with the minimal change that preserves semantics, and remove unused templates: - Drop 'static' (give external linkage) for free function templates at namespace/file scope: DirectivesCommon.h, PFTBuilder.h, RTBuilder.h, fold-reduction.h. - Add [[maybe_unused]] where dropping 'static' would change linkage/ODR semantics (member, anonymous-namespace, or global generic-named templates): check-cuda.cpp, tools.cpp. - Remove unused templates: formatting.cpp, CUFAllocationConversion.cpp, resolve-directives.cpp, ConvertType.cpp, IO.cpp, openmp-utils.cpp. Behavior is unchanged, while selected template linkage is intentionally changed. With AI assistance. Fixes #212316. --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: Aiden Grossman <aidengrossman@google.com>
Author
Parents
Loading