[llvm] [Offload] Fix warn-unused function (PR #208642)
Jan Patrick Lehr via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 10 01:02:26 PDT 2026
https://github.com/jplehr created https://github.com/llvm/llvm-project/pull/208642
Unblock the `-Werror` build in pre-merge by adding a few [[maybe_unused]] here and there.
>From 5d6e65e2b656cb81dc36a2ed2a1c2dcd03ad1be7 Mon Sep 17 00:00:00 2001
From: JP Lehr <JanPatrick.Lehr at amd.com>
Date: Fri, 10 Jul 2026 02:57:46 -0500
Subject: [PATCH] [Offload] Fix warn-unused function
Unblock the `-Werror` build in pre-merge by adding a few
[[maybe_unused]] here and there.
---
offload/plugins-nextgen/amdgpu/src/rtl.cpp | 4 ++--
offload/plugins-nextgen/common/include/OffloadError.h | 4 ++--
offload/plugins-nextgen/common/include/PluginInterface.h | 3 ++-
offload/plugins-nextgen/host/src/rtl.cpp | 3 ++-
4 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/offload/plugins-nextgen/amdgpu/src/rtl.cpp b/offload/plugins-nextgen/amdgpu/src/rtl.cpp
index e6ceeea5331d1..f1caee0c4c1e2 100644
--- a/offload/plugins-nextgen/amdgpu/src/rtl.cpp
+++ b/offload/plugins-nextgen/amdgpu/src/rtl.cpp
@@ -126,8 +126,8 @@ static hsa_status_t iterate(IterFuncTy Func, IterFuncArgTy FuncArg,
/// use this function directly but the specialized ones below instead.
template <typename Elem1Ty, typename Elem2Ty, typename IterFuncTy,
typename IterFuncArgTy, typename CallbackTy>
-static hsa_status_t iterate(IterFuncTy Func, IterFuncArgTy FuncArg,
- CallbackTy Cb) {
+[[maybe_unused]] static hsa_status_t
+iterate(IterFuncTy Func, IterFuncArgTy FuncArg, CallbackTy Cb) {
auto L = [](Elem1Ty Elem1, Elem2Ty Elem2, void *Data) -> hsa_status_t {
CallbackTy *Unwrapped = static_cast<CallbackTy *>(Data);
return (*Unwrapped)(Elem1, Elem2);
diff --git a/offload/plugins-nextgen/common/include/OffloadError.h b/offload/plugins-nextgen/common/include/OffloadError.h
index f2a56d2c41117..3d0ceb400c99c 100644
--- a/offload/plugins-nextgen/common/include/OffloadError.h
+++ b/offload/plugins-nextgen/common/include/OffloadError.h
@@ -49,8 +49,8 @@ class OffloadError : public llvm::ErrorInfo<OffloadError, llvm::StringError> {
/// Create an Offload error.
template <typename... ArgsTy>
-static llvm::Error createOffloadError(error::ErrorCode Code, const char *ErrFmt,
- ArgsTy... Args) {
+[[maybe_unused]] static llvm::Error
+createOffloadError(error::ErrorCode Code, const char *ErrFmt, ArgsTy... Args) {
std::string Buffer;
llvm::raw_string_ostream(Buffer) << llvm::format(ErrFmt, Args...);
return llvm::make_error<error::OffloadError>(Code, Buffer);
diff --git a/offload/plugins-nextgen/common/include/PluginInterface.h b/offload/plugins-nextgen/common/include/PluginInterface.h
index 400605763b365..2a23d319fff49 100644
--- a/offload/plugins-nextgen/common/include/PluginInterface.h
+++ b/offload/plugins-nextgen/common/include/PluginInterface.h
@@ -98,7 +98,8 @@ inline Error error(error::ErrorCode Code, Error &&OtherError,
/// the plugin-specific code.
/// TODO: Refactor this, must be defined individually by each plugin.
template <typename... ArgsTy>
-static Error check(int32_t ErrorCode, const char *ErrFmt, ArgsTy... Args);
+[[maybe_unused]] static Error check(int32_t ErrorCode, const char *ErrFmt,
+ ArgsTy... Args);
} // namespace Plugin
/// Class that wraps the __tgt_async_info to simply its usage. In case the
diff --git a/offload/plugins-nextgen/host/src/rtl.cpp b/offload/plugins-nextgen/host/src/rtl.cpp
index 505494095a10a..a5d4ffd003fd7 100644
--- a/offload/plugins-nextgen/host/src/rtl.cpp
+++ b/offload/plugins-nextgen/host/src/rtl.cpp
@@ -558,7 +558,8 @@ struct GenELF64PluginTy final : public GenericPluginTy {
};
template <typename... ArgsTy>
-static Error Plugin::check(int32_t Code, const char *ErrMsg, ArgsTy... Args) {
+[[maybe_unused]] static Error Plugin::check(int32_t Code, const char *ErrMsg,
+ ArgsTy... Args) {
if (Code == 0)
return Plugin::success();
More information about the llvm-commits
mailing list