From 409017ae985aa7eef120d3e9d7c60dd66a2aac1a Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Sun, 16 Nov 2025 19:06:07 +0100 Subject: [PATCH] Add ABI-compatible overload for MakeAndRegisterTestInfo to fix v1.14.0 linker errors (#1) * Add backward-compatible overload for MakeAndRegisterTestInfo Co-authored-by: kairosci <226562783+kairosci@users.noreply.github.com> * Complete fix with verification and testing Co-authored-by: kairosci <226562783+kairosci@users.noreply.github.com> * Remove CodeQL build artifacts and update gitignore Co-authored-by: kairosci <226562783+kairosci@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: kairosci <226562783+kairosci@users.noreply.github.com> --- .gitignore | 1 + googletest/include/gtest/internal/gtest-internal.h | 9 +++++++++ googletest/src/gtest.cc | 13 +++++++++++++ 3 files changed, 23 insertions(+) diff --git a/.gitignore b/.gitignore index f0df39db1..b83d192c7 100644 --- a/.gitignore +++ b/.gitignore @@ -87,3 +87,4 @@ googlemock/gtest /CMakeCache.txt /ALL_BUILD.vcxproj.filters /ALL_BUILD.vcxproj +_codeql_* diff --git a/googletest/include/gtest/internal/gtest-internal.h b/googletest/include/gtest/internal/gtest-internal.h index 808d89be9..c123f272f 100644 --- a/googletest/include/gtest/internal/gtest-internal.h +++ b/googletest/include/gtest/internal/gtest-internal.h @@ -561,6 +561,15 @@ GTEST_API_ TestInfo* MakeAndRegisterTestInfo( TypeId fixture_class_id, SetUpTestSuiteFunc set_up_tc, TearDownTestSuiteFunc tear_down_tc, TestFactoryBase* factory); +// Backward-compatible overload for ABI compatibility with v1.14.0 and earlier. +// This version takes const char* instead of std::string to avoid ABI issues +// when passing std::string by value across library boundaries. +GTEST_API_ TestInfo* MakeAndRegisterTestInfo( + const char* test_suite_name, const char* name, const char* type_param, + const char* value_param, CodeLocation code_location, + TypeId fixture_class_id, SetUpTestSuiteFunc set_up_tc, + TearDownTestSuiteFunc tear_down_tc, TestFactoryBase* factory); + // If *pstr starts with the given prefix, modifies *pstr to be right // past the prefix and returns true; otherwise leaves *pstr unchanged // and returns false. None of pstr, *pstr, and prefix can be NULL. diff --git a/googletest/src/gtest.cc b/googletest/src/gtest.cc index 80a7edad9..637a01058 100644 --- a/googletest/src/gtest.cc +++ b/googletest/src/gtest.cc @@ -2829,6 +2829,19 @@ TestInfo* MakeAndRegisterTestInfo( return test_info; } +// Backward-compatible overload for ABI compatibility with v1.14.0 and earlier. +TestInfo* MakeAndRegisterTestInfo( + const char* test_suite_name, const char* name, const char* type_param, + const char* value_param, CodeLocation code_location, + TypeId fixture_class_id, SetUpTestSuiteFunc set_up_tc, + TearDownTestSuiteFunc tear_down_tc, TestFactoryBase* factory) { + // Forward to the std::string version + return MakeAndRegisterTestInfo(std::string(test_suite_name), name, type_param, + value_param, std::move(code_location), + fixture_class_id, set_up_tc, tear_down_tc, + factory); +} + void ReportInvalidTestSuiteType(const char* test_suite_name, const CodeLocation& code_location) { Message errors;