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

cmcfarlen pushed a commit to branch 10.0.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git

commit d8cffa0b8f7e71cbcf4d933e754fbeaf7ff2ca80
Author: Pavel Vazharov <[email protected]>
AuthorDate: Mon Jun 17 18:37:10 2024 +0300

    Fix unused parameters in tscore (#11406)
    
    * Fix unused parameters in tscore
    
    * Use /* name ATS_UNUSED */ where appropriate instead of [[maybe_unused]]
    
    (cherry picked from commit 9147f875c96a6889d6e0f8a422fc0e6c12781211)
---
 include/tscore/Allocator.h  | 8 ++++----
 include/tscore/Extendible.h | 8 ++++----
 src/tscore/ArgParser.cc     | 5 +++--
 src/tscore/ink_memory.cc    | 6 +++---
 src/tscore/ink_queue.cc     | 2 +-
 5 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/include/tscore/Allocator.h b/include/tscore/Allocator.h
index 785dbae28a..6cb44e86bd 100644
--- a/include/tscore/Allocator.h
+++ b/include/tscore/Allocator.h
@@ -187,16 +187,16 @@ public:
     @param chunk_size number of units to be allocated if free pool is empty.
     @param alignment of objects must be a power of 2.
   */
-  MallocAllocator(const char *name, unsigned int element_size, unsigned int 
chunk_size = 128, unsigned int alignment = 8,
-                  bool use_hugepages = false)
+  MallocAllocator(const char * /* name ATS_UNUSED */, unsigned int 
element_size, unsigned int /* chunk_size  ATS_UNUSED */ = 128,
+                  unsigned int alignment = 8, bool /* use_hugepages  
ATS_UNUSED */ = false)
     : element_size(element_size), alignment(alignment), advice(0)
   {
   }
 
   /** Re-initialize the parameters of the allocator. */
   void
-  re_init(const char *name, unsigned int element_size, unsigned int 
chunk_size, unsigned int alignment, bool use_hugepages,
-          int advice)
+  re_init(const char * /* name ATS_UNUSED */, unsigned int element_size, 
unsigned int /* chunk_size ATS_UNUSED */,
+          unsigned int alignment, bool /* use_hugepages ATS_UNUSED */, int 
advice)
   {
     this->element_size = element_size;
     this->alignment    = alignment;
diff --git a/include/tscore/Extendible.h b/include/tscore/Extendible.h
index 1e60087790..5ba7c6d9fe 100644
--- a/include/tscore/Extendible.h
+++ b/include/tscore/Extendible.h
@@ -54,11 +54,11 @@
 //////////////////////////////////////////
 /// SUPPORT MACRO
 #define DEF_EXT_NEW_DEL(cls)               \
-  void *operator new(size_t sz)            \
+  void *operator new(size_t)               \
   {                                        \
     return ats_malloc(ext::sizeOf<cls>()); \
   }                                        \
-  void *operator new(size_t sz, void *ptr) \
+  void *operator new(size_t, void *ptr)    \
   {                                        \
     return ptr;                            \
   }                                        \
@@ -306,14 +306,14 @@ namespace details
 
   template <typename Derived_t, typename Field_t>
   Field_t const &
-  fieldGet(void const *fld_ptr, FieldId<Derived_t, Field_t> const &field)
+  fieldGet(void const *fld_ptr, FieldId<Derived_t, Field_t> const & /* field 
ATS_UNUSED */)
   {
     return *static_cast<Field_t const *>(fld_ptr);
   }
 
   template <typename Derived_t, typename Field_t>
   Field_t &
-  fieldSet(void *fld_ptr, FieldId<Derived_t, Field_t> const &field)
+  fieldSet(void *fld_ptr, FieldId<Derived_t, Field_t> const & /* field 
ATS_UNUSED */)
   {
     return *static_cast<Field_t *>(fld_ptr);
   }
diff --git a/src/tscore/ArgParser.cc b/src/tscore/ArgParser.cc
index ed84edcadd..d863a3cc25 100644
--- a/src/tscore/ArgParser.cc
+++ b/src/tscore/ArgParser.cc
@@ -232,7 +232,8 @@ ArgParser::Command::Command(std::string const &name, 
std::string const &descript
 
 // check if this is a valid option before adding
 void
-ArgParser::Command::check_option(std::string const &long_option, std::string 
const &short_option, std::string const &key) const
+ArgParser::Command::check_option(std::string const &long_option, std::string 
const &short_option,
+                                 std::string const & /* key ATS_UNUSED */) 
const
 {
   if (long_option.size() < 3 || long_option[0] != '-' || long_option[1] != 
'-') {
     // invalid name
@@ -256,7 +257,7 @@ ArgParser::Command::check_option(std::string const 
&long_option, std::string con
 
 // check if this is a valid command before adding
 void
-ArgParser::Command::check_command(std::string const &name, std::string const 
&key) const
+ArgParser::Command::check_command(std::string const &name, std::string const & 
/* key ATS_UNUSED */) const
 {
   if (name.empty()) {
     // invalid name
diff --git a/src/tscore/ink_memory.cc b/src/tscore/ink_memory.cc
index 44f5730e1d..649844ec2b 100644
--- a/src/tscore/ink_memory.cc
+++ b/src/tscore/ink_memory.cc
@@ -193,7 +193,7 @@ ats_mlock(caddr_t addr, size_t len)
 }
 
 void *
-ats_track_malloc(size_t size, uint64_t *stat)
+ats_track_malloc(size_t size, [[maybe_unused]] uint64_t *stat)
 {
   void *ptr = ats_malloc(size);
 #ifdef HAVE_MALLOC_USABLE_SIZE
@@ -203,7 +203,7 @@ ats_track_malloc(size_t size, uint64_t *stat)
 }
 
 void *
-ats_track_realloc(void *ptr, size_t size, uint64_t *alloc_stat, uint64_t 
*free_stat)
+ats_track_realloc(void *ptr, size_t size, [[maybe_unused]] uint64_t 
*alloc_stat, [[maybe_unused]] uint64_t *free_stat)
 {
 #ifdef HAVE_MALLOC_USABLE_SIZE
   const size_t old_size = malloc_usable_size(ptr);
@@ -222,7 +222,7 @@ ats_track_realloc(void *ptr, size_t size, uint64_t 
*alloc_stat, uint64_t *free_s
 }
 
 void
-ats_track_free(void *ptr, uint64_t *stat)
+ats_track_free(void *ptr, [[maybe_unused]] uint64_t *stat)
 {
   if (ptr == nullptr) {
     return;
diff --git a/src/tscore/ink_queue.cc b/src/tscore/ink_queue.cc
index 634024da2b..2029cf0009 100644
--- a/src/tscore/ink_queue.cc
+++ b/src/tscore/ink_queue.cc
@@ -362,7 +362,7 @@ ink_freelist_free_bulk(InkFreeList *f, void *head, void 
*tail, size_t num_item)
 }
 
 static void
-freelist_bulkfree(InkFreeList *f, void *head, void *tail, size_t num_item)
+freelist_bulkfree(InkFreeList *f, void *head, void *tail, [[maybe_unused]] 
size_t num_item)
 {
   void **adr_of_next = ADDRESS_OF_NEXT(tail, 0);
   head_p h;

Reply via email to