@@ -3592,7 +3592,7 @@ bool Tokenizer::simplifyTokenList1(const char FileName[])
35923592
35933593 // collapse compound standard types into a single token
35943594 // unsigned long long int => long (with _isUnsigned=true,_isLong=true)
3595- simplifyStdType ();
3595+ list. simplifyStdType ();
35963596
35973597 if (_settings->terminated ())
35983598 return false ;
@@ -5780,67 +5780,6 @@ void Tokenizer::simplifyPlatformTypes()
57805780 }
57815781}
57825782
5783- void Tokenizer::simplifyStdType ()
5784- {
5785- for (Token *tok = list.front (); tok; tok = tok->next ()) {
5786- if (Token::Match (tok, " char|short|int|long|unsigned|signed|double|float" ) || (_settings->standards .c >= Standards::C99 && Token::Match (tok, " complex|_Complex" ))) {
5787- bool isFloat= false ;
5788- bool isSigned = false ;
5789- bool isUnsigned = false ;
5790- bool isComplex = false ;
5791- unsigned int countLong = 0 ;
5792- Token* typeSpec = nullptr ;
5793-
5794- Token* tok2 = tok;
5795- for (; tok2->next (); tok2 = tok2->next ()) {
5796- if (tok2->str () == " long" ) {
5797- countLong++;
5798- if (!isFloat)
5799- typeSpec = tok2;
5800- } else if (tok2->str () == " short" ) {
5801- typeSpec = tok2;
5802- } else if (tok2->str () == " unsigned" )
5803- isUnsigned = true ;
5804- else if (tok2->str () == " signed" )
5805- isSigned = true ;
5806- else if (Token::Match (tok2, " float|double" )) {
5807- isFloat = true ;
5808- typeSpec = tok2;
5809- } else if (_settings->standards .c >= Standards::C99 && Token::Match (tok2, " complex|_Complex" ))
5810- isComplex = !isFloat || tok2->str () == " _Complex" || Token::Match (tok2->next (), " *|&|%name%" ); // Ensure that "complex" is not the variables name
5811- else if (Token::Match (tok2, " char|int" )) {
5812- if (!typeSpec)
5813- typeSpec = tok2;
5814- } else
5815- break ;
5816- }
5817-
5818- if (!typeSpec) { // unsigned i; or similar declaration
5819- if (!isComplex) { // Ensure that "complex" is not the variables name
5820- tok->str (" int" );
5821- tok->isSigned (isSigned);
5822- tok->isUnsigned (isUnsigned);
5823- }
5824- } else {
5825- typeSpec->isLong (typeSpec->isLong () || (isFloat && countLong == 1 ) || countLong > 1 );
5826- typeSpec->isComplex (typeSpec->isComplex () || (isFloat && isComplex));
5827- typeSpec->isSigned (typeSpec->isSigned () || isSigned);
5828- typeSpec->isUnsigned (typeSpec->isUnsigned () || isUnsigned);
5829-
5830- // Remove specifiers
5831- const Token* tok3 = tok->previous ();
5832- tok2 = tok2->previous ();
5833- while (tok3 != tok2) {
5834- if (tok2 != typeSpec &&
5835- (isComplex || !Token::Match (tok2, " complex|_Complex" ))) // Ensure that "complex" is not the variables name
5836- tok2->deleteThis ();
5837- tok2 = tok2->previous ();
5838- }
5839- }
5840- }
5841- }
5842- }
5843-
58445783void Tokenizer::simplifyStaticConst ()
58455784{
58465785 // This function will simplify the token list so that the qualifiers "extern", "static"
0 commit comments