File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -245,6 +245,15 @@ SuppressionList::Suppression SuppressionList::parseLine(const std::string &line)
245245 suppression.fileName .erase (pos);
246246 }
247247 }
248+
249+ // when parsing string generated internally by toString() there can be newline
250+ std::string extra;
251+ while (std::getline (lineStream, extra)) {
252+ if (startsWith (extra, " symbol=" ))
253+ suppression.symbolName = extra.substr (7 );
254+ else if (extra == " polyspace=1" )
255+ suppression.isPolyspace = true ;
256+ }
248257 }
249258 }
250259
@@ -633,7 +642,7 @@ void SuppressionList::markUnmatchedInlineSuppressionsAsChecked(const Tokenizer &
633642std::string SuppressionList::Suppression::toString () const
634643{
635644 std::string s;
636- s+= errorId;
645+ s += errorId;
637646 if (!fileName.empty ()) {
638647 s += ' :' ;
639648 s += fileName;
@@ -642,10 +651,10 @@ std::string SuppressionList::Suppression::toString() const
642651 s += std::to_string (lineNumber);
643652 }
644653 }
645- if (!symbolName.empty ()) {
646- s += ' : ' ;
647- s += symbolName;
648- }
654+ if (!symbolName.empty ())
655+ s += " \n symbol= " + symbolName ;
656+ if (isPolyspace)
657+ s += " \n polyspace=1 " ;
649658 return s;
650659}
651660
Original file line number Diff line number Diff line change @@ -55,6 +55,7 @@ class TestSuppressions : public TestFixture {
5555
5656 void run () override {
5757 mNewTemplate = true ;
58+ TEST_CASE (parseLine);
5859 TEST_CASE (suppressionsBadId1);
5960 TEST_CASE (suppressionsDosFormat); // Ticket #1836
6061 TEST_CASE (suppressionsFileNameWithColon); // Ticket #1919 - filename includes colon
@@ -141,6 +142,17 @@ class TestSuppressions : public TestFixture {
141142 TEST_CASE (polyspaceExtraComments);
142143 }
143144
145+
146+ void parseLine () const {
147+ ASSERT_EQUALS (" bad:test.c:1" , SuppressionList::parseLine (" bad:test.c:1" ).toString ());
148+
149+ // symbol
150+ ASSERT_EQUALS (" bad:test.c:1\n symbol=x" , SuppressionList::parseLine (" bad:test.c:1\n symbol=x" ).toString ());
151+
152+ // polyspace
153+ ASSERT_EQUALS (" bad:test.c:1\n polyspace=1" , SuppressionList::parseLine (" bad:test.c:1\n polyspace=1" ).toString ());
154+ }
155+
144156 void suppressionsBadId1 () const {
145157 SuppressionList suppressions;
146158 std::istringstream s1 (" 123" );
@@ -1810,7 +1822,7 @@ class TestSuppressions : public TestFixture {
18101822 SuppressionList::Suppression s;
18111823 s.errorId = " unitvar" ;
18121824 s.symbolName = " sym" ;
1813- ASSERT_EQUALS (" unitvar: sym" , s.toString ());
1825+ ASSERT_EQUALS (" unitvar\n symbol= sym" , s.toString ());
18141826 }
18151827 }
18161828
You can’t perform that action at this time.
0 commit comments