summaryrefslogtreecommitdiffstats
path: root/googletest/include
diff options
context:
space:
mode:
authorTom Hughes <tomhughes@google.com>2023-03-04 00:01:13 (GMT)
committerCopybara-Service <copybara-worker@google.com>2023-03-06 15:15:44 (GMT)
commitdc10c3b5e55c1101e7759bdb7bf9790cebbf4ad2 (patch)
tree1b381b545e774039404cc7921b1500d765ebc2ae /googletest/include
parent7b1ced0682af5fb10e4619457552cd11936c294a (diff)
downloadgoogletest-dc10c3b5e55c1101e7759bdb7bf9790cebbf4ad2.zip
googletest-dc10c3b5e55c1101e7759bdb7bf9790cebbf4ad2.tar.gz
googletest-dc10c3b5e55c1101e7759bdb7bf9790cebbf4ad2.tar.bz2
Use "#ifdef" with public macros
This allows compilation with "-Wundef" (#3267). PiperOrigin-RevId: 513944726 Change-Id: I1a3854bb2333d5dec6c0ff91ee1eddd9a766ab91
Diffstat (limited to 'googletest/include')
-rw-r--r--googletest/include/gtest/gtest-death-test.h4
-rw-r--r--googletest/include/gtest/gtest.h2
-rw-r--r--googletest/include/gtest/internal/gtest-death-test-internal.h2
-rw-r--r--googletest/include/gtest/internal/gtest-port.h16
4 files changed, 12 insertions, 12 deletions
diff --git a/googletest/include/gtest/gtest-death-test.h b/googletest/include/gtest/gtest-death-test.h
index b793528..08fef8c 100644
--- a/googletest/include/gtest/gtest-death-test.h
+++ b/googletest/include/gtest/gtest-death-test.h
@@ -51,7 +51,7 @@ GTEST_DECLARE_string_(death_test_style);
namespace testing {
-#if GTEST_HAS_DEATH_TEST
+#ifdef GTEST_HAS_DEATH_TEST
namespace internal {
@@ -328,7 +328,7 @@ class GTEST_API_ KilledBySignal {
// death tests are supported; otherwise they just issue a warning. This is
// useful when you are combining death test assertions with normal test
// assertions in one test.
-#if GTEST_HAS_DEATH_TEST
+#ifdef GTEST_HAS_DEATH_TEST
#define EXPECT_DEATH_IF_SUPPORTED(statement, regex) \
EXPECT_DEATH(statement, regex)
#define ASSERT_DEATH_IF_SUPPORTED(statement, regex) \
diff --git a/googletest/include/gtest/gtest.h b/googletest/include/gtest/gtest.h
index 2bf6493..c1001d6 100644
--- a/googletest/include/gtest/gtest.h
+++ b/googletest/include/gtest/gtest.h
@@ -600,7 +600,7 @@ class GTEST_API_ TestInfo {
const TestResult* result() const { return &result_; }
private:
-#if GTEST_HAS_DEATH_TEST
+#ifdef GTEST_HAS_DEATH_TEST
friend class internal::DefaultDeathTestFactory;
#endif // GTEST_HAS_DEATH_TEST
friend class Test;
diff --git a/googletest/include/gtest/internal/gtest-death-test-internal.h b/googletest/include/gtest/internal/gtest-death-test-internal.h
index 21f3d29..522eed8 100644
--- a/googletest/include/gtest/internal/gtest-death-test-internal.h
+++ b/googletest/include/gtest/internal/gtest-death-test-internal.h
@@ -57,7 +57,7 @@ const char kDeathTestStyleFlag[] = "death_test_style";
const char kDeathTestUseFork[] = "death_test_use_fork";
const char kInternalRunDeathTestFlag[] = "internal_run_death_test";
-#if GTEST_HAS_DEATH_TEST
+#ifdef GTEST_HAS_DEATH_TEST
GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \
/* class A needs to have dll-interface to be used by clients of class B */)
diff --git a/googletest/include/gtest/internal/gtest-port.h b/googletest/include/gtest/internal/gtest-port.h
index b757c7d..29503db 100644
--- a/googletest/include/gtest/internal/gtest-port.h
+++ b/googletest/include/gtest/internal/gtest-port.h
@@ -161,10 +161,10 @@
// NOT define them.
//
// These macros are public so that portable tests can be written.
-// Such tests typically surround code using a feature with an #if
+// Such tests typically surround code using a feature with an #ifdef
// which controls that code. For example:
//
-// #if GTEST_HAS_DEATH_TEST
+// #ifdef GTEST_HAS_DEATH_TEST
// EXPECT_DEATH(DoSomethingDeadly());
// #endif
//
@@ -794,7 +794,7 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION;
#endif // GTEST_IS_THREADSAFE
-#if GTEST_IS_THREADSAFE
+#ifdef GTEST_IS_THREADSAFE
// Some platforms don't support including these threading related headers.
#include <condition_variable> // NOLINT
#include <mutex> // NOLINT
@@ -909,7 +909,7 @@ GTEST_API_ bool IsTrue(bool condition);
// Defines RE.
-#if GTEST_USES_RE2
+#ifdef GTEST_USES_RE2
// This is almost `using RE = ::RE2`, except it is copy-constructible, and it
// needs to disambiguate the `std::string`, `absl::string_view`, and `const
@@ -934,7 +934,7 @@ class GTEST_API_ RE {
RE2 regex_;
};
-#elif GTEST_USES_POSIX_RE || GTEST_USES_SIMPLE_RE
+#elif defined(GTEST_USES_POSIX_RE) || defined(GTEST_USES_SIMPLE_RE)
// A simple C++ wrapper for <regex.h>. It uses the POSIX Extended
// Regular Expression syntax.
@@ -972,7 +972,7 @@ class GTEST_API_ RE {
std::string pattern_;
bool is_valid_;
-#if GTEST_USES_POSIX_RE
+#ifdef GTEST_USES_POSIX_RE
regex_t full_regex_; // For FullMatch().
regex_t partial_regex_; // For PartialMatch().
@@ -1200,7 +1200,7 @@ GTEST_API_ std::string ReadEntireFile(FILE* file);
// All command line arguments.
GTEST_API_ std::vector<std::string> GetArgvs();
-#if GTEST_HAS_DEATH_TEST
+#ifdef GTEST_HAS_DEATH_TEST
std::vector<std::string> GetInjectableArgvs();
// Deprecated: pass the args vector by value instead.
@@ -1211,7 +1211,7 @@ void ClearInjectableArgvs();
#endif // GTEST_HAS_DEATH_TEST
// Defines synchronization primitives.
-#if GTEST_IS_THREADSAFE
+#ifdef GTEST_IS_THREADSAFE
#ifdef GTEST_OS_WINDOWS
// Provides leak-safe Windows kernel handle ownership.