Skip to content

Commit 8010419

Browse files
committed
Avoid shadowing in gcc_versiont
Re-use the previously declared variables and rename one input stream.
1 parent afdefa8 commit 8010419

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/goto-cc/gcc_version.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ void gcc_versiont::get(const std::string &executable)
9595
out << "default_cxx_standard __cplusplus\n";
9696
}
9797

98-
int result = run(
98+
result = run(
9999
executable,
100100
{executable, "-E", "-x", "c++", "-", "-o", "-"},
101101
cpp_in(),
@@ -104,10 +104,9 @@ void gcc_versiont::get(const std::string &executable)
104104

105105
if(result >= 0)
106106
{
107-
std::ifstream in(cpp_out());
108-
std::string line;
107+
std::ifstream in2(cpp_out());
109108

110-
while(!in.fail() && std::getline(in, line))
109+
while(!in2.fail() && std::getline(in2, line))
111110
{
112111
if(line.empty() || line[0] == '#')
113112
continue;

0 commit comments

Comments
 (0)