You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by al...@apache.org on 2026/10/12 22:57:37 UTC

(kudu) branch master updated: [util] quell warning on deprecated allocator typedefs

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

asf-gitbox-commits pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kudu.git


The following commit(s) were added to refs/heads/master by this push:
     new 1ebed4e6a [util] quell warning on deprecated allocator typedefs
1ebed4e6a is described below

commit 1ebed4e6ad34f895fe0aadc2e47b978a10837a83
Author: Alexey Serbin <al...@apache.org>
AuthorDate: Thu Oct 8 21:32:11 2026 -0700

    [util] quell warning on deprecated allocator typedefs
    
    When compiling Kudu with on macOS with CLANG 21, there were too many
    warnings on deprecation of std::allocator_traits-related typedefs as
    of the C++17 standard that polluted the output, making it's hard to
    spot relevant warnings:
    
      src/kudu/util/mem_tracker.h:212:27: warning: 'pointer' is deprecated [-Wdeprecated-declarations]
        212 |   typedef typename Alloc::pointer pointer;
    
    Those are deprecated in C++17 and removed in C++20, so it's better to
    adhere to the recommendations instead of adding corresponding
    -Wno-deprecated-declarations flag since we are planning to eventually
    start requiring C++20 standard compliance for Kudu's source code.
    
    This patch addresses the issue using [2] as an guideline.
    
    There are no functional modifications in this changelist.
    
    [1] https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0619r3.html
    [2] https://www.mathworks.com/help/bugfinder/ref/misrac2023rule4.1.2.html
    
    Change-Id: Iebb076793f0966ad19ef06215f24d3db6c681616
    Reviewed-on: http://gerrit.cloudera.org:8080/25080
    Tested-by: Alexey Serbin <al...@apache.org>
    Reviewed-by: Zoltan Martonka <zm...@cloudera.com>
---
 src/kudu/util/mem_tracker.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/kudu/util/mem_tracker.h b/src/kudu/util/mem_tracker.h
index e9a761861..ec6fb1225 100644
--- a/src/kudu/util/mem_tracker.h
+++ b/src/kudu/util/mem_tracker.h
@@ -209,9 +209,9 @@ class MemTracker : public std::enable_shared_from_this<MemTracker>,
 template<typename T, typename Alloc = std::allocator<T> >
 class MemTrackerAllocator : public Alloc {
  public:
-  typedef typename Alloc::pointer pointer;
-  typedef typename Alloc::const_pointer const_pointer;
-  typedef typename Alloc::size_type size_type;
+  typedef typename std::allocator_traits<Alloc>::pointer pointer;
+  typedef typename std::allocator_traits<Alloc>::const_pointer const_pointer;
+  typedef typename std::allocator_traits<Alloc>::size_type size_type;
 
   explicit MemTrackerAllocator(std::shared_ptr<MemTracker> mem_tracker)
       : mem_tracker_(std::move(mem_tracker)) {}