diff --git a/googletest/include/gtest/internal/gtest-port.h b/googletest/include/gtest/internal/gtest-port.h index 690f2d36..dc502566 100644 --- a/googletest/include/gtest/internal/gtest-port.h +++ b/googletest/include/gtest/internal/gtest-port.h @@ -448,14 +448,6 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION; #if defined(_MSC_VER) && defined(_CPPUNWIND) // MSVC defines _CPPUNWIND to 1 if and only if exceptions are enabled. #define GTEST_HAS_EXCEPTIONS 1 -#elif defined(__BORLANDC__) -// C++Builder's implementation of the STL uses the _HAS_EXCEPTIONS -// macro to enable exceptions, so we'll do the same. -// Assumes that exceptions are enabled by default. -#ifndef _HAS_EXCEPTIONS -#define _HAS_EXCEPTIONS 1 -#endif // _HAS_EXCEPTIONS -#define GTEST_HAS_EXCEPTIONS _HAS_EXCEPTIONS #elif defined(__clang__) // clang defines __EXCEPTIONS if and only if exceptions are enabled before clang // 220714, but if and only if cleanups are enabled after that. In Obj-C++ files, @@ -480,7 +472,7 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION; // For other compilers, we assume exceptions are disabled to be // conservative. #define GTEST_HAS_EXCEPTIONS 0 -#endif // defined(_MSC_VER) || defined(__BORLANDC__) +#endif // defined(_MSC_VER) && defined(_CPPUNWIND) #endif // GTEST_HAS_EXCEPTIONS // MSVC either defines wchar_t as a typedef of unsigned short, or as a native @@ -849,8 +841,7 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION; #ifndef GTEST_HAS_SEH // The user didn't tell us, so we need to figure it out. -#if defined(_MSC_VER) || defined(__BORLANDC__) -// These two compilers are known to support SEH. +#ifdef _MSC_VER #define GTEST_HAS_SEH 1 #else // Assume no SEH. @@ -2128,12 +2119,6 @@ inline bool IsDir(const StatStruct& st) { return S_ISDIR(st.st_mode); } #ifdef GTEST_OS_WINDOWS -#ifdef __BORLANDC__ -inline int DoIsATTY(int fd) { return isatty(fd); } -inline int StrCaseCmp(const char* s1, const char* s2) { - return stricmp(s1, s2); -} -#else // !__BORLANDC__ #if defined(GTEST_OS_WINDOWS_MOBILE) || defined(GTEST_OS_ZOS) || \ defined(GTEST_OS_IOS) || defined(GTEST_OS_WINDOWS_PHONE) || \ defined(GTEST_OS_WINDOWS_RT) || defined(ESP_PLATFORM) @@ -2144,7 +2129,6 @@ inline int DoIsATTY(int fd) { return _isatty(fd); } inline int StrCaseCmp(const char* s1, const char* s2) { return _stricmp(s1, s2); } -#endif // __BORLANDC__ #else @@ -2246,11 +2230,6 @@ inline const char* GetEnv(const char* name) { // We are on an embedded platform, which has no environment variables. static_cast(name); // To prevent 'unused argument' warning. return nullptr; -#elif defined(__BORLANDC__) - // Environment variables which we programmatically clear will be set to the - // empty string rather than unset (NULL). Handle that case. - const char* const env = getenv(name); - return (env != nullptr && env[0] != '\0') ? env : nullptr; #else return getenv(name); #endif diff --git a/googletest/include/gtest/internal/gtest-string.h b/googletest/include/gtest/internal/gtest-string.h index 2363034f..d0652c13 100644 --- a/googletest/include/gtest/internal/gtest-string.h +++ b/googletest/include/gtest/internal/gtest-string.h @@ -43,11 +43,6 @@ #ifndef GOOGLETEST_INCLUDE_GTEST_INTERNAL_GTEST_STRING_H_ #define GOOGLETEST_INCLUDE_GTEST_INTERNAL_GTEST_STRING_H_ -#ifdef __BORLANDC__ -// string.h is not guaranteed to provide strcpy on C++ Builder. -#include -#endif - #include #include diff --git a/googletest/src/gtest-port.cc b/googletest/src/gtest-port.cc index 5aa80030..be5b16e7 100644 --- a/googletest/src/gtest-port.cc +++ b/googletest/src/gtest-port.cc @@ -1242,14 +1242,14 @@ static std::string GetCapturedStream(CapturedStream** captured_stream) { return content; } -#if defined(_MSC_VER) || defined(__BORLANDC__) -// MSVC and C++Builder do not provide a definition of STDERR_FILENO. +#if defined(_MSC_VER) +// MSVC does not provide a definition of STDERR_FILENO. const int kStdOutFileno = 1; const int kStdErrFileno = 2; #else const int kStdOutFileno = STDOUT_FILENO; const int kStdErrFileno = STDERR_FILENO; -#endif // defined(_MSC_VER) || defined(__BORLANDC__) +#endif // defined(_MSC_VER) // Starts capturing stdout. void CaptureStdout() { diff --git a/googletest/src/gtest.cc b/googletest/src/gtest.cc index 30a2bb7d..47c60da2 100644 --- a/googletest/src/gtest.cc +++ b/googletest/src/gtest.cc @@ -5289,17 +5289,8 @@ void TestEventListeners::SuppressEventForwarding(bool suppress) { // call this before main() starts, from which point on the return // value will never change. UnitTest* UnitTest::GetInstance() { - // CodeGear C++Builder insists on a public destructor for the - // default implementation. Use this implementation to keep good OO - // design with private destructor. - -#if defined(__BORLANDC__) - static UnitTest* const instance = new UnitTest; - return instance; -#else static UnitTest instance; return &instance; -#endif // defined(__BORLANDC__) } // Gets the number of successful test suites. diff --git a/googletest/test/gtest_unittest.cc b/googletest/test/gtest_unittest.cc index b95a5471..1fed02c3 100644 --- a/googletest/test/gtest_unittest.cc +++ b/googletest/test/gtest_unittest.cc @@ -537,11 +537,6 @@ TEST_F(FormatEpochTimeInMillisAsIso8601Test, PrintsEpochStart) { #endif // __EMSCRIPTEN__ -#ifdef __BORLANDC__ -// Silences warnings: "Condition is always true", "Unreachable code" -#pragma option push -w-ccc -w-rch -#endif - // Tests that the LHS of EXPECT_EQ or ASSERT_EQ can be used as a null literal // when the RHS is a pointer type. TEST(NullLiteralTest, LHSAllowsNullLiterals) { @@ -612,11 +607,6 @@ TEST(NullLiteralTest, NoConversionNoWarning) { #pragma clang diagnostic pop #endif -#ifdef __BORLANDC__ -// Restores warnings after previous "#pragma option push" suppressed them. -#pragma option pop -#endif - // // Tests CodePointToUtf8(). @@ -1276,11 +1266,6 @@ TEST_F(ExpectFatalFailureTest, CatchesFatalFailureOnAllThreads) { "Expected fatal failure."); } -#ifdef __BORLANDC__ -// Silences warnings: "Condition is always true" -#pragma option push -w-ccc -#endif - // Tests that EXPECT_FATAL_FAILURE() can be used in a non-void // function even when the statement in it contains ASSERT_*. @@ -1304,11 +1289,6 @@ void DoesNotAbortHelper(bool* aborted) { *aborted = false; } -#ifdef __BORLANDC__ -// Restores warnings after previous "#pragma option push" suppressed them. -#pragma option pop -#endif - TEST_F(ExpectFatalFailureTest, DoesNotAbort) { bool aborted = true; DoesNotAbortHelper(&aborted); @@ -1323,15 +1303,12 @@ static int global_var = 0; #define GTEST_USE_UNPROTECTED_COMMA_ global_var++, global_var++ TEST_F(ExpectFatalFailureTest, AcceptsMacroThatExpandsToUnprotectedComma) { -#ifndef __BORLANDC__ - // ICE's in C++Builder. EXPECT_FATAL_FAILURE( { GTEST_USE_UNPROTECTED_COMMA_; AddFatalFailure(); }, ""); -#endif EXPECT_FATAL_FAILURE_ON_ALL_THREADS( { @@ -1712,26 +1689,6 @@ static void SetEnv(const char* name, const char* value) { #ifdef GTEST_OS_WINDOWS_MOBILE // Environment variables are not supported on Windows CE. return; -#elif defined(__BORLANDC__) - // C++Builder's putenv only stores a pointer to its parameter; we have to - // ensure that the string remains valid as long as it might be needed. - // We use an std::map to do so. - static std::map added_env; - - // Because putenv stores a pointer to the string buffer, we can't delete the - // previous string (if present) until after it's replaced. - std::string* prev_env = NULL; - if (added_env.find(name) != added_env.end()) { - prev_env = added_env[name]; - } - added_env[name] = - new std::string((Message() << name << "=" << value).GetString()); - - // The standard signature of putenv accepts a 'char*' argument. Other - // implementations, like C++Builder's, accept a 'const char*'. - // We cast away the 'const' since that would work for both variants. - putenv(const_cast(added_env[name]->c_str())); - delete prev_env; #elif defined(GTEST_OS_WINDOWS) // If we are on Windows proper. _putenv((Message() << name << "=" << value).GetString().c_str()); #else @@ -3709,11 +3666,6 @@ TEST(AssertionTest, AppendUserMessage) { EXPECT_STREQ("foo\nbar", AppendUserMessage(foo, msg).c_str()); } -#ifdef __BORLANDC__ -// Silences warnings: "Condition is always true", "Unreachable code" -#pragma option push -w-ccc -w-rch -#endif - // Tests ASSERT_TRUE. TEST(AssertionTest, ASSERT_TRUE) { ASSERT_TRUE(2 > 1); // NOLINT @@ -3732,13 +3684,10 @@ TEST(AssertionTest, ASSERT_TRUE) { // Tests ASSERT_TRUE(predicate) for predicates returning AssertionResult. TEST(AssertionTest, AssertTrueWithAssertionResult) { ASSERT_TRUE(ResultIsEven(2)); -#ifndef __BORLANDC__ - // ICE's in C++Builder. EXPECT_FATAL_FAILURE(ASSERT_TRUE(ResultIsEven(3)), "Value of: ResultIsEven(3)\n" " Actual: false (3 is odd)\n" "Expected: true"); -#endif ASSERT_TRUE(ResultIsEvenNoExplanation(2)); EXPECT_FATAL_FAILURE(ASSERT_TRUE(ResultIsEvenNoExplanation(3)), "Value of: ResultIsEvenNoExplanation(3)\n" @@ -3767,13 +3716,10 @@ TEST(AssertionTest, ASSERT_FALSE) { // Tests ASSERT_FALSE(predicate) for predicates returning AssertionResult. TEST(AssertionTest, AssertFalseWithAssertionResult) { ASSERT_FALSE(ResultIsEven(3)); -#ifndef __BORLANDC__ - // ICE's in C++Builder. EXPECT_FATAL_FAILURE(ASSERT_FALSE(ResultIsEven(2)), "Value of: ResultIsEven(2)\n" " Actual: true (2 is even)\n" "Expected: false"); -#endif ASSERT_FALSE(ResultIsEvenNoExplanation(3)); EXPECT_FATAL_FAILURE(ASSERT_FALSE(ResultIsEvenNoExplanation(2)), "Value of: ResultIsEvenNoExplanation(2)\n" @@ -3781,11 +3727,6 @@ TEST(AssertionTest, AssertFalseWithAssertionResult) { "Expected: false"); } -#ifdef __BORLANDC__ -// Restores warnings after previous "#pragma option push" suppressed them -#pragma option pop -#endif - // Tests using ASSERT_EQ on double values. The purpose is to make // sure that the specialization we did for integer and anonymous enums // isn't used for double arguments. @@ -3876,9 +3817,6 @@ void ThrowNothing() {} TEST(AssertionTest, ASSERT_THROW) { ASSERT_THROW(ThrowAnInteger(), int); -#ifndef __BORLANDC__ - - // ICE's in C++Builder 2007 and 2009. EXPECT_FATAL_FAILURE( ASSERT_THROW(ThrowAnInteger(), bool), "Expected: ThrowAnInteger() throws an exception of type bool.\n" @@ -3890,7 +3828,6 @@ TEST(AssertionTest, ASSERT_THROW) { "Actual: it throws " ERROR_DESC " " "with description \"A description\"."); -#endif EXPECT_FATAL_FAILURE( ASSERT_THROW(ThrowNothing(), bool), @@ -4059,12 +3996,8 @@ TEST(AssertionTest, AnonymousEnum) { ASSERT_GT(kCaseB, kCaseA); ASSERT_GE(kCaseA, kCaseA); -#ifndef __BORLANDC__ - - // ICE's in C++Builder. EXPECT_FATAL_FAILURE(ASSERT_EQ(kCaseA, kCaseB), " kCaseB\n Which is: "); EXPECT_FATAL_FAILURE(ASSERT_EQ(kCaseA, kCaseC), "\n Which is: 42"); -#endif EXPECT_FATAL_FAILURE(ASSERT_EQ(kCaseA, kCaseC), "\n Which is: -1"); } @@ -4113,13 +4046,9 @@ TEST(HRESULTAssertionTest, EXPECT_HRESULT_FAILED) { TEST(HRESULTAssertionTest, ASSERT_HRESULT_FAILED) { ASSERT_HRESULT_FAILED(E_UNEXPECTED); -#ifndef __BORLANDC__ - - // ICE's in C++Builder 2007 and 2009. EXPECT_FATAL_FAILURE(ASSERT_HRESULT_FAILED(OkHRESULTSuccess()), "Expected: (OkHRESULTSuccess()) fails.\n" " Actual: 0x0"); -#endif EXPECT_FATAL_FAILURE(ASSERT_HRESULT_FAILED(FalseHRESULTSuccess()), "Expected: (FalseHRESULTSuccess()) fails.\n" @@ -4137,13 +4066,9 @@ TEST(HRESULTAssertionTest, Streaming) { << "expected failure", "expected failure"); -#ifndef __BORLANDC__ - - // ICE's in C++Builder 2007 and 2009. EXPECT_FATAL_FAILURE(ASSERT_HRESULT_SUCCEEDED(E_UNEXPECTED) << "expected failure", "expected failure"); -#endif EXPECT_NONFATAL_FAILURE(EXPECT_HRESULT_FAILED(S_OK) << "expected failure", "expected failure"); @@ -4521,11 +4446,6 @@ TEST(ExpectTest, ExpectFalseWithAssertionResult) { "Expected: false"); } -#ifdef __BORLANDC__ -// Restores warnings after previous "#pragma option push" suppressed them -#pragma option pop -#endif - // Tests EXPECT_EQ. TEST(ExpectTest, EXPECT_EQ) { EXPECT_EQ(5, 2 + 3); @@ -5038,13 +4958,10 @@ TEST(ComparisonAssertionTest, AcceptsUnprintableArgs) { // Code tested by EXPECT_FATAL_FAILURE cannot reference local // variables, so we have to write UnprintableChar('x') instead of x. -#ifndef __BORLANDC__ - // ICE's in C++Builder. EXPECT_FATAL_FAILURE(ASSERT_NE(UnprintableChar('x'), UnprintableChar('x')), "1-byte object <78>"); EXPECT_FATAL_FAILURE(ASSERT_LE(UnprintableChar('y'), UnprintableChar('x')), "1-byte object <78>"); -#endif EXPECT_FATAL_FAILURE(ASSERT_LE(UnprintableChar('y'), UnprintableChar('x')), "1-byte object <79>"); EXPECT_FATAL_FAILURE(ASSERT_GE(UnprintableChar('x'), UnprintableChar('y')), @@ -6537,11 +6454,6 @@ TEST(StreamingAssertionsTest, Unconditional) { EXPECT_FATAL_FAILURE(FAIL() << "expected failure", "expected failure"); } -#ifdef __BORLANDC__ -// Silences warnings: "Condition is always true", "Unreachable code" -#pragma option push -w-ccc -w-rch -#endif - TEST(StreamingAssertionsTest, Truth) { EXPECT_TRUE(true) << "unexpected failure"; ASSERT_TRUE(true) << "unexpected failure"; @@ -6560,11 +6472,6 @@ TEST(StreamingAssertionsTest, Truth2) { "expected failure"); } -#ifdef __BORLANDC__ -// Restores warnings after previous "#pragma option push" suppressed them -#pragma option pop -#endif - TEST(StreamingAssertionsTest, IntegerEquals) { EXPECT_EQ(1, 1) << "unexpected failure"; ASSERT_EQ(1, 1) << "unexpected failure"; @@ -7488,10 +7395,8 @@ TEST(CopyArrayTest, WorksForDegeneratedArrays) { TEST(CopyArrayTest, WorksForOneDimensionalArrays) { const char a[3] = "hi"; int b[3]; -#ifndef __BORLANDC__ // C++Builder cannot compile some array size deductions. CopyArray(a, &b); EXPECT_TRUE(ArrayEq(a, b)); -#endif int c[3]; CopyArray(a, 3, c); @@ -7501,10 +7406,8 @@ TEST(CopyArrayTest, WorksForOneDimensionalArrays) { TEST(CopyArrayTest, WorksForTwoDimensionalArrays) { const int a[2][3] = {{0, 1, 2}, {3, 4, 5}}; int b[2][3]; -#ifndef __BORLANDC__ // C++Builder cannot compile some array size deductions. CopyArray(a, &b); EXPECT_TRUE(ArrayEq(a, b)); -#endif int c[2][3]; CopyArray(a, 2, c);