Skip to content
Open
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
6 changes: 5 additions & 1 deletion lib/importproject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,11 @@ void ImportProject::fsParseCommand(FileSettings& fs, const std::string& command)
fs.includePaths.push_back(std::move(i));
} else if (F=='s' && startsWith(fval,"td")) {
++pos;
fs.standard = readUntil(command, &pos, " ");
if (startsWith(fval, "td:")) {
fs.standard = fval.substr(3);
} else {
fs.standard = readUntil(command, &pos, " ");
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm this is matching the old code. but it does not seem to me that it would handle a gcc command like this right?

gcc -std=c99 -c 1.c

}
} else if (F == 'i' && fval == "system") {
++pos;
std::string isystem = readUntil(command, &pos, " ");
Expand Down
2 changes: 2 additions & 0 deletions test/testimportproject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ class TestImportProject : public TestFixture {
TestImporter importer;
ASSERT_EQUALS(true, importer.importCompileCommands(istr));
ASSERT_EQUALS(2, importer.fileSettings.size());
ASSERT_EQUALS("c++17", importer.fileSettings.cbegin()->standard);
ASSERT_EQUALS("C:/Users/dan/git/test-cppcheck/mylib/src/", importer.fileSettings.cbegin()->includePaths.front());
}

Expand All @@ -220,6 +221,7 @@ class TestImportProject : public TestFixture {
TestImporter importer;
ASSERT_EQUALS(true, importer.importCompileCommands(istr));
ASSERT_EQUALS(2, importer.fileSettings.size());
ASSERT_EQUALS("c++17", importer.fileSettings.cbegin()->standard);
ASSERT_EQUALS("C:/Users/dan/git/test-cppcheck/mylib/src/", importer.fileSettings.cbegin()->includePaths.front());
ASSERT_EQUALS("C:/Users/dan/git/test-cppcheck/mylib/second src/", importer.fileSettings.cbegin()->includePaths.back());
}
Expand Down