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

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


The following commit(s) were added to refs/heads/9.2.x by this push:
     new ac59f38f62 Fix clang 16 warnings (#9586) (#9640)
ac59f38f62 is described below

commit ac59f38f621f844992124dd34d1e483660324658
Author: Brian Neradt <brian.ner...@gmail.com>
AuthorDate: Tue Apr 25 13:37:21 2023 -0500

    Fix clang 16 warnings (#9586) (#9640)
    
    * Address QUICPacket overloaded-virtual warnings
    
    clang-16 warns that a couple functions in QuickPacket.h have the same
    name as a virtual function but are not overloading. It is highlighting
    that this might be a mistake. It is not in these cases, so we are
    addressing this with using directives to make the intention explicit.
    
    * Disable type-limits warning in Magic++.h
    
    Magic++.h is a system file that has type warning in it. Disabling this
    warning for that file because it is a system file rather than an ATS
    file that we manage.
    
    * Update query_remap.c return type
    
    Fix int/enum type mismatch in query_remap.c by using the TSReturnCode
    types.
    
    * WSBuffer.h: Addressed undefined uint warnings
    
    Include cstdint to include the definition of uint16_t.
    
    * TSVConnFd.cc: include cstdint for int64_t definition
    
    (cherry picked from commit 4e0422744937996bc73ee54eab6f6ed7c473ca05)
    
    Conflicts:
          tests/gold_tests/pluginTest/TSVConnFd/TSVConnFd.cc
---
 example/plugins/c-api/query_remap/query_remap.c       | 4 ++--
 example/plugins/cpp-api/websocket/WSBuffer.h          | 1 +
 iocore/net/quic/QUICPacket.h                          | 8 ++++++++
 plugins/experimental/magick/magick.cc                 | 7 +++++++
 plugins/experimental/webp_transform/ImageTransform.cc | 7 +++++--
 5 files changed, 23 insertions(+), 4 deletions(-)

diff --git a/example/plugins/c-api/query_remap/query_remap.c 
b/example/plugins/c-api/query_remap/query_remap.c
index 8bea3993a8..18e58b228f 100644
--- a/example/plugins/c-api/query_remap/query_remap.c
+++ b/example/plugins/c-api/query_remap/query_remap.c
@@ -41,7 +41,7 @@ typedef struct _query_remap_info {
   int num_hosts;
 } query_remap_info;
 
-int
+TSReturnCode
 TSRemapInit(TSRemapInterface *api_info ATS_UNUSED, char *errbuf ATS_UNUSED, 
int errbuf_size ATS_UNUSED)
 {
   /* Called at TS startup. Nothing needed for this plugin */
@@ -49,7 +49,7 @@ TSRemapInit(TSRemapInterface *api_info ATS_UNUSED, char 
*errbuf ATS_UNUSED, int
   return 0;
 }
 
-int
+TSReturnCode
 TSRemapNewInstance(int argc, char *argv[], void **ih, char *errbuf ATS_UNUSED, 
int errbuf_size ATS_UNUSED)
 {
   /* Called for each remap rule using this plugin. The parameters are parsed 
here */
diff --git a/example/plugins/cpp-api/websocket/WSBuffer.h 
b/example/plugins/cpp-api/websocket/WSBuffer.h
index cf7bdc54b0..da863f5d64 100644
--- a/example/plugins/cpp-api/websocket/WSBuffer.h
+++ b/example/plugins/cpp-api/websocket/WSBuffer.h
@@ -23,6 +23,7 @@
 
 #pragma once
 
+#include <cstdint>
 #include <string>
 
 enum ws_frametype {
diff --git a/iocore/net/quic/QUICPacket.h b/iocore/net/quic/QUICPacket.h
index 49d0b145f8..dea4dc81a9 100644
--- a/iocore/net/quic/QUICPacket.h
+++ b/iocore/net/quic/QUICPacket.h
@@ -206,8 +206,16 @@ public:
   QUICConnectionId source_cid() const;
   virtual QUICVersion version() const;
 
+  // Explicitly tell the compiler that we intentionally want both the
+  // QUICPacketR::type and the following static type. Otherwise it warns
+  // that we might have accidentally not formed our signatures correctly
+  // via a `-Werror=overloaded-virtual` warning.
+  using QUICPacketR::type;
   static bool type(QUICPacketType &type, const uint8_t *packet, size_t 
packet_len);
   static bool version(QUICVersion &version, const uint8_t *packet, size_t 
packet_len);
+
+  // Again, address a `-Werror=overloaded-virtual` warning.
+  using QUICPacket::key_phase;
   static bool key_phase(QUICKeyPhase &key_phase, const uint8_t *packet, size_t 
packet_len);
   static bool length(size_t &length, uint8_t &length_field_len, size_t 
&length_field_offset, const uint8_t *packet,
                      size_t packet_len);
diff --git a/plugins/experimental/magick/magick.cc 
b/plugins/experimental/magick/magick.cc
index 9aa0bd28a4..4efcbf7703 100644
--- a/plugins/experimental/magick/magick.cc
+++ b/plugins/experimental/magick/magick.cc
@@ -40,7 +40,14 @@
 #include <openssl/pem.h>
 
 #if MAGICK_VERSION > 6
+#if defined(__GNUC__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wtype-limits"
+#endif
 #include <MagickWand/MagickWand.h>
+#if defined(__GNUC__)
+#pragma GCC diagnostic pop
+#endif
 #else
 #include <wand/MagickWand.h>
 #endif
diff --git a/plugins/experimental/webp_transform/ImageTransform.cc 
b/plugins/experimental/webp_transform/ImageTransform.cc
index c749707183..bb6a06fec2 100644
--- a/plugins/experimental/webp_transform/ImageTransform.cc
+++ b/plugins/experimental/webp_transform/ImageTransform.cc
@@ -25,12 +25,15 @@
 #include "tscpp/api/Logger.h"
 #include "tscpp/api/Stat.h"
 
-#if defined(__GNUC__) && !defined(__clang__)
+#if defined(__GNUC__)
 #pragma GCC diagnostic push
+#if !defined(__clang__)
 #pragma GCC diagnostic ignored "-Wsuggest-override"
 #endif
+#pragma GCC diagnostic ignored "-Wtype-limits"
+#endif
 #include <Magick++.h>
-#if defined(__GNUC__) && !defined(__clang__)
+#if defined(__GNUC__)
 #pragma GCC diagnostic pop
 #endif
 

Reply via email to