[compiler-rt] [compiler-rt] Fix asan_interceptors.cpp build warning -Wunused-template (PR #209750)
Wenju He via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 15 05:35:38 PDT 2026
https://github.com/wenju-he created https://github.com/llvm/llvm-project/pull/209750
mmap_interceptor/munmap_interceptor template functions are instantiated in sanitizer_common_interceptors.inc only under `#if SANITIZER_INTERCEPT_MMAP`. Fix `unused function template 'mmap_interceptor'` warning on Windows, which is error under -Werror.
>From 26deda1e486850ecbd381f6b815c9d0a140ff62c Mon Sep 17 00:00:00 2001
From: Wenju He <wenju.he at intel.com>
Date: Wed, 15 Jul 2026 13:38:40 +0200
Subject: [PATCH] [compiler-rt] Fix asan_interceptors.cpp build warning
-Wunused-template
mmap_interceptor/munmap_interceptor template functions are instantiated
in sanitizer_common_interceptors.inc only under `#if SANITIZER_INTERCEPT_MMAP`.
Fix `unused function template 'mmap_interceptor'` warning on Windows,
which is error under -Werror.
---
compiler-rt/lib/asan/asan_interceptors.cpp | 2 ++
1 file changed, 2 insertions(+)
diff --git a/compiler-rt/lib/asan/asan_interceptors.cpp b/compiler-rt/lib/asan/asan_interceptors.cpp
index 5075919a47d50..4e91e34f76cee 100644
--- a/compiler-rt/lib/asan/asan_interceptors.cpp
+++ b/compiler-rt/lib/asan/asan_interceptors.cpp
@@ -178,6 +178,7 @@ DECLARE_REAL_AND_INTERCEPTOR(void, free, void*)
*begin = *end = 0; \
}
+# if SANITIZER_INTERCEPT_MMAP
template <class Mmap>
static void* mmap_interceptor(Mmap real_mmap, void* addr, SIZE_T length,
int prot, int flags, int fd, OFF64_T offset) {
@@ -243,6 +244,7 @@ static int munmap_interceptor(Munmap real_munmap, void* addr, SIZE_T length) {
}
return real_munmap(addr, length);
}
+# endif // SANITIZER_INTERCEPT_MMAP
# define COMMON_INTERCEPTOR_MMAP_IMPL(ctx, mmap, addr, length, prot, flags, \
fd, offset) \
More information about the llvm-commits
mailing list