Lines Matching refs:arg

81 static void PrintError(const std::string& arg, std::string msg, bool from_env) {  in PrintError()  argument
83 std::string variable(arg); in PrintError()
87 } else if (arg[0] == '-') { in PrintError()
88 printf("%s %s\n", arg.c_str(), msg.c_str()); in PrintError()
90 printf("--%s %s\n", arg.c_str(), msg.c_str()); in PrintError()
95 static bool GetNumeric(const std::string& arg, const std::string& value, IntType* numeric_value, in GetNumeric() argument
99 PrintError(arg, std::string("value overflows (") + value + ")", from_env); in GetNumeric()
103 PrintError(arg, std::string("value is not formatted as a numeric value (") + value + ")", in GetNumeric()
117 bool Options::SetNumeric(const std::string& arg, const std::string& value, bool from_env) { in SetNumeric() argument
118 uint64_t* numeric = &numerics_.find(arg)->second; in SetNumeric()
119 if (!GetNumeric<uint64_t>(arg, value, numeric, from_env)) { in SetNumeric()
123 PrintError(arg, "requires a number greater than zero.", from_env); in SetNumeric()
129 bool Options::SetNumericEnvOnly(const std::string& arg, const std::string& value, bool from_env) { in SetNumericEnvOnly() argument
131 PrintError(arg, "is only supported as an environment variable.", false); in SetNumericEnvOnly()
134 uint64_t* numeric = &numerics_.find(arg)->second; in SetNumericEnvOnly()
135 if (!GetNumeric<uint64_t>(arg, value, numeric, from_env)) { in SetNumericEnvOnly()
141 bool Options::SetBool(const std::string& arg, const std::string&, bool) { in SetBool() argument
142 bools_.find(arg)->second = true; in SetBool()
146 bool Options::SetIterations(const std::string& arg, const std::string& value, bool from_env) { in SetIterations() argument
147 if (!GetNumeric<int>(arg, value, &num_iterations_, from_env)) { in SetIterations()
153 bool Options::SetString(const std::string& arg, const std::string& value, bool) { in SetString() argument
154 strings_.find(arg)->second = value; in SetString()
158 bool Options::SetXmlFile(const std::string& arg, const std::string& value, bool from_env) { in SetXmlFile() argument
160 PrintError(arg, "only supports an xml output file.", from_env); in SetXmlFile()
165 PrintError(arg, "requires a file name after xml:", from_env); in SetXmlFile()
172 PrintError(arg, in SetXmlFile()
190 bool Options::HandleArg(const std::string& arg, const std::string& value, const ArgInfo& info, in HandleArg() argument
193 PrintError(arg, "is not compatible with isolation runs.", from_env); in HandleArg()
199 PrintError(arg, "requires an argument.", from_env); in HandleArg()
203 if (info.func != nullptr && !(this->*(info.func))(arg, value, from_env)) { in HandleArg()
207 PrintError(arg, "does not take an argument.", from_env); in HandleArg()
210 return (this->*(info.func))(arg, value, from_env); in HandleArg()
260 bool Options::ProcessSingle(const char* arg, std::vector<char*>* child_args, bool allow_flagfile) { in ProcessSingle() argument
261 if (strncmp("--", arg, 2) != 0) { in ProcessSingle()
262 if (arg[0] == '-') { in ProcessSingle()
263 printf("Unknown argument: %s\n", arg); in ProcessSingle()
266 printf("Unexpected argument '%s'\n", arg); in ProcessSingle()
274 const char* equal = strchr(arg, '='); in ProcessSingle()
276 name = std::string(&arg[2], static_cast<size_t>(equal - arg) - 2); in ProcessSingle()
279 name = &arg[2]; in ProcessSingle()
283 printf("Unknown argument: %s\n", arg); in ProcessSingle()
288 child_args->push_back(strdup(arg)); in ProcessSingle()
299 printf("Argument: %s is not allowed in flag file.\n", arg); in ProcessSingle()