Lines Matching refs:arg
82 static void PrintError(const std::string& arg, std::string_view msg, bool from_env) { in PrintError() argument
84 std::string variable(arg); in PrintError()
88 } else if (arg[0] == '-') { in PrintError()
89 printf("%s %s\n", arg.c_str(), msg.data()); in PrintError()
91 printf("--%s %s\n", arg.c_str(), msg.data()); in PrintError()
96 static bool GetNumeric(const std::string& arg, const std::string& value, IntType* numeric_value, in GetNumeric() argument
100 PrintError(arg, std::string("value overflows (") + value + ")", from_env); in GetNumeric()
104 PrintError(arg, std::string("value is not formatted as a numeric value (") + value + ")", in GetNumeric()
118 bool Options::SetNumeric(const std::string& arg, const std::string& value, bool from_env) { in SetNumeric() argument
119 uint64_t* numeric = &numerics_.find(arg)->second; in SetNumeric()
120 if (!GetNumeric<uint64_t>(arg, value, numeric, from_env)) { in SetNumeric()
124 PrintError(arg, "requires a number greater than zero.", from_env); in SetNumeric()
130 bool Options::SetNumericEnvOnly(const std::string& arg, const std::string& value, bool from_env) { in SetNumericEnvOnly() argument
132 PrintError(arg, "is only supported as an environment variable.", false); in SetNumericEnvOnly()
135 uint64_t* numeric = &numerics_.find(arg)->second; in SetNumericEnvOnly()
136 if (!GetNumeric<uint64_t>(arg, value, numeric, from_env)) { in SetNumericEnvOnly()
142 bool Options::SetBool(const std::string& arg, const std::string&, bool) { in SetBool() argument
143 bools_.find(arg)->second = true; in SetBool()
147 bool Options::SetIterations(const std::string& arg, const std::string& value, bool from_env) { in SetIterations() argument
148 if (!GetNumeric<int>(arg, value, &num_iterations_, from_env)) { in SetIterations()
154 bool Options::SetString(const std::string& arg, const std::string& value, bool) { in SetString() argument
155 strings_.find(arg)->second = value; in SetString()
159 bool Options::SetXmlFile(const std::string& arg, const std::string& value, bool from_env) { in SetXmlFile() argument
161 PrintError(arg, "only supports an xml output file.", from_env); in SetXmlFile()
166 PrintError(arg, "requires a file name after xml:", from_env); in SetXmlFile()
173 PrintError(arg, in SetXmlFile()
191 bool Options::HandleArg(const std::string& arg, const std::string& value, const ArgInfo& info, in HandleArg() argument
194 PrintError(arg, "is not compatible with isolation runs.", from_env); in HandleArg()
200 PrintError(arg, "requires an argument.", from_env); in HandleArg()
204 if (info.func != nullptr && !(this->*(info.func))(arg, value, from_env)) { in HandleArg()
208 PrintError(arg, "does not take an argument.", from_env); in HandleArg()
211 return (this->*(info.func))(arg, value, from_env); in HandleArg()
261 bool Options::ProcessSingle(const char* arg, std::vector<char*>* child_args, bool allow_flagfile) { in ProcessSingle() argument
262 if (strncmp("--", arg, 2) != 0) { in ProcessSingle()
263 if (arg[0] == '-') { in ProcessSingle()
264 printf("Unknown argument: %s\n", arg); in ProcessSingle()
267 printf("Unexpected argument '%s'\n", arg); in ProcessSingle()
275 const char* equal = strchr(arg, '='); in ProcessSingle()
277 name = std::string(&arg[2], static_cast<size_t>(equal - arg) - 2); in ProcessSingle()
280 name = &arg[2]; in ProcessSingle()
284 printf("Unknown argument: %s\n", arg); in ProcessSingle()
289 child_args->push_back(strdup(arg)); in ProcessSingle()
300 printf("Argument: %s is not allowed in flag file.\n", arg); in ProcessSingle()