Skip to content

Clean up run.h interface #2869

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 31, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/goto-cc/as_mode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ int as_modet::run_as()
std::cout << '\n';
#endif

return run(new_argv[0], new_argv, cmdline.stdin_file);
return run(new_argv[0], new_argv, cmdline.stdin_file, "", "");
}

int as_modet::as_hybrid_binary()
Expand Down
4 changes: 2 additions & 2 deletions src/goto-cc/gcc_mode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -835,7 +835,7 @@ int gcc_modet::preprocess(
debug() << " " << new_argv[i];
debug() << eom;

return run(new_argv[0], new_argv, cmdline.stdin_file, stdout_file);
return run(new_argv[0], new_argv, cmdline.stdin_file, stdout_file, "");
}

int gcc_modet::run_gcc(const compilet &compiler)
Expand Down Expand Up @@ -878,7 +878,7 @@ int gcc_modet::run_gcc(const compilet &compiler)
debug() << " " << new_argv[i];
debug() << eom;

return run(new_argv[0], new_argv, cmdline.stdin_file);
return run(new_argv[0], new_argv, cmdline.stdin_file, "", "");
}

int gcc_modet::gcc_hybrid_binary(compilet &compiler)
Expand Down
4 changes: 2 additions & 2 deletions src/goto-cc/hybrid_binary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ int hybrid_binary(
"--remove-section", "goto-cc",
"--add-section", "goto-cc=" + goto_binary_file, output_file};

result = run(objcopy_argv[0], objcopy_argv, "", "");
result = run(objcopy_argv[0], objcopy_argv);
}

// delete the goto binary
Expand All @@ -79,7 +79,7 @@ int hybrid_binary(
"lipo", output_file, "-create", "-arch", "hppa7100LC", goto_binary_file,
"-output", output_file };

result = run(lipo_argv[0], lipo_argv, "", "");
result = run(lipo_argv[0], lipo_argv);
}

// delete the goto binary
Expand Down
2 changes: 1 addition & 1 deletion src/goto-cc/ld_mode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ int ld_modet::run_ld()
debug() << " " << new_argv[i];
debug() << eom;

return run(new_argv[0], new_argv, cmdline.stdin_file, "");
return run(new_argv[0], new_argv, cmdline.stdin_file, "", "");
}

int ld_modet::ld_hybrid_binary(compilet &compiler)
Expand Down
2 changes: 1 addition & 1 deletion src/goto-cc/linker_script_merge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,7 @@ int linker_script_merget::get_linker_script_data(
debug() << " " << argv[i];
debug() << eom;

int rc=run(argv[0], argv, linker_def_infile(), def_out_file);
int rc = run(argv[0], argv, linker_def_infile(), def_out_file, "");
if(rc!=0)
warning() << "Problem parsing linker script" << eom;

Expand Down
8 changes: 2 additions & 6 deletions src/util/run.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,9 @@ Date: August 2012
#include <util/unicode.h>
#include <util/signal_catcher.h>

int run_shell(const std::string &command)
int run(const std::string &what, const std::vector<std::string> &argv)
{
std::string shell="/bin/sh";
std::vector<std::string> argv;
argv.push_back(shell);
argv.push_back(command);
return run(shell, argv, "", "", "");
return run(what, argv, "", "", "");
}

#ifndef _WIN32
Expand Down
10 changes: 5 additions & 5 deletions src/util/run.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ Date: August 2012
#include <string>
#include <vector>

int run(const std::string &what, const std::vector<std::string> &argv);

int run(
const std::string &what,
const std::vector<std::string> &argv,
const std::string &std_input = "",
const std::string &std_output = "",
const std::string &std_error = "");

int run_shell(const std::string &command);
const std::string &std_input,
const std::string &std_output,
const std::string &std_error);

#endif // CPROVER_UTIL_RUN_H