File tree Expand file tree Collapse file tree 3 files changed +10
-6
lines changed
Expand file tree Collapse file tree 3 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -7570,10 +7570,14 @@ void Tokenizer::syntaxError(const Token *tok) const
75707570void Tokenizer::syntaxError (const Token *tok, char c) const
75717571{
75727572 printDebugOutput (0 );
7573- throw InternalError (tok,
7574- std::string (" Invalid number of character '" ) + c + " ' " +
7575- " when these macros are defined: '" + _configuration + " '." ,
7576- InternalError::SYNTAX);
7573+ if (_configuration.empty ())
7574+ throw InternalError (tok,
7575+ std::string (" Invalid number of character '" ) + c + " ' when no macros are defined." ,
7576+ InternalError::SYNTAX);
7577+ else
7578+ throw InternalError (tok,
7579+ std::string (" Invalid number of character '" ) + c + " ' when these macros are defined: '" + _configuration + " '." ,
7580+ InternalError::SYNTAX);
75777581}
75787582
75797583void Tokenizer::unhandled_macro_class_x_y (const Token *tok) const
Original file line number Diff line number Diff line change 1- [samples\syntaxError\bad.c:2]: (error) Invalid number of character '{' when these macros are defined: '' .
1+ [samples\syntaxError\bad.c:2]: (error) Invalid number of character '{' when no macros are defined.
Original file line number Diff line number Diff line change @@ -1073,7 +1073,7 @@ class TestGarbage : public TestFixture {
10731073 tokenizer.tokenize (istr, " test.cpp" );
10741074 assertThrowFail (__FILE__, __LINE__);
10751075 } catch (InternalError& e) {
1076- ASSERT_EQUALS (" Invalid number of character '(' when these macros are defined: '' ." , e.errorMessage );
1076+ ASSERT_EQUALS (" Invalid number of character '(' when no macros are defined." , e.errorMessage );
10771077 ASSERT_EQUALS (" syntaxError" , e.id );
10781078 ASSERT_EQUALS (2 , e.token ->linenr ());
10791079 }
You can’t perform that action at this time.
0 commit comments