Skip to content

Commit cedd5ea

Browse files
authored
Merge pull request #6595 from tautschnig/bugfixes/6592-param-files
goto-cc: newlines in command files are just whitespace
2 parents 9d9e213 + d9463a1 commit cedd5ea

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

regression/goto-gcc/at_files/args

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1+
-o
2+
test.gb
13
other.c

src/goto-cc/gcc_cmdline.cpp

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ Author: CM Wintersteiger, 2006
1212
#include "gcc_cmdline.h"
1313

1414
#include <cstring>
15-
#include <iostream>
1615
#include <fstream>
16+
#include <iostream>
17+
#include <sstream>
1718

1819
#include <util/prefix.h>
1920

@@ -256,16 +257,18 @@ bool gcc_cmdlinet::parse_arguments(
256257
if(has_prefix(argv_i, "@"))
257258
{
258259
std::ifstream opts_file(argv_i.substr(1));
260+
std::ostringstream all_lines;
259261
std::string line;
260262

261263
while(std::getline(opts_file, line))
262-
{
263-
// erase leading whitespace
264-
line.erase(0, line.find_first_not_of("\t "));
264+
all_lines << ' ' << line;
265265

266-
if(!line.empty())
267-
parse_specs_line(line, false);
268-
}
266+
line = all_lines.str();
267+
// erase leading whitespace
268+
line.erase(0, line.find_first_not_of("\t "));
269+
270+
if(!line.empty())
271+
parse_specs_line(line, false);
269272

270273
continue;
271274
}

0 commit comments

Comments
 (0)