The binary_name is solely used as a temporary storage to pass the data from the options parser back to the runCvc5 method where it is put in a static variable. This PR gets rid of the option and the public option getter in favor of directly storing the program name in the static variable using an additional argument to parseOptions().
const char* progPath;
/** Just the basename component of argv[0] */
-const std::string* progName;
+std::string progName;
/** A pointer to the CommandExecutor (the signal handlers need it) */
std::unique_ptr<cvc5::main::CommandExecutor> pExecutor;
void printUsage(Options& opts, bool full) {
stringstream ss;
- ss << "usage: " << options::getBinaryName(opts) << " [options] [input-file]"
+ ss << "usage: " << progName << " [options] [input-file]"
<< endl
<< endl
<< "Without an input file, or with `-', cvc5 reads from standard input."
progPath = argv[0];
// Parse the options
- vector<string> filenames = Options::parseOptions(&opts, argc, argv);
+ std::vector<string> filenames =
+ Options::parseOptions(&opts, argc, argv, progName);
auto limit = install_time_limit(opts);
- string progNameStr = options::getBinaryName(opts);
- progName = &progNameStr;
-
if (opts.driver.help)
{
printUsage(opts, true);
extern const char* progPath;
/** Just the basename component of argv[0] */
-extern const std::string* progName;
+extern std::string progName;
/** A reference for use by the signal handlers to print statistics */
extern std::unique_ptr<cvc5::main::CommandExecutor> pExecutor;
safe_print(STDERR_FILENO,
"Spinning so that a debugger can be connected.\n");
safe_print(STDERR_FILENO, "Try: gdb ");
- safe_print(STDERR_FILENO, *progName);
+ safe_print(STDERR_FILENO, progName);
safe_print(STDERR_FILENO, " ");
safe_print<int64_t>(STDERR_FILENO, getpid());
safe_print(STDERR_FILENO, "\n");
safe_print(STDERR_FILENO, " or: gdb --pid=");
safe_print<int64_t>(STDERR_FILENO, getpid());
safe_print(STDERR_FILENO, " ");
- safe_print(STDERR_FILENO, *progName);
+ safe_print(STDERR_FILENO, progName);
safe_print(STDERR_FILENO, "\n");
for (;;)
{
safe_print(STDERR_FILENO,
"Spinning so that a debugger can be connected.\n");
safe_print(STDERR_FILENO, "Try: gdb ");
- safe_print(STDERR_FILENO, *progName);
+ safe_print(STDERR_FILENO, progName);
safe_print(STDERR_FILENO, " ");
safe_print<int64_t>(STDERR_FILENO, getpid());
safe_print(STDERR_FILENO, "\n");
safe_print(STDERR_FILENO, " or: gdb --pid=");
safe_print<int64_t>(STDERR_FILENO, getpid());
safe_print(STDERR_FILENO, " ");
- safe_print(STDERR_FILENO, *progName);
+ safe_print(STDERR_FILENO, progName);
safe_print(STDERR_FILENO, "\n");
for (;;)
{
id = "BASE"
name = "Base"
-[[option]]
- name = "binary_name"
- category = "undocumented"
- type = "std::string"
-
[[option]]
name = "in"
category = "undocumented"
std::istream* getIn(const Options& opts) { return opts.base.in; }
std::ostream* getErr(const Options& opts) { return opts.base.err; }
std::ostream* getOut(const Options& opts) { return opts.base.out; }
-const std::string& getBinaryName(const Options& opts)
-{
- return opts.base.binary_name;
-}
void setInputLanguage(InputLanguage val, Options& opts)
{
std::istream* getIn(const Options& opts) CVC5_EXPORT;
std::ostream* getErr(const Options& opts) CVC5_EXPORT;
std::ostream* getOut(const Options& opts) CVC5_EXPORT;
-const std::string& getBinaryName(const Options& opts) CVC5_EXPORT;
void setInputLanguage(InputLanguage val, Options& opts) CVC5_EXPORT;
void setOut(std::ostream* val, Options& opts) CVC5_EXPORT;
*/
std::vector<std::string> Options::parseOptions(Options* options,
int argc,
- char* argv[])
+ char* argv[],
+ std::string& binaryName)
{
Assert(options != NULL);
Assert(argv != NULL);
if(x != NULL) {
progName = x + 1;
}
- options->base.binary_name = std::string(progName);
+ binaryName = std::string(progName);
std::vector<std::string> nonoptions;
options->parseOptionsRecursive(argc, argv, &nonoptions);
*/
static std::vector<std::string> parseOptions(Options* options,
int argc,
- char* argv[]);
+ char* argv[],
+ std::string& binaryName);
/**
* Get the setting for all options.
char* argv[2];
argv[0] = strdup("");
argv[1] = strdup("--output-lang=ast");
- Options::parseOptions(&opts, 2, argv);
+ std::string progName;
+ Options::parseOptions(&opts, 2, argv, progName);
free(argv[0]);
free(argv[1]);
d_smt.reset(new SmtEngine(d_nodeManager.get(), &opts));