Replace "#if GTEST_HAS_ABSL" with "#ifdef GTEST_HAS_ABSL"

This allows compilation with "-Wundef" (#3267).

PiperOrigin-RevId: 513945230
Change-Id: I45ef19c7ff3d20e97216bd031d406a03365471da
This commit is contained in:
Tom Hughes
2023-03-03 16:03:22 -08:00
committed by Copybara-Service
parent dc10c3b5e5
commit 16feffa8fa
6 changed files with 22 additions and 21 deletions

View File

@@ -390,7 +390,7 @@ TEST(GtestCheckDeathTest, LivesSilentlyOnSuccess) {
// the platform. The test will produce compiler errors in case of failure.
// For simplicity, we only cover the most important platforms here.
TEST(RegexEngineSelectionTest, SelectsCorrectRegexEngine) {
#if GTEST_HAS_ABSL
#ifdef GTEST_HAS_ABSL
EXPECT_TRUE(GTEST_USES_RE2);
#elif GTEST_HAS_POSIX_RE
EXPECT_TRUE(GTEST_USES_POSIX_RE);

View File

@@ -6178,12 +6178,12 @@ TEST_F(ParseFlagsTest, FilterBad) {
const char* argv2[] = {"foo.exe", "--gtest_filter", nullptr};
#if GTEST_HAS_ABSL && defined(GTEST_HAS_DEATH_TEST)
#if defined(GTEST_HAS_ABSL) && defined(GTEST_HAS_DEATH_TEST)
// Invalid flag arguments are a fatal error when using the Abseil Flags.
EXPECT_EXIT(GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::Filter(""), true),
testing::ExitedWithCode(1),
"ERROR: Missing the value for the flag 'gtest_filter'");
#elif !GTEST_HAS_ABSL
#elif !defined(GTEST_HAS_ABSL)
GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::Filter(""), true);
#else
static_cast<void>(argv);
@@ -6197,12 +6197,12 @@ TEST_F(ParseFlagsTest, OutputEmpty) {
const char* argv2[] = {"foo.exe", "--gtest_output", nullptr};
#if GTEST_HAS_ABSL && defined(GTEST_HAS_DEATH_TEST)
#if defined(GTEST_HAS_ABSL) && defined(GTEST_HAS_DEATH_TEST)
// Invalid flag arguments are a fatal error when using the Abseil Flags.
EXPECT_EXIT(GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags(), true),
testing::ExitedWithCode(1),
"ERROR: Missing the value for the flag 'gtest_output'");
#elif !GTEST_HAS_ABSL
#elif !defined(GTEST_HAS_ABSL)
GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags(), true);
#else
static_cast<void>(argv);
@@ -6210,7 +6210,7 @@ TEST_F(ParseFlagsTest, OutputEmpty) {
#endif
}
#if GTEST_HAS_ABSL
#ifdef GTEST_HAS_ABSL
TEST_F(ParseFlagsTest, AbseilPositionalFlags) {
const char* argv[] = {"foo.exe", "--gtest_throw_on_failure=1", "--",
"--other_flag", nullptr};