This is an automated email from the ASF dual-hosted git repository.

yiguolei pushed a commit to branch branch-4.1
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-4.1 by this push:
     new 6fb81ea8331 branch-4.1: [fix](build) Let ScopedLSANDisabler compile 
without a sanitizer #66049 (#66075)
6fb81ea8331 is described below

commit 6fb81ea8331fe61e3f6470d4c47ce1f0a9b621bb
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Wed Jul 29 14:05:59 2026 +0800

    branch-4.1: [fix](build) Let ScopedLSANDisabler compile without a sanitizer 
#66049 (#66075)
    
    Cherry-picked from #66049
    
    Co-authored-by: Jack <[email protected]>
---
 be/src/util/debug/leak_annotations.h | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/be/src/util/debug/leak_annotations.h 
b/be/src/util/debug/leak_annotations.h
index 39351a27735..e5a29b61bf9 100644
--- a/be/src/util/debug/leak_annotations.h
+++ b/be/src/util/debug/leak_annotations.h
@@ -71,10 +71,26 @@ int __lsan_do_recoverable_leak_check();
 
 namespace doris::debug {
 
+// Suppresses leak reports for allocations made in this scope.
+//
+// The __lsan_* functions above are only declared here; they are defined by 
the LeakSanitizer
+// runtime. Without -fsanitize=address (or =leak) nothing provides them, so 
calling them
+// unconditionally left every translation unit that instantiates this class 
with an undefined
+// reference, and doris_be_test could only be linked as an ASAN build. There 
is nothing to suppress
+// when no sanitizer is present, so the guard below degrades to a no-op -- the 
same reasoning
+// ANNOTATE_LEAKING_OBJECT_PTR already uses.
 class ScopedLSANDisabler {
 public:
+#if defined(DORIS_LSAN_ENABLED)
     ScopedLSANDisabler() { __lsan_disable(); }
     ~ScopedLSANDisabler() { __lsan_enable(); }
+#else
+    // Deliberately user-provided and not `= default`: a defaulted constructor 
makes the type
+    // trivial, and every `ScopedLSANDisabler guard;` then trips 
-Werror,-Wunused-variable. An
+    // empty user-provided body keeps the guard a no-op while remaining a real 
RAII object.
+    ScopedLSANDisabler() {}
+    ~ScopedLSANDisabler() {}
+#endif
 };
 
 } // namespace doris::debug


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to