summaryrefslogtreecommitdiffstats
path: root/googletest
diff options
context:
space:
mode:
authorTiago Freire <tmiguelf@hotmail.com>2024-02-23 12:23:25 (GMT)
committerTiago Freire <tmiguelf@hotmail.com>2024-02-23 12:23:25 (GMT)
commit4c676b94b8ec284f20337862829412aab7e7927f (patch)
tree986982af8b0c8d86b93f06857fd1b88cd94d33e1 /googletest
parent9d43b27f7a873596496a2ea70721b3f9eb82df01 (diff)
downloadgoogletest-4c676b94b8ec284f20337862829412aab7e7927f.zip
googletest-4c676b94b8ec284f20337862829412aab7e7927f.tar.gz
googletest-4c676b94b8ec284f20337862829412aab7e7927f.tar.bz2
Fixed gcc linker error 58refs/pull/4477/head
Diffstat (limited to 'googletest')
-rw-r--r--googletest/src/gtest-death-test.cc30
1 files changed, 20 insertions, 10 deletions
diff --git a/googletest/src/gtest-death-test.cc b/googletest/src/gtest-death-test.cc
index f914db5..c319ba8 100644
--- a/googletest/src/gtest-death-test.cc
+++ b/googletest/src/gtest-death-test.cc
@@ -630,13 +630,23 @@ bool DeathTestImpl::Passed(bool status_ok) {
#ifndef GTEST_OS_WINDOWS
// Note: The return value points into args, so the return value's lifetime is
// bound to that of args.
-static std::unique_ptr<char*[]> CreateArgvFromArgs(
- std::vector<std::string>& args) {
- auto result = std::make_unique<char*[]>(args.size() + 1);
- for (size_t i = 0; i < args.size(); ++i) {
- result[i] = &args[i][0];
+static std::vector<char*> CreateArgvFromArgs(
+ std::vector<std::string>& args){
+ std::vector<char*> result;
+
+ size_t arg_size = args.size();
+ //if(arg_size >= std::numeric_limits<ssize_t>::max()){
+ // result.resize(1);
+ // result[0] = nullptr;
+ // return result;
+ //}
+
+ result.resize(arg_size + 1);
+ for (size_t i = 0; i < arg_size; ++i) {
+ result[i] = args[i].data();
}
- result[args.size()] = nullptr; // extra null terminator
+
+ result[arg_size] = nullptr; // extra null terminator
return result;
}
#endif
@@ -1036,8 +1046,8 @@ DeathTest::TestRole FuchsiaDeathTest::AssumeRole() {
// "Fuchsia Test Component" which contains a "Fuchsia Component Manifest")
// Launching processes is a privileged operation in Fuchsia, and the
// declaration indicates that the ability is required for the component.
- std::unique_ptr<char*[]> argv = CreateArgvFromArgs(args);
- status = fdio_spawn_etc(child_job, FDIO_SPAWN_CLONE_ALL, argv[0], argv.get(),
+ std::vector<char*> argv = CreateArgvFromArgs(args);
+ status = fdio_spawn_etc(child_job, FDIO_SPAWN_CLONE_ALL, argv[0], argv.data(),
nullptr, 2, spawn_actions,
child_process_.reset_and_get_address(), nullptr);
GTEST_DEATH_TEST_CHECK_(status == ZX_OK);
@@ -1388,8 +1398,8 @@ DeathTest::TestRole ExecDeathTest::AssumeRole() {
// is necessary.
FlushInfoLog();
- std::unique_ptr<char*[]> argv = CreateArgvFromArgs(args);
- const pid_t child_pid = ExecDeathTestSpawnChild(argv.get(), pipe_fd[0]);
+ std::vector<char*> argv = CreateArgvFromArgs(args);
+ const pid_t child_pid = ExecDeathTestSpawnChild(argv.data(), pipe_fd[0]);
GTEST_DEATH_TEST_CHECK_SYSCALL_(close(pipe_fd[1]));
set_child_pid(child_pid);
set_read_fd(pipe_fd[0]);