Skip to content

Commit

Permalink
Export of internal Abseil changes
Browse files Browse the repository at this point in the history
--
4324716dc5384f03dcd7e36e8cca0e944e4dac74 by Evan Brown <[email protected]>:

Clarify comments about API differences from std::{set,map} in btree headers.

We note that the most important API differences are mentioned in the next paragraph and that other API differences are minor. An example of another minor API difference is the note about std::launder in the comment for `extract`.

Motivation: readers shouldn't feel like they need to read the entire header file to understand why b-tree containers are not "drop-in replacements" for STL containers.
PiperOrigin-RevId: 408703780

--
7e8da4f14afd25d11713eee6b743ba31605332bf by Derek Mauro <[email protected]>:

Remove the test for absl::base_internal::NominalCPUFrequency() from OSS code

This is an internal-only function that should never by called by OSS code.
By its nature fails on unsupported platforms.
Google code has tests for this function on supported internal platforms.

Fixes #1053

PiperOrigin-RevId: 408692861

--
37bad2e003b17e3f82d6fd5d90ae183553c018b0 by Abseil Team <[email protected]>:

To avoid triggering -Wmissing-variable-declarations warnings, ABSL_FLAG now
declares the Flag before defining it.

PiperOrigin-RevId: 408673990
GitOrigin-RevId: 4324716dc5384f03dcd7e36e8cca0e944e4dac74
Change-Id: I8c8ea73c4a4e38729c5bfdfa3fefb5d593e0536c
  • Loading branch information
Abseil Team authored and rogeeff committed Nov 10, 2021
1 parent 39f46fa commit 732b558
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 26 deletions.
23 changes: 0 additions & 23 deletions absl/base/internal/sysinfo_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,29 +37,6 @@ TEST(SysinfoTest, NumCPUs) {
<< "NumCPUs() should not have the default value of 0";
}

// Ensure that NominalCPUFrequency returns a reasonable value, or 1.00 on
// platforms where the CPU frequency is not available through sysfs.
//
// POWER is particularly problematic here; some Linux kernels expose the CPU
// frequency, while others do not. Since we can't predict a priori what a given
// machine is going to do, just disable this test on POWER on Linux.
#if !(defined(__linux) && (defined(__ppc64__) || defined(__PPC64__)))
TEST(SysinfoTest, NominalCPUFrequency) {
// Linux only exposes the CPU frequency on certain architectures, and
// Emscripten doesn't expose it at all.
#if defined(__linux__) && \
(defined(__aarch64__) || defined(__hppa__) || defined(__mips__) || \
defined(__riscv) || defined(__s390x__)) || \
defined(__EMSCRIPTEN__)
EXPECT_EQ(NominalCPUFrequency(), 1.0)
<< "CPU frequency detection was fixed! Please update unittest.";
#else
EXPECT_GE(NominalCPUFrequency(), 1000.0)
<< "NominalCPUFrequency() did not return a reasonable value";
#endif
}
#endif

TEST(SysinfoTest, GetTID) {
EXPECT_EQ(GetTID(), GetTID()); // Basic compile and equality test.
#ifdef __native_client__
Expand Down
7 changes: 5 additions & 2 deletions absl/container/btree_map.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,17 @@
//
// However, these types should not be considered drop-in replacements for
// `std::map` and `std::multimap` as there are some API differences, which are
// noted in this header file.
// noted in this header file. The most consequential differences with respect to
// migrating to b-tree from the STL types are listed in the next paragraph.
// Other API differences are minor.
//
// Importantly, insertions and deletions may invalidate outstanding iterators,
// pointers, and references to elements. Such invalidations are typically only
// an issue if insertion and deletion operations are interleaved with the use of
// more than one iterator, pointer, or reference simultaneously. For this
// reason, `insert()` and `erase()` return a valid iterator at the current
// position.
// position. Another important difference is that key-types must be
// copy-constructible.

#ifndef ABSL_CONTAINER_BTREE_MAP_H_
#define ABSL_CONTAINER_BTREE_MAP_H_
Expand Down
4 changes: 3 additions & 1 deletion absl/container/btree_set.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@
//
// However, these types should not be considered drop-in replacements for
// `std::set` and `std::multiset` as there are some API differences, which are
// noted in this header file.
// noted in this header file. The most consequential differences with respect to
// migrating to b-tree from the STL types are listed in the next paragraph.
// Other API differences are minor.
//
// Importantly, insertions and deletions may invalidate outstanding iterators,
// pointers, and references to elements. Such invalidations are typically only
Expand Down
1 change: 1 addition & 0 deletions absl/flags/flag.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ ABSL_NAMESPACE_END
// Note: do not construct objects of type `absl::Flag<T>` directly. Only use the
// `ABSL_FLAG()` macro for such construction.
#define ABSL_FLAG(Type, name, default_value, help) \
extern ::absl::Flag<Type> FLAGS_##name; \
ABSL_FLAG_IMPL(Type, name, default_value, help)

// ABSL_FLAG().OnUpdate()
Expand Down

0 comments on commit 732b558

Please sign in to comment.