@@ -5852,6 +5852,8 @@ void Tokenizer::dump(std::ostream &out) const
58525852 out << " isComplex=\" true\" " ;
58535853 if (tok->isRestrict ())
58545854 out << " isRestrict=\" true\" " ;
5855+ if (tok->isAtomic ())
5856+ out << " isAtomic=\" true\" " ;
58555857 if (tok->isAttributeExport ())
58565858 out << " isAttributeExport=\" true\" " ;
58575859 if (tok->link ())
@@ -9046,16 +9048,31 @@ void Tokenizer::simplifyKeyword()
90469048 tok->deleteNext ();
90479049
90489050 if (c99) {
9049- if (tok->str () == " restrict" ) {
9051+ auto getTypeTokens = [tok]() {
9052+ std::vector<Token*> ret;
9053+ for (Token *temp = tok; Token::Match (temp, " %name%" ); temp = temp->previous ()) {
9054+ if (!temp->isKeyword ())
9055+ ret.emplace_back (temp);
9056+ }
90509057 for (Token *temp = tok->next (); Token::Match (temp, " %name%" ); temp = temp->next ()) {
9051- temp->isRestrict (true );
9058+ if (!temp->isKeyword ())
9059+ ret.emplace_back (temp);
90529060 }
9061+ return ret;
9062+ };
9063+
9064+ if (tok->str () == " restrict" ) {
9065+ for (Token* temp: getTypeTokens ())
9066+ temp->isRestrict (true );
90539067 tok->deleteThis ();
90549068 }
90559069
90569070 if (mSettings ->standards .c >= Standards::C11 ) {
9057- while (tok->str () == " _Atomic" )
9071+ while (tok->str () == " _Atomic" ) {
9072+ for (Token* temp: getTypeTokens ())
9073+ temp->isAtomic (true );
90589074 tok->deleteThis ();
9075+ }
90599076 }
90609077 }
90619078
0 commit comments