29 "--print-rejected-preprocessed-source",
38 "--show-symbol-table",
39 "--show-function-table",
45 "--string-abstraction",
54 "--validate-goto-model",
56 "--export-file-local-symbols",
58 "--export-function-local-symbols",
113 "-compatibility_version",
145 "-no-integrated-cpp",
167 "-print-libgcc-file-name",
168 "-print-multi-directory",
170 "-print-search-dirs",
172 "-print-sysroot-headers-suffix",
196 "-mno-unaligned-access",
234 current_args.reserve(argc - 1);
236 for(
int i=1; i<argc; i++)
237 current_args.push_back(argv[i]);
247 const argst &args_to_parse,
250 for(argst::const_iterator it = args_to_parse.begin();
251 it != args_to_parse.end();
254 const std::string &argv_i=*it;
259 std::ifstream opts_file(argv_i.substr(1));
260 std::ostringstream all_lines;
263 while(std::getline(opts_file, line))
264 all_lines <<
' ' << line;
266 line = all_lines.str();
268 line.erase(0, line.find_first_not_of(
"\t "));
286 argst::const_iterator next=it;
300 *o!=
nullptr && !found;
306 if(next != args_to_parse.end())
315 else if(
has_prefix(argv_i, std::string(*o)+
"="))
318 set(*o, argv_i.substr(strlen(*o)+1));
341 std::string value=argv_i.substr(4);
351 std::size_t equal_pos=argv_i.find(
'=');
353 if(equal_pos==std::string::npos)
356 set(argv_i.substr(0, equal_pos), argv_i.substr(equal_pos+1));
365 argst::const_iterator next=it;
372 *o!=
nullptr && !found;
378 if(next != args_to_parse.end())
389 else if(
has_prefix(argv_i, std::string(*o)+
"="))
392 set(*o, argv_i.substr(strlen(*o)+1));
398 *o!=
nullptr && !found;
404 if(next != args_to_parse.end())
417 set(*o, argv_i.substr(strlen(*o)));
423 *o!=
nullptr && !found;
429 set(*o, argv_i.substr(strlen(*o)));
436 std::cerr <<
"Warning: uninterpreted gcc option '" << argv_i
449 assert(!line.empty());
450 assert(line[0]!=
' ' && line[0]!=
'\t');
452 argst args_from_specs;
455 arg_end!=std::string::npos;
456 arg_start=line.find_first_not_of(
"\t ", arg_end))
458 arg_end=line.find_first_of(
"\t ", arg_start);
459 args_from_specs.push_back(line.substr(arg_start, arg_end - arg_start));
468 const std::string &specs_file_name=
get_value(
"specs");
469 if(specs_file_name.empty())
472 std::ifstream specs_file(specs_file_name);
476 while(std::getline(specs_file, line))
479 line.erase(0, line.find_first_not_of(
"\t "));
485 (line==
"*link_libgcc:" ||
unsignedbv_typet size_type()
std::string get_value(char option) const
bool parse_arguments(const argst &args_to_parse, bool in_spec_file)
void parse_specs()
Parse GCC spec files https://gcc.gnu.org/onlinedocs/gcc/Spec-Files.html.
std::vector< std::string > argst
virtual bool parse(int, const char **)
parses the command line options into a cmdlinet
void parse_specs_line(const std::string &line, bool in_spec_file)
Parse GCC spec files https://gcc.gnu.org/onlinedocs/gcc/Spec-Files.html.
void set(const std::string &opt, const char *value) override
Set option option to value.
void add_infile_arg(const std::string &arg)
static bool in_list(const char *option, const char **list)
void add_arg(const std::string &arg)
bool has_prefix(const std::string &s, const std::string &prefix)
const char * gcc_options_with_concatenated_argument[]
const char * gcc_options_with_separated_argument[]
const char * goto_cc_options_with_separated_argument[]
const char * gcc_options_without_argument[]
const char * goto_cc_options_without_argument[]
const char * gcc_options_with_argument[]
A special command line object for the gcc-like options.