about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAbseil Team <absl-team@google.com>2017-11-06T20·54-0800
committermisterg <misterg@google.com>2017-11-06T20·58-0500
commit075cf62092b39b640798f70bf7d16b6c82ca2842 (patch)
tree2a342484ba68d37bc6b296cf426477980373a4c8
parent78e1abca86f4294ab26ef36e534798b893c828bd (diff)
Changes imported from Abseil "staging" branch:
  - c3a608de577e0c278b50916ad4803549929f8f72 Merging https://github.com/abseil/abseil-cpp/pull/8/ inte... by Gennadiy Civil <misterg@google.com>
  - d0b528cdf5843db871784c629cb4e7c5165af716 explicitly cast -1 for Span::npos by Jon Cohen <cohenjon@google.com>
  - 32066311a4379f1144f029aaa3740af59b1e364e Remove GUARDED_VAR and PT_GUARDED_VAR entirely. by Abseil Team <absl-team@google.com>
  - 3d3c69d97d15b5c6457906631054109094c083a6 Remove unneeded inline on constexpr definitions. by Alex Strelnikov <strel@google.com>
  - a9a8fe71f90d0b80de8e77375228a7185032636b Remove unneeded lint suppression. by Alex Strelnikov <strel@google.com>

GitOrigin-RevId: c3a608de577e0c278b50916ad4803549929f8f72
Change-Id: I0897ce0b11e41f83fed8d88f18e079a15d086527
-rw-r--r--CMake/README.md2
-rw-r--r--CMakeLists.txt2
-rw-r--r--README.md5
-rw-r--r--absl/base/thread_annotations.h2
-rw-r--r--absl/numeric/int128.h106
-rw-r--r--absl/types/span.h2
6 files changed, 50 insertions, 69 deletions
diff --git a/CMake/README.md b/CMake/README.md
index 21633f14d517..11160a9d66c2 100644
--- a/CMake/README.md
+++ b/CMake/README.md
@@ -52,7 +52,7 @@
 
 
 You will need to create your own CMake files for cctz until https://github.com/google/cctz/pull/54 lands.  As of this writing, that pull request requires -DBUILD_TESTING=OFF as it doesn't correctly export cctz's dependency on Google Benchmark.
-    
+
     You will find here a non exhaustive list of absl public targets
 
       absl::base
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ddd60502d469..e87f4a84abf6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -67,7 +67,7 @@ check_target(gmock)
 set(ABSL_EXCEPTIONS_FLAG "${CMAKE_CXX_EXCEPTIONS}")
 
 # fix stuff
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FIX_MSVC} ${CMAKE_CXX_FLAGS}") 
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FIX_MSVC} ${CMAKE_CXX_FLAGS}")
 
 list(APPEND ABSL_TEST_COMMON_LIBRARIES
   gtest_main
diff --git a/README.md b/README.md
index dcd01ac6926e..166842a14c7e 100644
--- a/README.md
+++ b/README.md
@@ -85,8 +85,9 @@ For more information about Abseil:
 * Peruse our
   [Abseil Compatibility Guarantees](http://abseil.io/about/compatibility) to
   understand both what we promise to you, and what we expect of you in return.
-
+  
 <a name="cmake"></a>
 ## Build with CMake
 
-Please check the [CMake build instructions](CMake/README.md)
+Please check the [CMake build instructions]
+(CMake/README.md)
diff --git a/absl/base/thread_annotations.h b/absl/base/thread_annotations.h
index 626b0578f321..0da3badc4e2d 100644
--- a/absl/base/thread_annotations.h
+++ b/absl/base/thread_annotations.h
@@ -52,7 +52,6 @@
 //   Mutex mu;
 //   int p1 GUARDED_BY(mu);
 #define GUARDED_BY(x) THREAD_ANNOTATION_ATTRIBUTE__(guarded_by(x))
-#define GUARDED_VAR  // no-op
 
 // PT_GUARDED_BY()
 //
@@ -72,7 +71,6 @@
 //     // guarded by `mu2`:
 //     int *q GUARDED_BY(mu1) PT_GUARDED_BY(mu2);
 #define PT_GUARDED_BY(x) THREAD_ANNOTATION_ATTRIBUTE__(pt_guarded_by(x))
-#define PT_GUARDED_VAR  // no-op
 
 // ACQUIRED_AFTER() / ACQUIRED_BEFORE()
 //
diff --git a/absl/numeric/int128.h b/absl/numeric/int128.h
index afb8bcf16497..ecd6b371f7ea 100644
--- a/absl/numeric/int128.h
+++ b/absl/numeric/int128.h
@@ -93,9 +93,9 @@ class alignas(16) uint128 {
   constexpr uint128(__int128 v);           // NOLINT(runtime/explicit)
   constexpr uint128(unsigned __int128 v);  // NOLINT(runtime/explicit)
 #endif  // ABSL_HAVE_INTRINSIC_INT128
-  explicit uint128(float v);        // NOLINT(runtime/explicit)
-  explicit uint128(double v);       // NOLINT(runtime/explicit)
-  explicit uint128(long double v);  // NOLINT(runtime/explicit)
+  explicit uint128(float v);
+  explicit uint128(double v);
+  explicit uint128(long double v);
 
   // Assignment operators from arithmetic types
   uint128& operator=(int v);
@@ -212,15 +212,13 @@ uint64_t Uint128High64(const uint128& v);
 //                      Implementation details follow
 // --------------------------------------------------------------------------
 
-inline constexpr uint128 MakeUint128(uint64_t top, uint64_t bottom) {
+constexpr uint128 MakeUint128(uint64_t top, uint64_t bottom) {
   return uint128(top, bottom);
 }
 
 // Assignment from integer types.
 
-inline uint128& uint128::operator=(int v) {
-  return *this = uint128(v);
-}
+inline uint128& uint128::operator=(int v) { return *this = uint128(v); }
 
 inline uint128& uint128::operator=(unsigned int v) {
   return *this = uint128(v);
@@ -293,56 +291,54 @@ inline uint64_t Uint128High64(const uint128& v) { return v.hi_; }
 
 #if defined(ABSL_IS_LITTLE_ENDIAN)
 
-inline constexpr uint128::uint128(uint64_t top, uint64_t bottom)
+constexpr uint128::uint128(uint64_t top, uint64_t bottom)
     : lo_(bottom), hi_(top) {}
 
-inline constexpr uint128::uint128(int v)
+constexpr uint128::uint128(int v)
     : lo_(v), hi_(v < 0 ? std::numeric_limits<uint64_t>::max() : 0) {}
-inline constexpr uint128::uint128(long v)  // NOLINT(runtime/int)
+constexpr uint128::uint128(long v)  // NOLINT(runtime/int)
     : lo_(v), hi_(v < 0 ? std::numeric_limits<uint64_t>::max() : 0) {}
-inline constexpr uint128::uint128(long long v)  // NOLINT(runtime/int)
+constexpr uint128::uint128(long long v)  // NOLINT(runtime/int)
     : lo_(v), hi_(v < 0 ? std::numeric_limits<uint64_t>::max() : 0) {}
 
-inline constexpr uint128::uint128(unsigned int v) : lo_(v), hi_(0) {}
+constexpr uint128::uint128(unsigned int v) : lo_(v), hi_(0) {}
 // NOLINTNEXTLINE(runtime/int)
-inline constexpr uint128::uint128(unsigned long v) : lo_(v), hi_(0) {}
+constexpr uint128::uint128(unsigned long v) : lo_(v), hi_(0) {}
 // NOLINTNEXTLINE(runtime/int)
-inline constexpr uint128::uint128(unsigned long long v)
-    : lo_(v), hi_(0) {}
+constexpr uint128::uint128(unsigned long long v) : lo_(v), hi_(0) {}
 
 #ifdef ABSL_HAVE_INTRINSIC_INT128
-inline constexpr uint128::uint128(__int128 v)
+constexpr uint128::uint128(__int128 v)
     : lo_(static_cast<uint64_t>(v & ~uint64_t{0})),
       hi_(static_cast<uint64_t>(static_cast<unsigned __int128>(v) >> 64)) {}
-inline constexpr uint128::uint128(unsigned __int128 v)
+constexpr uint128::uint128(unsigned __int128 v)
     : lo_(static_cast<uint64_t>(v & ~uint64_t{0})),
       hi_(static_cast<uint64_t>(v >> 64)) {}
 #endif  // ABSL_HAVE_INTRINSIC_INT128
 
 #elif defined(ABSL_IS_BIG_ENDIAN)
 
-inline constexpr uint128::uint128(uint64_t top, uint64_t bottom)
+constexpr uint128::uint128(uint64_t top, uint64_t bottom)
     : hi_(top), lo_(bottom) {}
 
-inline constexpr uint128::uint128(int v)
+constexpr uint128::uint128(int v)
     : hi_(v < 0 ? std::numeric_limits<uint64_t>::max() : 0), lo_(v) {}
-inline constexpr uint128::uint128(long v)  // NOLINT(runtime/int)
+constexpr uint128::uint128(long v)  // NOLINT(runtime/int)
     : hi_(v < 0 ? std::numeric_limits<uint64_t>::max() : 0), lo_(v) {}
-inline constexpr uint128::uint128(long long v)  // NOLINT(runtime/int)
+constexpr uint128::uint128(long long v)  // NOLINT(runtime/int)
     : hi_(v < 0 ? std::numeric_limits<uint64_t>::max() : 0), lo_(v) {}
 
-inline constexpr uint128::uint128(unsigned int v) : hi_(0), lo_(v) {}
+constexpr uint128::uint128(unsigned int v) : hi_(0), lo_(v) {}
 // NOLINTNEXTLINE(runtime/int)
-inline constexpr uint128::uint128(unsigned long v) : hi_(0), lo_(v) {}
+constexpr uint128::uint128(unsigned long v) : hi_(0), lo_(v) {}
 // NOLINTNEXTLINE(runtime/int)
-inline constexpr uint128::uint128(unsigned long long v)
-    : hi_(0), lo_(v) {}
+constexpr uint128::uint128(unsigned long long v) : hi_(0), lo_(v) {}
 
 #ifdef ABSL_HAVE_INTRINSIC_INT128
-inline constexpr uint128::uint128(__int128 v)
+constexpr uint128::uint128(__int128 v)
     : hi_(static_cast<uint64_t>(static_cast<unsigned __int128>(v) >> 64)),
       lo_(static_cast<uint64_t>(v & ~uint64_t{0})) {}
-inline constexpr uint128::uint128(unsigned __int128 v)
+constexpr uint128::uint128(unsigned __int128 v)
     : hi_(static_cast<uint64_t>(v >> 64)),
       lo_(static_cast<uint64_t>(v & ~uint64_t{0})) {}
 #endif  // ABSL_HAVE_INTRINSIC_INT128
@@ -353,78 +349,64 @@ inline constexpr uint128::uint128(unsigned __int128 v)
 
 // Conversion operators to integer types.
 
-inline constexpr uint128::operator bool() const {
-  return lo_ || hi_;
-}
+constexpr uint128::operator bool() const { return lo_ || hi_; }
 
-inline constexpr uint128::operator char() const {
-  return static_cast<char>(lo_);
-}
+constexpr uint128::operator char() const { return static_cast<char>(lo_); }
 
-inline constexpr uint128::operator signed char() const {
+constexpr uint128::operator signed char() const {
   return static_cast<signed char>(lo_);
 }
 
-inline constexpr uint128::operator unsigned char() const {
+constexpr uint128::operator unsigned char() const {
   return static_cast<unsigned char>(lo_);
 }
 
-inline constexpr uint128::operator char16_t() const {
+constexpr uint128::operator char16_t() const {
   return static_cast<char16_t>(lo_);
 }
 
-inline constexpr uint128::operator char32_t() const {
+constexpr uint128::operator char32_t() const {
   return static_cast<char32_t>(lo_);
 }
 
-inline constexpr uint128::operator wchar_t() const {
+constexpr uint128::operator wchar_t() const {
   return static_cast<wchar_t>(lo_);
 }
 
 // NOLINTNEXTLINE(runtime/int)
-inline constexpr uint128::operator short() const {
-  return static_cast<short>(lo_);  // NOLINT(runtime/int)
-}
+constexpr uint128::operator short() const { return static_cast<short>(lo_); }
 
-// NOLINTNEXTLINE(runtime/int)
-inline constexpr uint128::operator unsigned short() const {
-  return static_cast<unsigned short>(lo_);  // NOLINT(runtime/int)
+constexpr uint128::operator unsigned short() const {  // NOLINT(runtime/int)
+  return static_cast<unsigned short>(lo_);            // NOLINT(runtime/int)
 }
 
-inline constexpr uint128::operator int() const {
-  return static_cast<int>(lo_);
-}
+constexpr uint128::operator int() const { return static_cast<int>(lo_); }
 
-inline constexpr uint128::operator unsigned int() const {
+constexpr uint128::operator unsigned int() const {
   return static_cast<unsigned int>(lo_);
 }
 
 // NOLINTNEXTLINE(runtime/int)
-inline constexpr uint128::operator long() const {
-  return static_cast<long>(lo_);  // NOLINT(runtime/int)
-}
+constexpr uint128::operator long() const { return static_cast<long>(lo_); }
 
-// NOLINTNEXTLINE(runtime/int)
-inline constexpr uint128::operator unsigned long() const {
-  return static_cast<unsigned long>(lo_);  // NOLINT(runtime/int)
+constexpr uint128::operator unsigned long() const {  // NOLINT(runtime/int)
+  return static_cast<unsigned long>(lo_);            // NOLINT(runtime/int)
 }
 
-// NOLINTNEXTLINE(runtime/int)
-inline constexpr uint128::operator long long() const {
-  return static_cast<long long>(lo_);  // NOLINT(runtime/int)
+constexpr uint128::operator long long() const {  // NOLINT(runtime/int)
+  return static_cast<long long>(lo_);            // NOLINT(runtime/int)
 }
 
-// NOLINTNEXTLINE(runtime/int)
-inline constexpr uint128::operator unsigned long long() const {
-  return static_cast<unsigned long long>(lo_);  // NOLINT(runtime/int)
+constexpr uint128::operator unsigned long long() const {  // NOLINT(runtime/int)
+  return static_cast<unsigned long long>(lo_);            // NOLINT(runtime/int)
 }
 
 #ifdef ABSL_HAVE_INTRINSIC_INT128
-inline constexpr uint128::operator __int128() const {
+constexpr uint128::operator __int128() const {
   return (static_cast<__int128>(hi_) << 64) + lo_;
 }
 
-inline constexpr uint128::operator unsigned __int128() const {
+constexpr uint128::operator unsigned __int128() const {
   return (static_cast<unsigned __int128>(hi_) << 64) + lo_;
 }
 #endif  // ABSL_HAVE_INTRINSIC_INT128
diff --git a/absl/types/span.h b/absl/types/span.h
index f4738153116e..e2abe78059dd 100644
--- a/absl/types/span.h
+++ b/absl/types/span.h
@@ -279,7 +279,7 @@ class Span {
   using size_type = size_t;
   using difference_type = ptrdiff_t;
 
-  static const size_type npos = -1;
+  static const size_type npos = ~size_type{0};
 
   constexpr Span() noexcept : Span(nullptr, 0) {}
   constexpr Span(pointer array, size_type length) noexcept