31 "--print-rejected-preprocessed-source",
38 "--show-symbol-table",
39 "--show-function-table",
45 "--string-abstraction",
108 "-compatibility_version",
140 "-no-integrated-cpp",
162 "-print-libgcc-file-name",
163 "-print-multi-directory",
165 "-print-search-dirs",
188 "-mno-unaligned-access",
221 args.reserve(argc-1);
223 for(
int i=1; i<argc; i++)
224 args.push_back(argv[i]);
237 for(argst::const_iterator it=
args.begin();
241 const std::string &argv_i=*it;
246 std::ifstream opts_file(argv_i.substr(1));
249 while(std::getline(opts_file, line))
252 line.erase(0, line.find_first_not_of(
"\t "));
271 argst::const_iterator next=it;
285 *o!=
nullptr && !found;
300 else if(
has_prefix(argv_i, std::string(*o)+
"="))
303 set(*o, argv_i.substr(strlen(*o)+1));
326 std::string value=argv_i.substr(4);
336 std::size_t equal_pos=argv_i.find(
'=');
338 if(equal_pos==std::string::npos)
341 set(argv_i.substr(0, equal_pos), argv_i.substr(equal_pos+1));
350 argst::const_iterator next=it;
357 *o!=
nullptr && !found;
374 else if(
has_prefix(argv_i, std::string(*o)+
"="))
377 set(*o, argv_i.substr(strlen(*o)+1));
383 *o!=
nullptr && !found;
402 set(*o, argv_i.substr(strlen(*o)));
408 *o!=
nullptr && !found;
414 set(*o, argv_i.substr(strlen(*o)));
421 std::cerr <<
"Warning: uninterpreted gcc option '" << argv_i
434 assert(!line.empty());
435 assert(line[0]!=
' ' && line[0]!=
'\t');
440 arg_end!=std::string::npos;
441 arg_start=line.find_first_not_of(
"\t ", arg_end))
443 arg_end=line.find_first_of(
"\t ", arg_start);
444 args.push_back(line.substr(arg_start, arg_end-arg_start));
453 const std::string &specs_file_name=
get_value(
"specs");
454 if(specs_file_name.empty())
457 std::ifstream specs_file(specs_file_name);
461 while(std::getline(specs_file, line))
464 line.erase(0, line.find_first_not_of(
"\t "));
470 (line==
"*link_libgcc:" ||
bool parse_arguments(const argst &args, bool in_spec_file)
A special command line object for the gcc-like options.
virtual bool parse(int, const char **)
std::string get_value(char option) const
unsignedbv_typet size_type()
const char * gcc_options_without_argument[]
const char * goto_cc_options_without_argument[]
std::vector< std::string > argst
const char * goto_cc_options_with_separated_argument[]
parses the command line options into a cmdlinet
const char * gcc_options_with_argument[]
static bool in_list(const char *option, const char **list)
void add_arg(const std::string &arg)
const char * gcc_options_with_separated_argument[]
void parse_specs()
Parse GCC spec files https://gcc.gnu.org/onlinedocs/gcc/Spec-Files.html.
bool has_prefix(const std::string &s, const std::string &prefix)
void parse_specs_line(const std::string &line)
Parse GCC spec files https://gcc.gnu.org/onlinedocs/gcc/Spec-Files.html.
void add_infile_arg(const std::string &arg)
const char * gcc_options_with_concatenated_argument[]