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
pull/925/head
Abseil Team 4 years ago committed by Derek Mauro
parent 1fdbe1ea1b
commit a09b5de0d5
  1. 7
      absl/base/attributes.h
  2. 10
      absl/strings/string_view.h
  3. 15
      create_lts.py

@ -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__))

@ -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

@ -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')

Loading…
Cancel
Save