Fix clang 21 compiler allocator wrapper [-Wallocator-wrappers] warnings

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Fixed
    • Priority: Major - P3
    • WT12.0.0
    • Affects Version/s: None
    • Component/s: Build
    • None
    • Storage Engines - Transactions
    • SE Transactions - 2026-03-27
    • 1

      The Clang 21 compiler starts generating the following warnings whenever a wrapper function doesn't specify the type information to the compiler.

      [3/270] Building C object test/utility/CMakeFiles/test_util.dir/misc.c.o
      /Users/haribabu.kommi/work/code/wiredtiger/test/utility/misc.c:515:1: warning: function dcalloc might be an allocator wrapper [-Wallocator-wrappers]
        515 | dcalloc(size_t number, size_t size)
            | ^
      /Users/haribabu.kommi/work/code/wiredtiger/test/utility/misc.c:523:9: note: value obtained from allocator call is returned here
        523 |         return (p);
            |         ^
      /Users/haribabu.kommi/work/code/wiredtiger/test/utility/misc.c:532:1: warning: function dmalloc might be an allocator wrapper [-Wallocator-wrappers]
        532 | dmalloc(size_t len)
            | ^
      /Users/haribabu.kommi/work/code/wiredtiger/test/utility/misc.c:540:9: note: value obtained from allocator call is returned here
        540 |         return (p);
            |         ^
      /Users/haribabu.kommi/work/code/wiredtiger/test/utility/misc.c:549:1: warning: function drealloc might be an allocator wrapper [-Wallocator-wrappers]
        549 | drealloc(void *p, size_t len)
            | ^
      /Users/haribabu.kommi/work/code/wiredtiger/test/utility/misc.c:557:9: note: value obtained from allocator call is returned here
        557 |         return (t);
            |         ^
      3 warnings generated.
      [24/270] Building C object src/utilities/CMakeFiles/wt.dir/util_misc.c.o
      /Users/haribabu.kommi/work/code/wiredtiger/src/utilities/util_misc.c:191:1: warning: function util_malloc might be an allocator wrapper [-Wallocator-wrappers]
        191 | util_malloc(size_t len)
            | ^
      /Users/haribabu.kommi/work/code/wiredtiger/src/utilities/util_misc.c:196:5: note: value obtained from allocator call is returned here
        196 |     return (malloc(len));
            |     ^
      /Users/haribabu.kommi/work/code/wiredtiger/src/utilities/util_misc.c:206:1: warning: function util_calloc might be an allocator wrapper [-Wallocator-wrappers]
        206 | util_calloc(size_t members, size_t sz)
            | ^
      /Users/haribabu.kommi/work/code/wiredtiger/src/utilities/util_misc.c:211:5: note: value obtained from allocator call is returned here
        211 |     return (calloc(members, sz));
            |     ^
      /Users/haribabu.kommi/work/code/wiredtiger/src/utilities/util_misc.c:221:1: warning: function util_realloc might be an allocator wrapper [-Wallocator-wrappers]
        221 | util_realloc(void *p, size_t len)
            | ^
      /Users/haribabu.kommi/work/code/wiredtiger/src/utilities/util_misc.c:226:5: note: value obtained from allocator call is returned here
        226 |     return (realloc(p, len));
            |     ^
      3 warnings generated.
      

      Disable these warnings in the CMake configuration, as WiredTiger uses wrappers in the code.

            Assignee:
            Haribabu Kommi
            Reporter:
            Haribabu Kommi
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: