Export of internal Abseil changes

--
803abc2dcad8b2354c988e9bf58dac4a17683832 by Gennadiy Rozental <rogeeff@google.com>:

Avoid warning when RTTI is not enabled.

PiperOrigin-RevId: 294247546

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

Add a public Abseil FAQ

PiperOrigin-RevId: 294226960

--
6945c4a6df7d7679711fea31aacf4fba6ac7baa1 by Gennadiy Rozental <rogeeff@google.com>:

Re-enable type mismatch check, which works in all the cases including shared libraries.

We will use RTTI in case when our hand written approximation of it reports a type mismatch. This way we can ensure that if a flag is defined in one shared object and referenced in another we do not report spurious errors.

PiperOrigin-RevId: 293905563
GitOrigin-RevId: 803abc2dcad8b2354c988e9bf58dac4a17683832
Change-Id: I1a23776d227ed2734c2e7183323786b7a95c3cc7
This commit is contained in:
Abseil Team 2020-02-10 10:18:03 -08:00 committed by Mark Barolak
parent d95d156716
commit bf78e97730
9 changed files with 229 additions and 71 deletions

View file

@ -387,19 +387,20 @@ TEST_F(FlagTest, TestCustomUDT) {
// MSVC produces link error on the type mismatch.
// Linux does not have build errors and validations work as expected.
#if 0 // !defined(_WIN32) && GTEST_HAS_DEATH_TEST
#if !defined(_WIN32) && GTEST_HAS_DEATH_TEST
TEST(Flagtest, TestTypeMismatchValidations) {
// For builtin types, GetFlag() only does validation in debug mode.
using FlagDeathTest = FlagTest;
TEST_F(FlagDeathTest, TestTypeMismatchValidations) {
EXPECT_DEBUG_DEATH(
absl::GetFlag(FLAGS_mistyped_int_flag),
static_cast<void>(absl::GetFlag(FLAGS_mistyped_int_flag)),
"Flag 'mistyped_int_flag' is defined as one type and declared "
"as another");
EXPECT_DEATH(absl::SetFlag(&FLAGS_mistyped_int_flag, 0),
EXPECT_DEATH(absl::SetFlag(&FLAGS_mistyped_int_flag, 1),
"Flag 'mistyped_int_flag' is defined as one type and declared "
"as another");
EXPECT_DEATH(absl::GetFlag(FLAGS_mistyped_string_flag),
EXPECT_DEATH(static_cast<void>(absl::GetFlag(FLAGS_mistyped_string_flag)),
"Flag 'mistyped_string_flag' is defined as one type and "
"declared as another");
EXPECT_DEATH(