summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Abseil Team <absl-team@google.com>2021-03-24 18:51:51 -0700
committerGravatar Derek Mauro <dmauro@google.com>2021-03-25 11:05:20 -0400
commita09b5de0d57d7b2179210989ab63361c3c1894f5 (patch)
tree54987b10801ee723d0641e6385e34e2f69feb528
parent1fdbe1ea1b8c835c11ed6fbec4d4259ad104f765 (diff)
Export of internal Abseil changes
-- 3de7250f2988e360764479fa590d299a649987c0 by Derek Mauro <dmauro@google.com>: Make the SOVERSION fit into 16 bits to make the MacOS linker happy PiperOrigin-RevId: 364939757 -- dead27aa0734a89ccb25da807e08e61000a47f8f by Abseil Team <absl-team@google.com>: Update `ABSL_ATTRIBUTE_UNUSED`'s documentation that `[[maybe_unused]]` in C++17 and up is now the preferred usage solution. Also document why we can't update `ABSL_ATTRIBUTE_UNUSED` to use `[[maybe_unused]]` (differences in positioning requirements). PiperOrigin-RevId: 364900016 -- 0baf1b01dc9a2b5f9869ff5a52a1cf7a032055a3 by Abseil Team <absl-team@google.com>: Slightly weaken the spec for `absl::string_view::compare` to match C++17. The Abseil-specific implementation provides a stronger guarantee than required by `std::string_view`, returning +1, 0, or -1. When `absl::string_view` is an alias for `std::string_view`, these are only guaranteed to be positive, zero, and negative. Portable code should not depend on the stronger guarantee. PiperOrigin-RevId: 364846419 GitOrigin-RevId: 3de7250f2988e360764479fa590d299a649987c0 Change-Id: I7c74004fc38c9f5eaad5b104a993b79518497c5b
-rw-r--r--absl/base/attributes.h7
-rw-r--r--absl/strings/string_view.h10
-rwxr-xr-xcreate_lts.py15
3 files changed, 21 insertions, 11 deletions
diff --git a/absl/base/attributes.h b/absl/base/attributes.h
index cf2cb550..4a8581e1 100644
--- a/absl/base/attributes.h
+++ b/absl/base/attributes.h
@@ -524,6 +524,13 @@
// ABSL_ATTRIBUTE_UNUSED
//
// Prevents the compiler from complaining about variables that appear unused.
+//
+// For code or headers that are assured to only build with C++17 and up, prefer
+// just using the standard '[[maybe_unused]]' directly over this macro.
+//
+// Due to differences in positioning requirements between the old, compiler
+// specific __attribute__ syntax and the now standard [[maybe_unused]], this
+// macro does not attempt to take advantage of '[[maybe_unused]]'.
#if ABSL_HAVE_ATTRIBUTE(unused) || (defined(__GNUC__) && !defined(__clang__))
#undef ABSL_ATTRIBUTE_UNUSED
#define ABSL_ATTRIBUTE_UNUSED __attribute__((__unused__))
diff --git a/absl/strings/string_view.h b/absl/strings/string_view.h
index 5260b5b7..b276bdba 100644
--- a/absl/strings/string_view.h
+++ b/absl/strings/string_view.h
@@ -398,12 +398,10 @@ class string_view {
// string_view::compare()
//
- // Performs a lexicographical comparison between the `string_view` and
- // another `absl::string_view`, returning -1 if `this` is less than, 0 if
- // `this` is equal to, and 1 if `this` is greater than the passed string
- // view. Note that in the case of data equality, a further comparison is made
- // on the respective sizes of the two `string_view`s to determine which is
- // smaller, equal, or greater.
+ // Performs a lexicographical comparison between this `string_view` and
+ // another `string_view` `x`, returning a negative value if `*this` is less
+ // than `x`, 0 if `*this` is equal to `x`, and a positive value if `*this`
+ // is greater than `x`.
constexpr int compare(string_view x) const noexcept {
return CompareImpl(length_, x.length_,
Min(length_, x.length_) == 0
diff --git a/create_lts.py b/create_lts.py
index a98c76b4..302812ad 100755
--- a/create_lts.py
+++ b/create_lts.py
@@ -108,11 +108,16 @@ def main(argv):
'project(absl LANGUAGES CXX)':
'project(absl LANGUAGES CXX VERSION {})'.format(datestamp)
})
- # Set the SOVERSION to YYYYMMDD.0.0 - The first 0 means we only have
- # ABI compatible changes, and the second 0 means we can increment it
- # to mark changes as ABI-compatible, for patch releases.
- ReplaceStringsInFile('CMake/AbseilHelpers.cmake',
- {'SOVERSION 0': 'SOVERSION "{}.0.0"'.format(datestamp)})
+ # Set the SOVERSION to YYMM.0.0 - The first 0 means we only have ABI
+ # compatible changes, and the second 0 means we can increment it to
+ # mark changes as ABI-compatible, for patch releases. Note that we
+ # only use the last two digits of the year and the month because the
+ # MacOS linker requires the first part of the SOVERSION to fit into
+ # 16 bits.
+ # https://www.sicpers.info/2013/03/how-to-version-a-mach-o-library/
+ ReplaceStringsInFile(
+ 'CMake/AbseilHelpers.cmake',
+ {'SOVERSION 0': 'SOVERSION "{}.0.0"'.format(datestamp[2:6])})
StripContentBetweenTags('CMakeLists.txt', '# absl:lts-remove-begin',
'# absl:lts-remove-end')