You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by am...@apache.org on 2018/04/06 17:23:11 UTC

[trafficserver] branch master updated: Cleanup: Fix make check issues with running on -std=c++17

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

amc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
     new 9d22d06  Cleanup: Fix make check issues with running on -std=c++17
9d22d06 is described below

commit 9d22d06467fd7028c8a44af026587a3663a01866
Author: Alan M. Carroll <am...@apache.org>
AuthorDate: Wed Apr 4 18:42:14 2018 -0500

    Cleanup: Fix make check issues with running on -std=c++17
---
 lib/ts/unit-tests/test_BufferWriterFormat.cc |  6 +++---
 lib/ts/unit-tests/test_string_view.cc        | 20 +++++++++++---------
 proxy/hdrs/HTTP.h                            |  2 +-
 3 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/lib/ts/unit-tests/test_BufferWriterFormat.cc b/lib/ts/unit-tests/test_BufferWriterFormat.cc
index b1a5b03..3deed41 100644
--- a/lib/ts/unit-tests/test_BufferWriterFormat.cc
+++ b/lib/ts/unit-tests/test_BufferWriterFormat.cc
@@ -221,14 +221,14 @@ TEST_CASE("bwstring", "[bwprint][bwstring]")
   ts::TextView fmt("{} -- {}");
   ts::string_view text{"e99a18c428cb38d5f260853678922e03"};
 
-  bwprint(s, fmt, "string", 956);
+  ts::bwprint(s, fmt, "string", 956);
   REQUIRE(s.size() == 13);
   REQUIRE(s == "string -- 956");
 
-  bwprint(s, fmt, 99999, text);
+  ts::bwprint(s, fmt, 99999, text);
   REQUIRE(s == "99999 -- e99a18c428cb38d5f260853678922e03");
 
-  bwprint(s, "{} .. |{:,20}|", 32767, text);
+  ts::bwprint(s, "{} .. |{:,20}|", 32767, text);
   REQUIRE(s == "32767 .. |e99a18c428cb38d5f260|");
 }
 
diff --git a/lib/ts/unit-tests/test_string_view.cc b/lib/ts/unit-tests/test_string_view.cc
index 0eaf1fd..a9bbace 100644
--- a/lib/ts/unit-tests/test_string_view.cc
+++ b/lib/ts/unit-tests/test_string_view.cc
@@ -253,15 +253,17 @@ TEST_CASE("Access & iterators", "[string_view] [access]")
   SECTION("iterators: begin, end, rbegin, rend")
   {
     ts::string_view sv("abcde");
+    ts::string_view::iterator spot;
+    ts::string_view::reverse_iterator rspot;
 
     REQUIRE(*sv.begin() == 'a');
     REQUIRE(*sv.cbegin() == 'a');
-    REQUIRE(*(--sv.end()) == 'e');
-    REQUIRE(*(--sv.cend()) == 'e');
+    REQUIRE(*(--(spot = sv.end())) == 'e');
+    REQUIRE(*(--(spot = sv.cend())) == 'e');
     REQUIRE(*sv.rbegin() == 'e');
     REQUIRE(*sv.crbegin() == 'e');
-    REQUIRE(*(--sv.rend()) == 'a');
-    REQUIRE(*(--sv.crend()) == 'a');
+    REQUIRE(*(--(rspot = sv.rend())) == 'a');
+    REQUIRE(*(--(rspot = sv.crend())) == 'a');
 
     int n = 0;
     for (auto it : sv) {
@@ -292,7 +294,7 @@ TEST_CASE("Access & iterators", "[string_view] [access]")
     REQUIRE_THROWS_AS(sv.at(100), std::out_of_range);
     REQUIRE_THROWS_AS(sv.at(-1), std::out_of_range);
 
-#if defined(_DEBUG)
+#if defined(_DEBUG) && __cplusplus <= 201103L
     REQUIRE_THROWS_AS(sv[100], std::out_of_range);
     REQUIRE_THROWS_AS(sv[-1], std::out_of_range);
 #else
@@ -310,7 +312,7 @@ TEST_CASE("Capacity", "[string_view] [capacity]")
     REQUIRE(sv.size() == 0);
     REQUIRE(sv.length() == 0);
     REQUIRE(sv.empty() == true);
-    REQUIRE(sv.max_size() == 0xfffffffffffffffe);
+    REQUIRE(sv.max_size() >= 0x3ffffffffffffffb);
   }
 
   SECTION("literal string")
@@ -319,7 +321,7 @@ TEST_CASE("Capacity", "[string_view] [capacity]")
     REQUIRE(sv.size() == 5);
     REQUIRE(sv.length() == 5);
     REQUIRE(sv.empty() == false);
-    REQUIRE(sv.max_size() == 0xfffffffffffffffe);
+    REQUIRE(sv.max_size() >= 0x3ffffffffffffffb);
   }
 }
 
@@ -349,8 +351,8 @@ TEST_CASE("Modifier", "[string_view] [modifier]")
     sv.remove_suffix(3);
     REQUIRE(sv == "ab");
 
-    sv.remove_suffix(100);
-    REQUIRE(sv == "");
+    sv.remove_suffix(2);
+    REQUIRE(sv.size() == 0);
   }
 
   SECTION("swap")
diff --git a/proxy/hdrs/HTTP.h b/proxy/hdrs/HTTP.h
index 0f59213..47d750b 100644
--- a/proxy/hdrs/HTTP.h
+++ b/proxy/hdrs/HTTP.h
@@ -1550,7 +1550,7 @@ HTTPInfo::compare_object_key(const CryptoHash *hash)
 inline int64_t
 HTTPInfo::object_size_get()
 {
-  int64_t val;
+  int64_t val = 0; // make gcc shut up.
   int32_t *pi = reinterpret_cast<int32_t *>(&val);
 
   pi[0] = m_alt->m_object_size[0];

-- 
To stop receiving notification emails like this one, please contact
amc@apache.org.