Skip to content

goto-gcc: Add @<file> arguments to the original command line #1244

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 21, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions regression/goto-gcc/at_files/args
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
other.c
6 changes: 6 additions & 0 deletions regression/goto-gcc/at_files/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
int foo();

int main()
{
return foo();
}
4 changes: 4 additions & 0 deletions regression/goto-gcc/at_files/other.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
int foo()
{
return 1;
}
8 changes: 8 additions & 0 deletions regression/goto-gcc/at_files/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
CORE
main.c
@args
^EXIT=0$
^SIGNAL=0$
--
^warning: ignoring
^CONVERSION ERROR$
8 changes: 4 additions & 4 deletions src/goto-cc/gcc_cmdline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ bool gcc_cmdlinet::parse_arguments(
line.erase(0, line.find_first_not_of("\t "));

if(!line.empty())
parse_specs_line(line);
parse_specs_line(line, false);
}

continue;
Expand Down Expand Up @@ -428,7 +428,7 @@ bool gcc_cmdlinet::parse_arguments(
}

/// Parse GCC spec files https://gcc.gnu.org/onlinedocs/gcc/Spec-Files.html
void gcc_cmdlinet::parse_specs_line(const std::string &line)
void gcc_cmdlinet::parse_specs_line(const std::string &line, bool in_spec_file)
{
// initial whitespace has been stripped
assert(!line.empty());
Expand All @@ -444,7 +444,7 @@ void gcc_cmdlinet::parse_specs_line(const std::string &line)
args.push_back(line.substr(arg_start, arg_end-arg_start));
}

parse_arguments(args, true);
parse_arguments(args, in_spec_file);
}

/// Parse GCC spec files https://gcc.gnu.org/onlinedocs/gcc/Spec-Files.html
Expand Down Expand Up @@ -473,7 +473,7 @@ void gcc_cmdlinet::parse_specs()
line=="*link:"))
use_line=true;
else if(use_line)
parse_specs_line(line);
parse_specs_line(line, true);
else
{
// TODO need message interface
Expand Down
2 changes: 1 addition & 1 deletion src/goto-cc/gcc_cmdline.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class gcc_cmdlinet:public goto_cc_cmdlinet

bool parse_arguments(const argst &args, bool in_spec_file);
void parse_specs();
void parse_specs_line(const std::string &line);
void parse_specs_line(const std::string &line, bool in_spec_file);
};

#endif // CPROVER_GOTO_CC_GCC_CMDLINE_H