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

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

commit 4d48eb2fdcf319ed98b3026ba404c7ac26f4206c
Author: Mo Chen <[email protected]>
AuthorDate: Tue Apr 22 13:19:44 2025 -0500

    Fix build for clang 20 (#12202)
    
    Fix these warnings:
    
    lib/swoc/src/swoc_ip.cc:242:10: error: first argument in call to 'memset' 
is a pointer to non-trivially copyable type 'swoc::IPEndpoint' 
[-Werror,-Wnontrivial-memaccess]
      242 |   memset(this, 0, sizeof(*this));
          |          ^
    
    (cherry picked from commit 0da9114ff940049a57edfef55ba855d5518cd721)
---
 include/tscore/CryptoHash.h | 4 ++--
 lib/swoc/src/swoc_ip.cc     | 4 ++--
 src/proxy/HostStatus.cc     | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/include/tscore/CryptoHash.h b/include/tscore/CryptoHash.h
index b712cb1d1f..28a5a21eb8 100644
--- a/include/tscore/CryptoHash.h
+++ b/include/tscore/CryptoHash.h
@@ -46,7 +46,7 @@ union CryptoHash {
   uint8_t  u8[CRYPTO_HASH_SIZE / sizeof(uint8_t)];
 
   /// Default constructor - init to zero.
-  CryptoHash() { memset(this, 0, sizeof(*this)); }
+  CryptoHash() { memset(static_cast<void *>(this), 0, sizeof(*this)); }
   /// Copy constructor.
   CryptoHash(CryptoHash const &that) = default;
 
@@ -55,7 +55,7 @@ union CryptoHash {
   operator=(CryptoHash const &that)
   {
     if (this != &that) {
-      memcpy(this, &that, sizeof(*this));
+      memcpy(static_cast<void *>(this), &that, sizeof(*this));
     }
     return *this;
   }
diff --git a/lib/swoc/src/swoc_ip.cc b/lib/swoc/src/swoc_ip.cc
index 6403922158..6f6ae13b10 100644
--- a/lib/swoc/src/swoc_ip.cc
+++ b/lib/swoc/src/swoc_ip.cc
@@ -239,7 +239,7 @@ IPEndpoint::family_name(sa_family_t family) {
 
 IPEndpoint &
 IPEndpoint::set_to_any(int family) {
-  memset(this, 0, sizeof(*this));
+  memset(static_cast<void *>(this), 0, sizeof(*this));
   if (AF_INET == family) {
     sa4.sin_family      = family;
     sa4.sin_addr.s_addr = INADDR_ANY;
@@ -268,7 +268,7 @@ IPEndpoint::is_any() const {
 
 IPEndpoint &
 IPEndpoint::set_to_loopback(int family) {
-  memset(this, 0, sizeof(*this));
+  memset(static_cast<void *>(this), 0, sizeof(*this));
   if (AF_INET == family) {
     sa.sa_family        = family;
     sa4.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
diff --git a/src/proxy/HostStatus.cc b/src/proxy/HostStatus.cc
index ac397994e1..20c64644cb 100644
--- a/src/proxy/HostStatus.cc
+++ b/src/proxy/HostStatus.cc
@@ -214,7 +214,7 @@ HostStatus::setHostStatus(const std::string_view name, 
TSHostStatus status, cons
       host_stat = it->second;
     } else {
       host_stat = static_cast<HostStatRec *>(ats_malloc(sizeof(HostStatRec)));
-      bzero(host_stat, sizeof(HostStatRec));
+      bzero(static_cast<void *>(host_stat), sizeof(HostStatRec));
       hosts_statuses.emplace(name, host_stat);
     }
     if (reason & Reason::ACTIVE) {

Reply via email to