about summary refs log tree commit diff
path: root/absl/strings
diff options
context:
space:
mode:
authorAbseil Team <absl-team@google.com>2018-12-05T20·37-0800
committerCJ Johnson <johnsoncj@google.com>2018-12-05T20·38-0500
commit284378a71b32dfb3af4e3661f585e671d1b603a3 (patch)
tree4f1f54bbe23436292a618b748bdc5ec6f9890c5f /absl/strings
parent44b0fafc62d9b8f192e8180cbe9c4b806b339d57 (diff)
Export of internal Abseil changes.
--
22fa219d17b2281c0695642830c4300711bd65ea by CJ Johnson <johnsoncj@google.com>:

Rearrange the private method declarations in InlinedVector

PiperOrigin-RevId: 224202447

--
eed3c9f488f23b521bee41d3683eb6cc22517ded by Derek Mauro <dmauro@google.com>:

Fix leak_check target (it was always a no-op when LSAN isn't available).
Fixes https://github.com/abseil/abseil-cpp/issues/232

PiperOrigin-RevId: 224201634

--
fc08039e175204b14a9561f618fcfc0234586801 by Greg Falcon <gfalcon@google.com>:

Add parens around more invocations of min() and max() missed in my prior CL.

PiperOrigin-RevId: 224162430

--
0ec5476a8293c7796cd84928a1a558b14f14f222 by Abseil Team <absl-team@google.com>:

Update absl/numeric/CMakeLists.txt to use new functions
i.e. absl_cc_(library|test)

PiperOrigin-RevId: 224139165

--
2b46aa6fabb20c589661f8bbc84030ecf39ce394 by Abseil Team <absl-team@google.com>:

Update absl/meta/CMakeLists.txt to use new functions
i.e. absl_cc_(library|test)

PiperOrigin-RevId: 224117258

--
6c951c798f8c6903bd8793a8a4b5f69244be8aa9 by Abseil Team <absl-team@google.com>:

Fix 2 Unused C++ BUILD Dependencies

PiperOrigin-RevId: 224070093

--
0ee7bd191708708f91fc5209c197fd93f6e4a8b3 by Greg Falcon <gfalcon@google.com>:

Inside Abseil headers, wrap most invocations of methods and functions named `min` and `max` in parentheses, for better interoperability with Windows toolchains.

CCTZ fixes will appear in a follow-up CL.

PiperOrigin-RevId: 224051960

--
f562f56577b84a8bc07e5873775c01d068531bca by Jon Cohen <cohenjon@google.com>:

Generate Abseil compile options.  The single source of truth is now absl/copts/copts.py

The way this works goes something like this:
copts.py acts as the configuration file.  We use python because unlike JSON it allows comments.  It has two maps in it: one from names to external flags, and one from names to internal flags.

generate_copts.py imports the maps and loops through them to write GENERATED_copts.bzl and GENERATED_AbseilCopts.cmake

AbseilConfigureCopts.cmake and configure_copts.bzl import their respective copts args and set the platform-appropriate copts into ABSL_DEFAULT_COPTS, ABSL_TEST_COPTS, ABSL_EXCEPTIONS_FLAG, and ABSL_EXCEPTIONS_LINKOPTS

For Bazel, each BUILD file load()s configure_copts.bzl

For CMake, AbseilHelpers.cmake include()s AbseilConfigureCopts.cmake to get the final copts and both inserts them as needed into legacy target rules and also makes them available to the rest of our CMakeLists.txt file.  We may instead want to include() AbseilConfigureCopts.cmake directly into each CMakeLists.txt file for consistency, but I'm not sure what the deal is with cmake and include guards, or if they are even needed.  That's also not as idiomatic -- CMake tends to use directory scope where globals set at a higher level CMakeLists.txt file are used in the subdirectory CMakeLists.txt files.

PiperOrigin-RevId: 224039419

--
f7402f6bb65037e668a7355f0a003f5c05a3b6a7 by Abseil Team <absl-team@google.com>:

Import of CCTZ from GitHub.

PiperOrigin-RevId: 224036622
GitOrigin-RevId: 22fa219d17b2281c0695642830c4300711bd65ea
Change-Id: I6b505360539ff2aef8aa30c51a5f7d55db1c75cf
Diffstat (limited to 'absl/strings')
-rw-r--r--absl/strings/BUILD.bazel2
-rw-r--r--absl/strings/internal/charconv_bigint.h14
-rw-r--r--absl/strings/internal/str_format/arg.h2
-rw-r--r--absl/strings/string_view.h8
4 files changed, 13 insertions, 13 deletions
diff --git a/absl/strings/BUILD.bazel b/absl/strings/BUILD.bazel
index 3b85f1b4624e..7635a6198abe 100644
--- a/absl/strings/BUILD.bazel
+++ b/absl/strings/BUILD.bazel
@@ -15,7 +15,7 @@
 #
 
 load(
-    "//absl:copts.bzl",
+    "//absl:copts/configure_copts.bzl",
     "ABSL_DEFAULT_COPTS",
     "ABSL_TEST_COPTS",
     "ABSL_EXCEPTIONS_FLAG",
diff --git a/absl/strings/internal/charconv_bigint.h b/absl/strings/internal/charconv_bigint.h
index 5c579437e521..9d1a1bffe175 100644
--- a/absl/strings/internal/charconv_bigint.h
+++ b/absl/strings/internal/charconv_bigint.h
@@ -103,12 +103,12 @@ class BigUnsigned {
         SetToZero();
         return;
       }
-      size_ = std::min(size_ + word_shift, max_words);
+      size_ = (std::min)(size_ + word_shift, max_words);
       count %= 32;
       if (count == 0) {
         std::copy_backward(words_, words_ + size_ - word_shift, words_ + size_);
       } else {
-        for (int i = std::min(size_, max_words - 1); i > word_shift; --i) {
+        for (int i = (std::min)(size_, max_words - 1); i > word_shift; --i) {
           words_[i] = (words_[i - word_shift] << count) |
                       (words_[i - word_shift - 1] >> (32 - count));
         }
@@ -267,7 +267,7 @@ class BigUnsigned {
   void MultiplyBy(int other_size, const uint32_t* other_words) {
     const int original_size = size_;
     const int first_step =
-        std::min(original_size + other_size - 2, max_words - 1);
+        (std::min)(original_size + other_size - 2, max_words - 1);
     for (int step = first_step; step >= 0; --step) {
       MultiplyStep(original_size, other_words, other_size, step);
     }
@@ -286,7 +286,7 @@ class BigUnsigned {
           value = 0;
         }
       }
-      size_ = std::min(max_words, std::max(index + 1, size_));
+      size_ = (std::min)(max_words, (std::max)(index + 1, size_));
     }
   }
 
@@ -309,7 +309,7 @@ class BigUnsigned {
       } else {
         // Normally 32-bit AddWithCarry() sets size_, but since we don't call
         // it when `high` is 0, do it ourselves here.
-        size_ = std::min(max_words, std::max(index + 1, size_));
+        size_ = (std::min)(max_words, (std::max)(index + 1, size_));
       }
     }
   }
@@ -348,7 +348,7 @@ class BigUnsigned {
 // Returns -1 if lhs < rhs, 0 if lhs == rhs, and 1 if lhs > rhs.
 template <int N, int M>
 int Compare(const BigUnsigned<N>& lhs, const BigUnsigned<M>& rhs) {
-  int limit = std::max(lhs.size(), rhs.size());
+  int limit = (std::max)(lhs.size(), rhs.size());
   for (int i = limit - 1; i >= 0; --i) {
     const uint32_t lhs_word = lhs.GetWord(i);
     const uint32_t rhs_word = rhs.GetWord(i);
@@ -363,7 +363,7 @@ int Compare(const BigUnsigned<N>& lhs, const BigUnsigned<M>& rhs) {
 
 template <int N, int M>
 bool operator==(const BigUnsigned<N>& lhs, const BigUnsigned<M>& rhs) {
-  int limit = std::max(lhs.size(), rhs.size());
+  int limit = (std::max)(lhs.size(), rhs.size());
   for (int i = 0; i < limit; ++i) {
     if (lhs.GetWord(i) != rhs.GetWord(i)) {
       return false;
diff --git a/absl/strings/internal/str_format/arg.h b/absl/strings/internal/str_format/arg.h
index ec9e6f0063b1..ebd40adcd987 100644
--- a/absl/strings/internal/str_format/arg.h
+++ b/absl/strings/internal/str_format/arg.h
@@ -80,7 +80,7 @@ ConvertResult<Conv::s> FormatConvertImpl(const AbslCord& value,
 
   int precision = conv.precision();
   if (precision >= 0)
-    to_write = std::min(to_write, static_cast<size_t>(precision));
+    to_write = (std::min)(to_write, static_cast<size_t>(precision));
 
   space_remaining = Excess(to_write, space_remaining);
 
diff --git a/absl/strings/string_view.h b/absl/strings/string_view.h
index 2cc10f522e13..8cd4fa24e2bc 100644
--- a/absl/strings/string_view.h
+++ b/absl/strings/string_view.h
@@ -355,7 +355,7 @@ class string_view {
   string_view substr(size_type pos, size_type n = npos) const {
     if (ABSL_PREDICT_FALSE(pos > length_))
       base_internal::ThrowStdOutOfRange("absl::string_view::substr");
-    n = std::min(n, length_ - pos);
+    n = (std::min)(n, length_ - pos);
     return string_view(ptr_ + pos, n);
   }
 
@@ -368,7 +368,7 @@ class string_view {
   // on the respective sizes of the two `string_view`s to determine which is
   // smaller, equal, or greater.
   int compare(string_view x) const noexcept {
-    auto min_length = std::min(length_, x.length_);
+    auto min_length = (std::min)(length_, x.length_);
     if (min_length > 0) {
       int r = memcmp(ptr_, x.ptr_, min_length);
       if (r < 0) return -1;
@@ -517,7 +517,7 @@ inline bool operator!=(string_view x, string_view y) noexcept {
 }
 
 inline bool operator<(string_view x, string_view y) noexcept {
-  auto min_size = std::min(x.size(), y.size());
+  auto min_size = (std::min)(x.size(), y.size());
   const int r = min_size == 0 ? 0 : memcmp(x.data(), y.data(), min_size);
   return (r < 0) || (r == 0 && x.size() < y.size());
 }
@@ -547,7 +547,7 @@ namespace absl {
 // Provided because std::string_view::substr throws if `pos > size()`
 inline string_view ClippedSubstr(string_view s, size_t pos,
                                  size_t n = string_view::npos) {
-  pos = std::min(pos, static_cast<size_t>(s.size()));
+  pos = (std::min)(pos, static_cast<size_t>(s.size()));
   return s.substr(pos, n);
 }