Skip to content

Commit

Permalink
Suppress some cppcheck warnings internal to code
Browse files Browse the repository at this point in the history
  • Loading branch information
lefticus committed Jul 5, 2014
1 parent 15c5ed7 commit 9ea3efa
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions openstudiocore/src/utilities/data/CalibrationResult.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ namespace openstudio {
return boost::none;
}
try{
// cppcheck-suppress unusedScopedObject
Date(test->valueAsString());
}catch(const std::exception&){
LOG(Warn,"Cannot create CalibrationBillingPeriod from Attribute with improper 'startDate'.");
Expand Down Expand Up @@ -269,6 +270,7 @@ namespace openstudio {
return boost::none;
}
try{
// cppcheck-suppress unusedScopedObject
FuelType(test->valueAsString());
}catch(const std::exception&){
LOG(Warn,"Cannot create CalibrationUtilityBill from Attribute with improper 'fuelType'.");
Expand All @@ -281,6 +283,7 @@ namespace openstudio {
return boost::none;
}
try{
// cppcheck-suppress unusedScopedObject
InstallLocationType(test->valueAsString());
}catch(const std::exception&){
LOG(Warn,"Cannot create CalibrationUtilityBill from Attribute with improper 'meterInstallLocation'.");
Expand Down
7 changes: 7 additions & 0 deletions openstudiocore/src/utilities/idd/Test/CommentRegex_GTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,14 @@ TEST_F(IddFixture,CommentRegex_Lines) {
line = " \t\t !-IdfEditor-style comments are ok too.";
EXPECT_TRUE(boost::regex_match(line,matches,commentWhitespaceOnlyLine()));
ASSERT_EQ(static_cast<unsigned>(2),matches.size());
// cppcheck-suppress arrayIndexOutOfBounds
match = std::string(matches[1].first,matches[1].second);
EXPECT_EQ("-IdfEditor-style comments are ok too.",match);

line = " !- One last boring comment, with some math: 1 + 1 = (1^1)*2.";
EXPECT_TRUE(boost::regex_match(line,matches,commentWhitespaceOnlyLine()));
ASSERT_EQ(static_cast<unsigned>(2),matches.size());
// cppcheck-suppress arrayIndexOutOfBounds
match = std::string(matches[1].first,matches[1].second);
EXPECT_EQ("- One last boring comment, with some math: 1 + 1 = (1^1)*2.",match);

Expand All @@ -113,20 +115,23 @@ TEST_F(IddFixture,CommentRegex_Lines) {
EXPECT_FALSE(matches.empty());
ASSERT_EQ(static_cast<unsigned>(2),matches.size());
EXPECT_TRUE(matches[0].matched);
// cppcheck-suppress arrayIndexOutOfBounds
EXPECT_FALSE(matches[1].matched);

line = " \t \t";
EXPECT_TRUE(boost::regex_match(line,matches,editorCommentWhitespaceOnlyLine()));
EXPECT_FALSE(matches.empty());
ASSERT_EQ(static_cast<unsigned>(2),matches.size());
EXPECT_TRUE(matches[0].matched);
// cppcheck-suppress arrayIndexOutOfBounds
EXPECT_FALSE(matches[1].matched);

line = " ";
EXPECT_TRUE(boost::regex_match(line,matches,editorCommentWhitespaceOnlyLine()));
EXPECT_FALSE(matches.empty());
ASSERT_EQ(static_cast<unsigned>(2),matches.size());
EXPECT_TRUE(matches[0].matched);
// cppcheck-suppress arrayIndexOutOfBounds
EXPECT_FALSE(matches[1].matched);

line = " \t !A plain comment, no space";
Expand All @@ -138,12 +143,14 @@ TEST_F(IddFixture,CommentRegex_Lines) {
line = " \t\t !-IdfEditor-style comments are ok too.";
EXPECT_TRUE(boost::regex_match(line,matches,editorCommentWhitespaceOnlyLine()));
ASSERT_EQ(static_cast<unsigned>(2),matches.size());
// cppcheck-suppress arrayIndexOutOfBounds
match = std::string(matches[1].first,matches[1].second);
EXPECT_EQ("IdfEditor-style comments are ok too.",match);

line = " !- One last boring comment, with some math: 1 + 1 = (1^1)*2.";
EXPECT_TRUE(boost::regex_match(line,matches,editorCommentWhitespaceOnlyLine()));
ASSERT_EQ(static_cast<unsigned>(2),matches.size());
// cppcheck-suppress arrayIndexOutOfBounds
match = std::string(matches[1].first,matches[1].second);
EXPECT_EQ(" One last boring comment, with some math: 1 + 1 = (1^1)*2.",match);

Expand Down
1 change: 1 addition & 0 deletions openstudiocore/src/utilities/idd/Test/IddField_GTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,5 +98,6 @@ TEST_F(IddFixture, IddField) {
fields[3].print(ss,false);
OptionalIddField fieldClone = IddField::load(fields[3].name(),ss.str(),"Lights");
ASSERT_TRUE(fieldClone);
// cppcheck-suppress arrayIndexOutOfBounds
EXPECT_EQ(fields[3],*fieldClone);
}

4 comments on commit 9ea3efa

@nrel-bot
Copy link

Choose a reason for hiding this comment

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

test_ci (lefticus) - x86_64-Linux-Ubuntu-14.04-gcc-4.8: Build Failed

Build Badge Test Badge

@nrel-bot
Copy link

Choose a reason for hiding this comment

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

test_ci (lefticus) - i386-Windows-7-VisualStudio-12: Build Failed

Build Badge Test Badge

@nrel-bot
Copy link

Choose a reason for hiding this comment

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

test_ci (lefticus) - x86_64-Linux-Ubuntu-14.04-cppcheck-1.61: Build Failed

Build Badge

@nrel-bot
Copy link

Choose a reason for hiding this comment

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

test_ci (lefticus) - x86_64-MacOS-10.9-clang: Build Failed

Build Badge Test Badge

Please # to comment.