You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2024/04/19 14:43:39 UTC
(trafficserver) branch 9.2.x updated: Fix GCC 14.0.1 -std=c++20 build failures (#11189) (#11268)
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 ebad51151b Fix GCC 14.0.1 -std=c++20 build failures (#11189) (#11268)
ebad51151b is described below
commit ebad51151b08ebd1211aff2368e298ae41bcf47f
Author: Masaori Koshiba <ma...@apache.org>
AuthorDate: Fri Apr 19 23:43:33 2024 +0900
Fix GCC 14.0.1 -std=c++20 build failures (#11189) (#11268)
* comparison of unsigned expression in ‘>= 0’ is always true
lib/swoc/include/swoc/TextView.h: In instantiation of ‘uintmax_t swoc::_1_5_11::svto_radix(TextView&) [with int RADIX = 16; uintmax_t = long unsigned int]’:
lib/swoc/include/swoc/TextView.h:1082:23: required from ‘uintmax_t swoc::_1_5_11::svto_radix(TextView&&) [with int N = 16; uintmax_t = long unsigned int]’
lib/swoc/include/swoc/TextView.h:1065:27: error: 1082 | return svto_radix<N>(src);
lib/swoc/include/swoc/TextView.h:1065:27: error: | ~~~~~~~~~~~~~^~~~~
lib/swoc/src/bw_format.cc:928:28: required from here
lib/swoc/include/swoc/TextView.h:1065:27: error: 928 | auto b = svto_radix<16>(span.clip_prefix(2).rebind<char const>());
lib/swoc/include/swoc/TextView.h:1065:27: error: | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lib/swoc/include/swoc/TextView.h:1065:27: error: comparison of unsigned expression in ‘>= 0’ is always true [-Werror=type-limits]
1065 | while (src.size() && (0 <= (v = swoc::svtoi_convert[uint8_t(*src)])) && v < RADIX) {
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors
Second warning:
src/tscore/HostLookup.cc: In member function ‘void CharIndex::Insert(std::string_view, HostBranch*)’:
src/tscore/HostLookup.cc:304:12: error: ‘any_of’ is not a member of ‘std’
304 | if (std::any_of(match_data.begin(), match_data.end(), [](unsigned char c) { return asciiToTable[c] == 255; })) {
| ^~~~~~
src/tscore/HostLookup.cc: In member function ‘HostBranch* CharIndex::Lookup(std::string_view)’:
src/tscore/HostLookup.cc:351:12: error: ‘any_of’ is not a member of ‘std’
351 | if (std::any_of(match_data.begin(), match_data.end(), [](unsigned char c) { return asciiToTable[c] == 255; })) {
| ^~~~~~
* ‘any_of’ is not a member of ‘std’
src/tscore/HostLookup.cc: In member function ‘void CharIndex::Insert(std::string_view, HostBranch*)’:
src/tscore/HostLookup.cc:304:12: error: ‘any_of’ is not a member of ‘std’
304 | if (std::any_of(match_data.begin(), match_data.end(), [](unsigned char c) { return asciiToTable[c] == 255; })) {
| ^~~~~~
src/tscore/HostLookup.cc: In member function ‘HostBranch* CharIndex::Lookup(std::string_view)’:
src/tscore/HostLookup.cc:351:12: error: ‘any_of’ is not a member of ‘std’
351 | if (std::any_of(match_data.begin(), match_data.end(), [](unsigned char c) { return asciiToTable[c] == 255; })) {
| ^~~~~~
* error: template-id not allowed for constructor in C++20
plugins/header_rewrite/matcher.h:71:23: error: template-id not allowed for constructor in C++20 [-Werror=template-id-cdtor]
71 | explicit Matchers<T>(const MatcherOps op) : Matcher(op), _data() {}
| ^
plugins/header_rewrite/matcher.h:71:23: note: remove the ‘< >’
/home/bneradt/src/ts_asf_master_fix_std_20_build_failure/plugins/header_rewrite/matcher.h:222:38: error: template-id not allowed for constructor in C++20 [-Werror=template-id-cdtor]
222 | explicit Matchers<const sockaddr *>(const MatcherOps op) : Matcher(op) {}
| ^
/home/bneradt/src/ts_asf_master_fix_std_20_build_failure/plugins/header_rewrite/matcher.h:222:38: note: remove the ‘< >’
(cherry picked from commit 6a9e39d6bb666a7849f5d414d230776dba543a02)
Conflicts:
lib/swoc/include/swoc/TextView.h
src/tscore/HostLookup.cc
Co-authored-by: Brian Neradt <br...@gmail.com>
---
include/tscpp/util/TextView.h | 2 +-
plugins/header_rewrite/matcher.h | 4 ++--
src/tscore/HostLookup.cc | 1 +
3 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/include/tscpp/util/TextView.h b/include/tscpp/util/TextView.h
index 97acc3b5bb..41ce08a25d 100644
--- a/include/tscpp/util/TextView.h
+++ b/include/tscpp/util/TextView.h
@@ -621,7 +621,7 @@ svto_radix(ts::TextView &src)
static_assert(0 < N && N <= 36, "Radix must be in the range 1..36");
uintmax_t zret{0};
uintmax_t v;
- while (src.size() && (0 <= (v = ts::svtoi_convert[static_cast<unsigned char>(*src)])) && v < N) {
+ while (src.size() && ((v = ts::svtoi_convert[static_cast<unsigned char>(*src)]) < N)) {
auto n = zret * N + v;
if (n < zret) { // overflow / wrap
return std::numeric_limits<uintmax_t>::max();
diff --git a/plugins/header_rewrite/matcher.h b/plugins/header_rewrite/matcher.h
index 45787b18ad..2f903c4a3f 100644
--- a/plugins/header_rewrite/matcher.h
+++ b/plugins/header_rewrite/matcher.h
@@ -67,7 +67,7 @@ protected:
template <class T> class Matchers : public Matcher
{
public:
- explicit Matchers<T>(const MatcherOps op) : Matcher(op), _data() {}
+ explicit Matchers(const MatcherOps op) : Matcher(op), _data() {}
// Getters / setters
const T &
get() const
@@ -218,7 +218,7 @@ private:
template <> class Matchers<const sockaddr *> : public Matcher
{
public:
- explicit Matchers<const sockaddr *>(const MatcherOps op) : Matcher(op) {}
+ explicit Matchers(const MatcherOps op) : Matcher(op) {}
void
set(const std::string &data)
diff --git a/src/tscore/HostLookup.cc b/src/tscore/HostLookup.cc
index 440474e945..20a9f13e0b 100644
--- a/src/tscore/HostLookup.cc
+++ b/src/tscore/HostLookup.cc
@@ -33,6 +33,7 @@
#include "tscore/HostLookup.h"
#include "tscpp/util/TextView.h"
+#include <algorithm>
#include <string_view>
#include <array>
#include <memory>