Fixed #3797: _ is a valid character in suppression IDs

This commit is contained in:
PKEuS 2012-07-06 09:16:43 -07:00
parent 5caab6ba10
commit 2c9545f603
2 changed files with 6 additions and 3 deletions

View File

@ -224,7 +224,7 @@ std::string Suppressions::addSuppression(const std::string &errorId, const std::
}
if (errorId != "*") {
for (std::string::size_type pos = 0; pos < errorId.length(); ++pos) {
if (errorId[pos] < 0 || !std::isalnum(errorId[pos])) {
if (errorId[pos] < 0 || (!std::isalnum(errorId[pos]) && errorId[pos] != '_')) {
return "Failed to add suppression. Invalid id \"" + errorId + "\"";
}
if (pos == 0 && std::isdigit(errorId[pos])) {

View File

@ -45,8 +45,11 @@ private:
void suppressionsBadId1() {
Suppressions suppressions;
std::istringstream s("123");
ASSERT_EQUALS("Failed to add suppression. Invalid id \"123\"", suppressions.parseFile(s));
std::istringstream s1("123");
ASSERT_EQUALS("Failed to add suppression. Invalid id \"123\"", suppressions.parseFile(s1));
std::istringstream s2("obsoleteFunctionsrand_r");
ASSERT_EQUALS("", suppressions.parseFile(s2));
}
void suppressionsDosFormat() {