@@ -5514,6 +5514,18 @@ bool Tokenizer::simplifyTokenList1(const char FileName[])
55145514 // @..
55155515 simplifyAt ();
55165516
5517+ // Remove __declspec()
5518+ simplifyDeclspec ();
5519+
5520+ // Remove "inline", "register", and "restrict"
5521+ simplifyKeyword ();
5522+
5523+ // Remove [[attribute]]
5524+ simplifyCPPAttribute ();
5525+
5526+ // remove __attribute__((?))
5527+ simplifyAttribute ();
5528+
55175529 // Bail out if code is garbage
55185530 if (mTimerResults ) {
55195531 Timer t (" Tokenizer::simplifyTokens1::simplifyTokenList1::findGarbageCode" , mSettings .showtime , mTimerResults );
@@ -5548,12 +5560,6 @@ bool Tokenizer::simplifyTokenList1(const char FileName[])
55485560 // simplify namespace aliases
55495561 simplifyNamespaceAliases ();
55505562
5551- // Remove [[attribute]]
5552- simplifyCPPAttribute ();
5553-
5554- // remove __attribute__((?))
5555- simplifyAttribute ();
5556-
55575563 // simplify cppcheck attributes __cppcheck_?__(?)
55585564 simplifyCppcheckAttribute ();
55595565
@@ -5595,13 +5601,8 @@ bool Tokenizer::simplifyTokenList1(const char FileName[])
55955601 if (Settings::terminated ())
55965602 return false ;
55975603
5598- // Remove __declspec()
5599- simplifyDeclspec ();
56005604 validate ();
56015605
5602- // Remove "inline", "register", and "restrict"
5603- simplifyKeyword ();
5604-
56055606 // simplify simple calculations inside <..>
56065607 if (isCPP ()) {
56075608 Token *lt = nullptr ;
@@ -8656,7 +8657,7 @@ void Tokenizer::findGarbageCode() const
86568657 syntaxError (tok);
86578658 if (Token::Match (tok, " %cop%|= ]" ) && !(isCPP () && Token::Match (tok->previous (), " %type%|[|,|%num% &|=|> ]" )))
86588659 syntaxError (tok);
8659- if (Token::Match (tok, " [+-] [;,)]}]" ) && !(isCPP () && Token::Match (tok->previous (), " operator [+-] ; " )))
8660+ if (Token::Match (tok, " [+-] [;,)]}]" ) && !(isCPP () && Token::simpleMatch (tok->previous (), " operator" )))
86608661 syntaxError (tok);
86618662 if (Token::simpleMatch (tok, " ," ) &&
86628663 !Token::Match (tok->tokAt (-2 ), " [ = , &|%name%" )) {
@@ -8696,6 +8697,8 @@ void Tokenizer::findGarbageCode() const
86968697 syntaxError (tok);
86978698 if (Token::Match (tok, " ! %comp%" ))
86988699 syntaxError (tok);
8700+ if (Token::Match (tok, " ] %name%" ) && (!isCPP () || !(tok->tokAt (-1 ) && Token::simpleMatch (tok->tokAt (-2 ), " delete [" ))))
8701+ syntaxError (tok);
86998702
87008703 if (tok->link () && Token::Match (tok, " [([]" ) && (!tok->tokAt (-1 ) || !tok->tokAt (-1 )->isControlFlowKeyword ())) {
87018704 const Token* const end = tok->link ();
@@ -9226,7 +9229,7 @@ void Tokenizer::simplifyCppcheckAttribute()
92269229
92279230void Tokenizer::simplifyCPPAttribute ()
92289231{
9229- if (!isCPP () || mSettings . standards . cpp < Standards::CPP11 )
9232+ if (!isCPP ())
92309233 return ;
92319234
92329235 for (Token *tok = list.front (); tok;) {
0 commit comments