This is an automated email from the ASF dual-hosted git repository.
junrushao pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm-ffi.git
The following commit(s) were added to refs/heads/main by this push:
new c22e10e chore: fix compiler warnings (#378)
c22e10e is described below
commit c22e10e8aed646b58d6afa9cbd0597989ce51587
Author: Guan-Ming (Wesley) Chiu <[email protected]>
AuthorDate: Sat Jan 3 07:38:48 2026 +0800
chore: fix compiler warnings (#378)
## Why
- Unused parameter `num_args` in `GetMismatchMessageAux` template
function
- Extra semicolon after `TVM_FFI_DLL_EXPORT_TYPED_FUNC` macro call
## How
- Add `[[maybe_unused]]` attribute to `num_args` param
- Remove trailing semicolon
---
examples/cubin_launcher/dynamic_cubin/src/lib_dynamic.cc | 6 +++---
.../embedded_cubin/cpp_embed/src/lib_embedded.cc | 4 ++--
.../embedded_cubin/embed_with_tvm_ffi/src/lib_embedded.cc | 4 ++--
.../embedded_cubin/include_bin2c/src/lib_embedded.cc | 4 ++--
examples/python_packaging/src/extension.cc | 2 +-
examples/quickstart/compile/add_one_cpu.cc | 2 +-
include/tvm/ffi/reflection/overload.h | 3 ++-
src/ffi/testing/testing.cc | 2 +-
tests/cpp/test_function.cc | 2 +-
tests/python/cpp_src/test_stl.cc | 12 ++++++------
tests/python/test_build.cc | 2 +-
11 files changed, 22 insertions(+), 21 deletions(-)
diff --git a/examples/cubin_launcher/dynamic_cubin/src/lib_dynamic.cc
b/examples/cubin_launcher/dynamic_cubin/src/lib_dynamic.cc
index 61f050d..1a39383 100644
--- a/examples/cubin_launcher/dynamic_cubin/src/lib_dynamic.cc
+++ b/examples/cubin_launcher/dynamic_cubin/src/lib_dynamic.cc
@@ -129,8 +129,8 @@ void MulTwo(tvm::ffi::TensorView x, tvm::ffi::TensorView y)
{
}
// Export TVM-FFI functions
-TVM_FFI_DLL_EXPORT_TYPED_FUNC(set_cubin, cubin_dynamic::SetCubin);
-TVM_FFI_DLL_EXPORT_TYPED_FUNC(add_one, cubin_dynamic::AddOne);
-TVM_FFI_DLL_EXPORT_TYPED_FUNC(mul_two, cubin_dynamic::MulTwo);
+TVM_FFI_DLL_EXPORT_TYPED_FUNC(set_cubin, cubin_dynamic::SetCubin)
+TVM_FFI_DLL_EXPORT_TYPED_FUNC(add_one, cubin_dynamic::AddOne)
+TVM_FFI_DLL_EXPORT_TYPED_FUNC(mul_two, cubin_dynamic::MulTwo)
} // namespace cubin_dynamic
diff --git
a/examples/cubin_launcher/embedded_cubin/cpp_embed/src/lib_embedded.cc
b/examples/cubin_launcher/embedded_cubin/cpp_embed/src/lib_embedded.cc
index 357522e..615bdc9 100644
--- a/examples/cubin_launcher/embedded_cubin/cpp_embed/src/lib_embedded.cc
+++ b/examples/cubin_launcher/embedded_cubin/cpp_embed/src/lib_embedded.cc
@@ -116,7 +116,7 @@ void MulTwo(tvm::ffi::TensorView x, tvm::ffi::TensorView y)
{
}
// Export TVM-FFI functions
-TVM_FFI_DLL_EXPORT_TYPED_FUNC(add_one, cubin_embedded::AddOne);
-TVM_FFI_DLL_EXPORT_TYPED_FUNC(mul_two, cubin_embedded::MulTwo);
+TVM_FFI_DLL_EXPORT_TYPED_FUNC(add_one, cubin_embedded::AddOne)
+TVM_FFI_DLL_EXPORT_TYPED_FUNC(mul_two, cubin_embedded::MulTwo)
} // namespace cubin_embedded
diff --git
a/examples/cubin_launcher/embedded_cubin/embed_with_tvm_ffi/src/lib_embedded.cc
b/examples/cubin_launcher/embedded_cubin/embed_with_tvm_ffi/src/lib_embedded.cc
index 53401fc..ea410a6 100644
---
a/examples/cubin_launcher/embedded_cubin/embed_with_tvm_ffi/src/lib_embedded.cc
+++
b/examples/cubin_launcher/embedded_cubin/embed_with_tvm_ffi/src/lib_embedded.cc
@@ -113,7 +113,7 @@ void MulTwo(tvm::ffi::TensorView x, tvm::ffi::TensorView y)
{
}
// Export TVM-FFI functions
-TVM_FFI_DLL_EXPORT_TYPED_FUNC(add_one, cubin_embedded::AddOne);
-TVM_FFI_DLL_EXPORT_TYPED_FUNC(mul_two, cubin_embedded::MulTwo);
+TVM_FFI_DLL_EXPORT_TYPED_FUNC(add_one, cubin_embedded::AddOne)
+TVM_FFI_DLL_EXPORT_TYPED_FUNC(mul_two, cubin_embedded::MulTwo)
} // namespace cubin_embedded
diff --git
a/examples/cubin_launcher/embedded_cubin/include_bin2c/src/lib_embedded.cc
b/examples/cubin_launcher/embedded_cubin/include_bin2c/src/lib_embedded.cc
index dd8d578..3c87889 100644
--- a/examples/cubin_launcher/embedded_cubin/include_bin2c/src/lib_embedded.cc
+++ b/examples/cubin_launcher/embedded_cubin/include_bin2c/src/lib_embedded.cc
@@ -113,7 +113,7 @@ void MulTwo(tvm::ffi::TensorView x, tvm::ffi::TensorView y)
{
}
// Export TVM-FFI functions
-TVM_FFI_DLL_EXPORT_TYPED_FUNC(add_one, cubin_embedded::AddOne);
-TVM_FFI_DLL_EXPORT_TYPED_FUNC(mul_two, cubin_embedded::MulTwo);
+TVM_FFI_DLL_EXPORT_TYPED_FUNC(add_one, cubin_embedded::AddOne)
+TVM_FFI_DLL_EXPORT_TYPED_FUNC(mul_two, cubin_embedded::MulTwo)
} // namespace cubin_embedded
diff --git a/examples/python_packaging/src/extension.cc
b/examples/python_packaging/src/extension.cc
index fc06625..81fb003 100644
--- a/examples/python_packaging/src/extension.cc
+++ b/examples/python_packaging/src/extension.cc
@@ -33,7 +33,7 @@ namespace ffi = tvm::ffi;
// [tvm_ffi_abi.begin]
static int AddTwo(int x) { return x + 2; }
-TVM_FFI_DLL_EXPORT_TYPED_FUNC(add_two, AddTwo);
+TVM_FFI_DLL_EXPORT_TYPED_FUNC(add_two, AddTwo)
// [tvm_ffi_abi.end]
// [global_function.begin]
diff --git a/examples/quickstart/compile/add_one_cpu.cc
b/examples/quickstart/compile/add_one_cpu.cc
index 22ce5e0..3ddf6cf 100644
--- a/examples/quickstart/compile/add_one_cpu.cc
+++ b/examples/quickstart/compile/add_one_cpu.cc
@@ -34,6 +34,6 @@ void AddOne(tvm::ffi::TensorView x, tvm::ffi::TensorView y) {
}
}
-TVM_FFI_DLL_EXPORT_TYPED_FUNC(add_one_cpu, tvm_ffi_example_cpu::AddOne);
+TVM_FFI_DLL_EXPORT_TYPED_FUNC(add_one_cpu, tvm_ffi_example_cpu::AddOne)
} // namespace tvm_ffi_example_cpu
// [example.end]
diff --git a/include/tvm/ffi/reflection/overload.h
b/include/tvm/ffi/reflection/overload.h
index f9684bc..a85174c 100644
--- a/include/tvm/ffi/reflection/overload.h
+++ b/include/tvm/ffi/reflection/overload.h
@@ -145,7 +145,8 @@ struct TypedOverload : OverloadBase {
private:
template <std::size_t I>
- void GetMismatchMessageAux(std::ostringstream& os, const AnyView* args,
int32_t num_args) {
+ void GetMismatchMessageAux(std::ostringstream& os, const AnyView* args,
+ [[maybe_unused]] int32_t num_args) {
if constexpr (I < kNumArgs) {
if (this->last_mismatch_index_ == static_cast<int32_t>(I)) {
TVMFFIAny any_data = args[I].CopyToTVMFFIAny();
diff --git a/src/ffi/testing/testing.cc b/src/ffi/testing/testing.cc
index d38c027..7ee6ffd 100644
--- a/src/ffi/testing/testing.cc
+++ b/src/ffi/testing/testing.cc
@@ -519,7 +519,7 @@ TVM_FFI_STATIC_INIT_BLOCK() {
// Exported symbols for metadata testing on DLL-exported functions
//
-----------------------------------------------------------------------------
// We keep minimal DLL exports here to verify the export mechanism.
-TVM_FFI_DLL_EXPORT_TYPED_FUNC(testing_dll_schema_id_int,
tvm::ffi::schema_test_impl::schema_id_int);
+TVM_FFI_DLL_EXPORT_TYPED_FUNC(testing_dll_schema_id_int,
tvm::ffi::schema_test_impl::schema_id_int)
// Documentation export
TVM_FFI_DLL_EXPORT_TYPED_FUNC(testing_dll_test_add_with_docstring,
diff --git a/tests/cpp/test_function.cc b/tests/cpp/test_function.cc
index b3879d7..fddb8fd 100644
--- a/tests/cpp/test_function.cc
+++ b/tests/cpp/test_function.cc
@@ -275,7 +275,7 @@ TEST(SetRaisedFromCStrParts, TypeError) {
int testing_add1(int x) { return x + 1; }
-TVM_FFI_DLL_EXPORT_TYPED_FUNC(testing_add1, testing_add1);
+TVM_FFI_DLL_EXPORT_TYPED_FUNC(testing_add1, testing_add1)
TEST(Func, FromExternC) {
// this is the function abi convention
diff --git a/tests/python/cpp_src/test_stl.cc b/tests/python/cpp_src/test_stl.cc
index d7ed421..52477ea 100644
--- a/tests/python/cpp_src/test_stl.cc
+++ b/tests/python/cpp_src/test_stl.cc
@@ -89,11 +89,11 @@ auto test_function(std::function<int(void)> f) ->
std::function<int(void)> {
return [fn = std::move(f)] { return fn() + 1; };
}
-TVM_FFI_DLL_EXPORT_TYPED_FUNC(test_tuple, test_tuple);
-TVM_FFI_DLL_EXPORT_TYPED_FUNC(test_vector, test_vector);
-TVM_FFI_DLL_EXPORT_TYPED_FUNC(test_variant, test_variant);
-TVM_FFI_DLL_EXPORT_TYPED_FUNC(test_map, test_map);
-TVM_FFI_DLL_EXPORT_TYPED_FUNC(test_map_2, test_map_2);
-TVM_FFI_DLL_EXPORT_TYPED_FUNC(test_function, test_function);
+TVM_FFI_DLL_EXPORT_TYPED_FUNC(test_tuple, test_tuple)
+TVM_FFI_DLL_EXPORT_TYPED_FUNC(test_vector, test_vector)
+TVM_FFI_DLL_EXPORT_TYPED_FUNC(test_variant, test_variant)
+TVM_FFI_DLL_EXPORT_TYPED_FUNC(test_map, test_map)
+TVM_FFI_DLL_EXPORT_TYPED_FUNC(test_map_2, test_map_2)
+TVM_FFI_DLL_EXPORT_TYPED_FUNC(test_function, test_function)
} // namespace
diff --git a/tests/python/test_build.cc b/tests/python/test_build.cc
index bc6acf1..881f294 100644
--- a/tests/python/test_build.cc
+++ b/tests/python/test_build.cc
@@ -38,4 +38,4 @@ void add_one_cpu(tvm::ffi::TensorView x, tvm::ffi::TensorView
y) {
}
}
-TVM_FFI_DLL_EXPORT_TYPED_FUNC(add_one_cpu, add_one_cpu);
+TVM_FFI_DLL_EXPORT_TYPED_FUNC(add_one_cpu, add_one_cpu)