33/// Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
44
55// ReSharper disable CppRedundantInlineSpecifier
6- // NOLINTBEGIN(*DeprecatedOrUnsafeBufferHandling,*err34-c)
6+ // NOLINTBEGIN(*-unchecked-string-to-number-conversion,*-deprecated-headers,*-designated-initializers,*-loop-convert)
7+ // NOLINTBEGIN(*DeprecatedOrUnsafeBufferHandling,*err34-c,*-vararg,*-use-auto,*-use-nullptr,*-redundant-void-arg)
8+ // NOLINTBEGIN(*-cstyle-cast)
79#pragma once
810
911#include <udpard.h> // Shall always be included first.
@@ -74,7 +76,7 @@ typedef struct
7476static inline void * instrumented_allocator_alloc (void * const user_reference , const size_t size )
7577{
7678 instrumented_allocator_t * const self = (instrumented_allocator_t * )user_reference ;
77- void * result = NULL ;
79+ void * result = NULL ; // NOLINT(*-const-correctness)
7880 self -> count_alloc ++ ;
7981 if ((size > 0U ) && //
8082 ((self -> allocated_bytes + size ) <= self -> limit_bytes ) && //
@@ -83,7 +85,7 @@ static inline void* instrumented_allocator_alloc(void* const user_reference, con
8385 void * origin = malloc (size_with_canaries );
8486 TEST_PANIC_UNLESS (origin != NULL );
8587 * ((size_t * )origin ) = size ;
86- uint_least8_t * p = ((uint_least8_t * )origin ) + sizeof (size_t );
88+ uint_least8_t * p = ((uint_least8_t * )origin ) + sizeof (size_t ); // NOLINT(*-const-correctness)
8789 result = ((uint_least8_t * )origin ) + INSTRUMENTED_ALLOCATOR_CANARY_SIZE ;
8890 for (size_t i = sizeof (size_t ); i < INSTRUMENTED_ALLOCATOR_CANARY_SIZE ; i ++ ) // Fill the front canary.
8991 {
@@ -107,7 +109,7 @@ static inline void instrumented_allocator_free(void* const user_reference, const
107109{
108110 instrumented_allocator_t * const self = (instrumented_allocator_t * )user_reference ;
109111 self -> count_free ++ ;
110- if (pointer != NULL ) {
112+ if (pointer != NULL ) { // NOLINTNEXTLINE(*-const-correctness)
111113 uint_least8_t * p = ((uint_least8_t * )pointer ) - INSTRUMENTED_ALLOCATOR_CANARY_SIZE ;
112114 void * const origin = p ;
113115 const size_t true_size = * ((const size_t * )origin );
@@ -183,4 +185,6 @@ static inline void seed_prng(void)
183185}
184186#endif
185187
186- // NOLINTEND(*DeprecatedOrUnsafeBufferHandling,*err34-c)
188+ // NOLINTEND(*-cstyle-cast)
189+ // NOLINTEND(*DeprecatedOrUnsafeBufferHandling,*err34-c,*-vararg,*-use-auto,*-use-nullptr,*-redundant-void-arg)
190+ // NOLINTEND(*-unchecked-string-to-number-conversion,*-deprecated-headers,*-designated-initializers,*-loop-convert)
0 commit comments