Remove some redundant semicolons - part 5
This commit is contained in:
parent
2fc067e6ab
commit
b45d63a10a
|
@ -870,10 +870,17 @@ void Tokenizer::simplifyTypedef()
|
||||||
bool isNamespace = false;
|
bool isNamespace = false;
|
||||||
std::string className;
|
std::string className;
|
||||||
bool hasClass = false;
|
bool hasClass = false;
|
||||||
|
bool goback = false;
|
||||||
for (Token *tok = _tokens; tok; tok = tok->next()) {
|
for (Token *tok = _tokens; tok; tok = tok->next()) {
|
||||||
if (_errorLogger && !_files.empty())
|
if (_errorLogger && !_files.empty())
|
||||||
_errorLogger->reportProgress(_files[0], "Tokenize (typedef)", tok->progressValue());
|
_errorLogger->reportProgress(_files[0], "Tokenize (typedef)", tok->progressValue());
|
||||||
|
|
||||||
|
if (goback) {
|
||||||
|
//jump back once, see the comment at the end of the function
|
||||||
|
goback = false;
|
||||||
|
tok = tok->previous();
|
||||||
|
}
|
||||||
|
|
||||||
if (Token::Match(tok, "class|struct|namespace %any%") &&
|
if (Token::Match(tok, "class|struct|namespace %any%") &&
|
||||||
(!tok->previous() || (tok->previous() && tok->previous()->str() != "enum"))) {
|
(!tok->previous() || (tok->previous() && tok->previous()->str() != "enum"))) {
|
||||||
isNamespace = (tok->str() == "namespace");
|
isNamespace = (tok->str() == "namespace");
|
||||||
|
@ -1807,16 +1814,23 @@ void Tokenizer::simplifyTypedef()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ok) {
|
if (ok) {
|
||||||
// remove typedef but leave ;
|
// remove typedef
|
||||||
Token::eraseTokens(typeDef, tok);
|
Token::eraseTokens(typeDef, tok);
|
||||||
|
|
||||||
if (typeDef != _tokens) {
|
if (typeDef != _tokens) {
|
||||||
tok = typeDef->previous();
|
tok = typeDef->previous();
|
||||||
tok->deleteNext();
|
tok->deleteNext();
|
||||||
tok->deleteNext();
|
//no need to remove last token in the list
|
||||||
|
if (tok->tokAt(2))
|
||||||
|
tok->deleteNext();
|
||||||
} else {
|
} else {
|
||||||
_tokens->deleteThis();
|
_tokens->deleteThis();
|
||||||
|
//no need to remove last token in the list
|
||||||
|
if (_tokens->next())
|
||||||
|
_tokens->deleteThis();
|
||||||
tok = _tokens;
|
tok = _tokens;
|
||||||
|
//now the next token to process is 'tok', not 'tok->next()';
|
||||||
|
goback = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3471,7 +3471,6 @@ private:
|
||||||
"}\n";
|
"}\n";
|
||||||
|
|
||||||
const std::string expected =
|
const std::string expected =
|
||||||
"; "
|
|
||||||
"void f ( ) "
|
"void f ( ) "
|
||||||
"{ "
|
"{ "
|
||||||
"int ivar ; ivar = -2 ; "
|
"int ivar ; ivar = -2 ; "
|
||||||
|
@ -3491,7 +3490,6 @@ private:
|
||||||
"}\n";
|
"}\n";
|
||||||
|
|
||||||
const char expected[] =
|
const char expected[] =
|
||||||
"; "
|
|
||||||
"void f ( ) "
|
"void f ( ) "
|
||||||
"{ "
|
"{ "
|
||||||
"struct yy_buffer_state * state ; "
|
"struct yy_buffer_state * state ; "
|
||||||
|
@ -3520,9 +3518,7 @@ private:
|
||||||
void simplifyTypedef7() {
|
void simplifyTypedef7() {
|
||||||
const char code[] = "typedef int abc ; "
|
const char code[] = "typedef int abc ; "
|
||||||
"Fred :: abc f ;";
|
"Fred :: abc f ;";
|
||||||
const char expected[] =
|
const char expected[] = "Fred :: abc f ;";
|
||||||
"; "
|
|
||||||
"Fred :: abc f ;";
|
|
||||||
ASSERT_EQUALS(expected, tok(code, false));
|
ASSERT_EQUALS(expected, tok(code, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3545,7 +3541,6 @@ private:
|
||||||
"RCUINT trcui;";
|
"RCUINT trcui;";
|
||||||
|
|
||||||
const char expected[] =
|
const char expected[] =
|
||||||
"; "
|
|
||||||
"int ti ; "
|
"int ti ; "
|
||||||
"unsigned int tui ; "
|
"unsigned int tui ; "
|
||||||
"int * tpi ; "
|
"int * tpi ; "
|
||||||
|
@ -3571,7 +3566,6 @@ private:
|
||||||
"V v;";
|
"V v;";
|
||||||
|
|
||||||
const char expected[] =
|
const char expected[] =
|
||||||
"; "
|
|
||||||
"struct t { int a ; } ; "
|
"struct t { int a ; } ; "
|
||||||
"struct U { int a ; } ; "
|
"struct U { int a ; } ; "
|
||||||
"struct Unnamed0 { int a ; } ; "
|
"struct Unnamed0 { int a ; } ; "
|
||||||
|
@ -3598,7 +3592,6 @@ private:
|
||||||
"V v;";
|
"V v;";
|
||||||
|
|
||||||
const char expected[] =
|
const char expected[] =
|
||||||
"; "
|
|
||||||
"union t { int a ; float b ; } ; "
|
"union t { int a ; float b ; } ; "
|
||||||
"union U { int a ; float b ; } ; "
|
"union U { int a ; float b ; } ; "
|
||||||
"union Unnamed1 { int a ; float b ; } ; "
|
"union Unnamed1 { int a ; float b ; } ; "
|
||||||
|
@ -3637,7 +3630,6 @@ private:
|
||||||
"IntListIterator iter;";
|
"IntListIterator iter;";
|
||||||
|
|
||||||
const char expected[] =
|
const char expected[] =
|
||||||
"; "
|
|
||||||
"vector < int > v1 ; "
|
"vector < int > v1 ; "
|
||||||
"std :: vector < int > v2 ; "
|
"std :: vector < int > v2 ; "
|
||||||
"std :: vector < std :: vector < int > > v3 ; "
|
"std :: vector < std :: vector < int > > v3 ; "
|
||||||
|
@ -3697,9 +3689,7 @@ private:
|
||||||
const char code[] = "typedef char frame[10];\n"
|
const char code[] = "typedef char frame[10];\n"
|
||||||
"frame f;";
|
"frame f;";
|
||||||
|
|
||||||
const char expected[] =
|
const char expected[] = "char f [ 10 ] ;";
|
||||||
"; "
|
|
||||||
"char f [ 10 ] ;";
|
|
||||||
|
|
||||||
ASSERT_EQUALS(expected, tok(code, false));
|
ASSERT_EQUALS(expected, tok(code, false));
|
||||||
}
|
}
|
||||||
|
@ -3708,9 +3698,7 @@ private:
|
||||||
const char code[] = "typedef unsigned char frame[10];\n"
|
const char code[] = "typedef unsigned char frame[10];\n"
|
||||||
"frame f;";
|
"frame f;";
|
||||||
|
|
||||||
const char expected[] =
|
const char expected[] = "unsigned char f [ 10 ] ;";
|
||||||
"; "
|
|
||||||
"unsigned char f [ 10 ] ;";
|
|
||||||
|
|
||||||
ASSERT_EQUALS(expected, tok(code, false));
|
ASSERT_EQUALS(expected, tok(code, false));
|
||||||
}
|
}
|
||||||
|
@ -3743,7 +3731,6 @@ private:
|
||||||
"CHAR c;";
|
"CHAR c;";
|
||||||
|
|
||||||
const char expected[] =
|
const char expected[] =
|
||||||
"; "
|
|
||||||
"char * pc ; "
|
"char * pc ; "
|
||||||
"char c ;";
|
"char c ;";
|
||||||
|
|
||||||
|
@ -3837,7 +3824,7 @@ private:
|
||||||
"PFV pfv;";
|
"PFV pfv;";
|
||||||
|
|
||||||
const char expected[] =
|
const char expected[] =
|
||||||
"; "
|
""
|
||||||
""
|
""
|
||||||
"void ( * pf ) ( ) ; "
|
"void ( * pf ) ( ) ; "
|
||||||
"void * ( * pfv ) ( void * ) ;";
|
"void * ( * pfv ) ( void * ) ;";
|
||||||
|
@ -3939,7 +3926,6 @@ private:
|
||||||
"void addCallback1(Callback callback, int j) { }";
|
"void addCallback1(Callback callback, int j) { }";
|
||||||
|
|
||||||
const char expected[] =
|
const char expected[] =
|
||||||
"; "
|
|
||||||
"void addCallback ( bool * callback ) { } "
|
"void addCallback ( bool * callback ) { } "
|
||||||
"void addCallback1 ( bool * callback , int j ) { }";
|
"void addCallback1 ( bool * callback , int j ) { }";
|
||||||
|
|
||||||
|
@ -3955,7 +3941,6 @@ private:
|
||||||
"}";
|
"}";
|
||||||
|
|
||||||
const char expected[] =
|
const char expected[] =
|
||||||
"; "
|
|
||||||
"void g ( int * f ) "
|
"void g ( int * f ) "
|
||||||
"{ "
|
"{ "
|
||||||
"int * f2 ; f2 = ( int * ) f ; "
|
"int * f2 ; f2 = ( int * ) f ; "
|
||||||
|
@ -3972,7 +3957,6 @@ private:
|
||||||
"}";
|
"}";
|
||||||
|
|
||||||
const char expected[] =
|
const char expected[] =
|
||||||
"; "
|
|
||||||
"void g ( int * f ) "
|
"void g ( int * f ) "
|
||||||
"{ "
|
"{ "
|
||||||
"int * f2 ; f2 = static_cast < int * > ( f ) ; "
|
"int * f2 ; f2 = static_cast < int * > ( f ) ; "
|
||||||
|
@ -3991,7 +3975,6 @@ private:
|
||||||
"}";
|
"}";
|
||||||
|
|
||||||
const char expected[] =
|
const char expected[] =
|
||||||
"; "
|
|
||||||
"struct vfs_class { "
|
"struct vfs_class { "
|
||||||
"void ( * fill_names ) ( struct vfs_class * me , void ( * ) ( const char * ) ) ; "
|
"void ( * fill_names ) ( struct vfs_class * me , void ( * ) ( const char * ) ) ; "
|
||||||
"}";
|
"}";
|
||||||
|
@ -4006,7 +3989,6 @@ private:
|
||||||
"}";
|
"}";
|
||||||
|
|
||||||
const char expected[] =
|
const char expected[] =
|
||||||
"; "
|
|
||||||
"struct vfs_class { "
|
"struct vfs_class { "
|
||||||
"void ( * fill_names ) ( void ( * ) ( const char * ) , struct vfs_class * me ) ; "
|
"void ( * fill_names ) ( void ( * ) ( const char * ) , struct vfs_class * me ) ; "
|
||||||
"}";
|
"}";
|
||||||
|
@ -4020,9 +4002,7 @@ private:
|
||||||
const char code[] = "typedef void (*Callback) ();\n"
|
const char code[] = "typedef void (*Callback) ();\n"
|
||||||
"void addCallback(Callback (*callback)());";
|
"void addCallback(Callback (*callback)());";
|
||||||
|
|
||||||
const char expected[] =
|
const char expected[] = "void addCallback ( void ( * ( * callback ) ( ) ) ( ) ) ;";
|
||||||
"; "
|
|
||||||
"void addCallback ( void ( * ( * callback ) ( ) ) ( ) ) ;";
|
|
||||||
|
|
||||||
ASSERT_EQUALS(expected, tok(code, false));
|
ASSERT_EQUALS(expected, tok(code, false));
|
||||||
}
|
}
|
||||||
|
@ -4034,9 +4014,7 @@ private:
|
||||||
"\n"
|
"\n"
|
||||||
"struct mscrtc6845 *pc_video_start(pc_video_update_proc (*choosevideomode)(running_machine *machine, int *width, int *height, struct mscrtc6845 *crtc));";
|
"struct mscrtc6845 *pc_video_start(pc_video_update_proc (*choosevideomode)(running_machine *machine, int *width, int *height, struct mscrtc6845 *crtc));";
|
||||||
|
|
||||||
const char expected[] =
|
const char expected[] = "struct mscrtc6845 * pc_video_start ( void ( * ( * choosevideomode ) ( running_machine * machine , int * width , int * height , struct mscrtc6845 * crtc ) ) ( bitmap_t * bitmap , struct mscrtc6845 * crtc ) ) ;";
|
||||||
"; "
|
|
||||||
"struct mscrtc6845 * pc_video_start ( void ( * ( * choosevideomode ) ( running_machine * machine , int * width , int * height , struct mscrtc6845 * crtc ) ) ( bitmap_t * bitmap , struct mscrtc6845 * crtc ) ) ;";
|
|
||||||
|
|
||||||
ASSERT_EQUALS(expected, tok(code, false));
|
ASSERT_EQUALS(expected, tok(code, false));
|
||||||
}
|
}
|
||||||
|
@ -4064,9 +4042,7 @@ private:
|
||||||
const char code[] = "typedef std::pair<double, double> (*F)(double);\n"
|
const char code[] = "typedef std::pair<double, double> (*F)(double);\n"
|
||||||
"F f;";
|
"F f;";
|
||||||
|
|
||||||
const char expected[] =
|
const char expected[] = "std :: pair < double , double > ( * f ) ( double ) ;";
|
||||||
"; "
|
|
||||||
"std :: pair < double , double > ( * f ) ( double ) ;";
|
|
||||||
|
|
||||||
ASSERT_EQUALS(expected, tok(code, false));
|
ASSERT_EQUALS(expected, tok(code, false));
|
||||||
}
|
}
|
||||||
|
@ -4083,7 +4059,6 @@ private:
|
||||||
"int_array ia;";
|
"int_array ia;";
|
||||||
|
|
||||||
const char expected[] =
|
const char expected[] =
|
||||||
"; "
|
|
||||||
"int a [ ice_or < is_int < int > :: value , is_int < UDT > :: value > :: value ? 1 : -1 ] ; "
|
"int a [ ice_or < is_int < int > :: value , is_int < UDT > :: value > :: value ? 1 : -1 ] ; "
|
||||||
"int a1 [ N ] ; "
|
"int a1 [ N ] ; "
|
||||||
"int a2 [ N ] [ M ] ; "
|
"int a2 [ N ] [ M ] ; "
|
||||||
|
@ -4102,7 +4077,6 @@ private:
|
||||||
"int_list_array ila;";
|
"int_list_array ila;";
|
||||||
|
|
||||||
const char expected[] =
|
const char expected[] =
|
||||||
"; "
|
|
||||||
":: std :: list < int > il ; "
|
":: std :: list < int > il ; "
|
||||||
":: std :: list < int > :: iterator ili ; "
|
":: std :: list < int > :: iterator ili ; "
|
||||||
":: std :: list < int > ila [ 10 ] ;";
|
":: std :: list < int > ila [ 10 ] ;";
|
||||||
|
@ -4167,7 +4141,6 @@ private:
|
||||||
"LPCSTR ccp;";
|
"LPCSTR ccp;";
|
||||||
|
|
||||||
const char expected[] =
|
const char expected[] =
|
||||||
"; "
|
|
||||||
"char c ; "
|
"char c ; "
|
||||||
"char * cp ; "
|
"char * cp ; "
|
||||||
"const char * ccp ;";
|
"const char * ccp ;";
|
||||||
|
@ -4302,8 +4275,7 @@ private:
|
||||||
" return a + s;\n"
|
" return a + s;\n"
|
||||||
"}";
|
"}";
|
||||||
|
|
||||||
const char expected[] = "; "
|
const char expected[] = "class S "
|
||||||
"class S "
|
|
||||||
"{ "
|
"{ "
|
||||||
"public: "
|
"public: "
|
||||||
""
|
""
|
||||||
|
@ -4352,8 +4324,7 @@ private:
|
||||||
"{\n"
|
"{\n"
|
||||||
" *va_arg(ap, TIFFFaxFillFunc*) = 0;\n"
|
" *va_arg(ap, TIFFFaxFillFunc*) = 0;\n"
|
||||||
"}";
|
"}";
|
||||||
const char expected[] = "; "
|
const char expected[] = "void f ( va_list ap ) "
|
||||||
"void f ( va_list ap ) "
|
|
||||||
"{ "
|
"{ "
|
||||||
"* va_arg ( ap , void ( * * ) ( ) ) = 0 ; "
|
"* va_arg ( ap , void ( * * ) ( ) ) = 0 ; "
|
||||||
"}";
|
"}";
|
||||||
|
@ -4380,8 +4351,7 @@ private:
|
||||||
"{\n"
|
"{\n"
|
||||||
" INT i; { }\n"
|
" INT i; { }\n"
|
||||||
"}";
|
"}";
|
||||||
const char expected[] = "; "
|
const char expected[] = "void f ( ) "
|
||||||
"void f ( ) "
|
|
||||||
"{ "
|
"{ "
|
||||||
"int i ; { } "
|
"int i ; { } "
|
||||||
"}";
|
"}";
|
||||||
|
@ -4392,7 +4362,7 @@ private:
|
||||||
void simplifyTypedef38() {
|
void simplifyTypedef38() {
|
||||||
const char code[] = "typedef C A;\n"
|
const char code[] = "typedef C A;\n"
|
||||||
"struct AB : public A, public B { };";
|
"struct AB : public A, public B { };";
|
||||||
const char expected[] = "; struct AB : public C , public B { } ;";
|
const char expected[] = "struct AB : public C , public B { } ;";
|
||||||
ASSERT_EQUALS(expected, tok(code, false));
|
ASSERT_EQUALS(expected, tok(code, false));
|
||||||
|
|
||||||
checkSimplifyTypedef(code);
|
checkSimplifyTypedef(code);
|
||||||
|
@ -4500,8 +4470,7 @@ private:
|
||||||
"};\n";
|
"};\n";
|
||||||
|
|
||||||
// The expected result..
|
// The expected result..
|
||||||
const std::string expected("; "
|
const std::string expected("struct A "
|
||||||
"struct A "
|
|
||||||
"{ "
|
"{ "
|
||||||
"int alloclen ; "
|
"int alloclen ; "
|
||||||
"} ;");
|
"} ;");
|
||||||
|
@ -4519,8 +4488,7 @@ private:
|
||||||
"};\n";
|
"};\n";
|
||||||
|
|
||||||
// The expected result..
|
// The expected result..
|
||||||
const std::string expected("; "
|
const std::string expected("union A "
|
||||||
"union A "
|
|
||||||
"{ "
|
"{ "
|
||||||
"int alloclen ; "
|
"int alloclen ; "
|
||||||
"} ;");
|
"} ;");
|
||||||
|
@ -4538,8 +4506,7 @@ private:
|
||||||
"};\n";
|
"};\n";
|
||||||
|
|
||||||
// The expected result..
|
// The expected result..
|
||||||
const std::string expected("; "
|
const std::string expected("class A "
|
||||||
"class A "
|
|
||||||
"{ "
|
"{ "
|
||||||
"int alloclen ; "
|
"int alloclen ; "
|
||||||
"} ;");
|
"} ;");
|
||||||
|
@ -4558,8 +4525,7 @@ private:
|
||||||
"};\n";
|
"};\n";
|
||||||
|
|
||||||
// The expected result..
|
// The expected result..
|
||||||
const std::string expected("; "
|
const std::string expected("class MyMap : public std :: map < std :: string , int > "
|
||||||
"class MyMap : public std :: map < std :: string , int > "
|
|
||||||
"{ "
|
"{ "
|
||||||
"} ;");
|
"} ;");
|
||||||
ASSERT_EQUALS(expected, sizeof_(code));
|
ASSERT_EQUALS(expected, sizeof_(code));
|
||||||
|
@ -4575,8 +4541,7 @@ private:
|
||||||
"};\n";
|
"};\n";
|
||||||
|
|
||||||
// The expected result..
|
// The expected result..
|
||||||
const std::string expected("; "
|
const std::string expected("class MyMap : protected std :: map < std :: string , int > "
|
||||||
"class MyMap : protected std :: map < std :: string , int > "
|
|
||||||
"{ "
|
"{ "
|
||||||
"} ;");
|
"} ;");
|
||||||
ASSERT_EQUALS(expected, sizeof_(code));
|
ASSERT_EQUALS(expected, sizeof_(code));
|
||||||
|
@ -4592,8 +4557,7 @@ private:
|
||||||
"};\n";
|
"};\n";
|
||||||
|
|
||||||
// The expected result..
|
// The expected result..
|
||||||
const std::string expected("; "
|
const std::string expected("class MyMap : private std :: map < std :: string , int > "
|
||||||
"class MyMap : private std :: map < std :: string , int > "
|
|
||||||
"{ "
|
"{ "
|
||||||
"} ;");
|
"} ;");
|
||||||
ASSERT_EQUALS(expected, sizeof_(code));
|
ASSERT_EQUALS(expected, sizeof_(code));
|
||||||
|
@ -4664,8 +4628,7 @@ private:
|
||||||
"I i;";
|
"I i;";
|
||||||
|
|
||||||
// The expected result..
|
// The expected result..
|
||||||
const std::string expected("; "
|
const std::string expected("std :: pair < int , int > const i ;");
|
||||||
"std :: pair < int , int > const i ;");
|
|
||||||
ASSERT_EQUALS(expected, sizeof_(code));
|
ASSERT_EQUALS(expected, sizeof_(code));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4674,8 +4637,7 @@ private:
|
||||||
"F f;";
|
"F f;";
|
||||||
|
|
||||||
// The expected result..
|
// The expected result..
|
||||||
const std::string expected("; "
|
const std::string expected("void ( X :: * f ) ( ) ;");
|
||||||
"void ( X :: * f ) ( ) ;");
|
|
||||||
ASSERT_EQUALS(expected, sizeof_(code));
|
ASSERT_EQUALS(expected, sizeof_(code));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4724,8 +4686,7 @@ private:
|
||||||
"type4 t4;";
|
"type4 t4;";
|
||||||
|
|
||||||
// The expected result..
|
// The expected result..
|
||||||
const std::string expected("; "
|
const std::string expected("char ( * t1 ) [ 10 ] ; "
|
||||||
"char ( * t1 ) [ 10 ] ; "
|
|
||||||
"char ( * ( * tp1 ) [ 2 ] ) [ 10 ] ; "
|
"char ( * ( * tp1 ) [ 2 ] ) [ 10 ] ; "
|
||||||
"char ( & t2 ) [ 10 ] ; "
|
"char ( & t2 ) [ 10 ] ; "
|
||||||
"char ( & t3 ) [ x ] ; "
|
"char ( & t3 ) [ x ] ; "
|
||||||
|
@ -4750,8 +4711,7 @@ private:
|
||||||
"type1 foo() { }";
|
"type1 foo() { }";
|
||||||
|
|
||||||
// The expected result..
|
// The expected result..
|
||||||
const std::string expected("; "
|
const std::string expected("char ( * foo ( ) ) [ 10 ] { }");
|
||||||
"char ( * foo ( ) ) [ 10 ] { }");
|
|
||||||
ASSERT_EQUALS(expected, sizeof_(code));
|
ASSERT_EQUALS(expected, sizeof_(code));
|
||||||
|
|
||||||
checkSimplifyTypedef(code);
|
checkSimplifyTypedef(code);
|
||||||
|
@ -4820,8 +4780,7 @@ private:
|
||||||
"_Iterator v3;\n";
|
"_Iterator v3;\n";
|
||||||
|
|
||||||
// The expected result..
|
// The expected result..
|
||||||
const std::string expected("; "
|
const std::string expected("long * v1 ; "
|
||||||
"long * v1 ; "
|
|
||||||
"void * v2 [ 2 ] ; "
|
"void * v2 [ 2 ] ; "
|
||||||
"int * * v3 ;");
|
"int * * v3 ;");
|
||||||
ASSERT_EQUALS(expected, sizeof_(code));
|
ASSERT_EQUALS(expected, sizeof_(code));
|
||||||
|
@ -4875,8 +4834,7 @@ private:
|
||||||
"vec2_t coords[4] = {1,2,3,4,5,6,7,8};\n";
|
"vec2_t coords[4] = {1,2,3,4,5,6,7,8};\n";
|
||||||
|
|
||||||
// The expected result..
|
// The expected result..
|
||||||
const std::string expected("; "
|
const std::string expected("int coords [ 4 ] [ 2 ] = { 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 } ;");
|
||||||
"int coords [ 4 ] [ 2 ] = { 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 } ;");
|
|
||||||
ASSERT_EQUALS(expected, sizeof_(code));
|
ASSERT_EQUALS(expected, sizeof_(code));
|
||||||
|
|
||||||
// Check for output..
|
// Check for output..
|
||||||
|
@ -4889,8 +4847,7 @@ private:
|
||||||
"vec2_t coords[4][5][6+1] = {1,2,3,4,5,6,7,8};\n";
|
"vec2_t coords[4][5][6+1] = {1,2,3,4,5,6,7,8};\n";
|
||||||
|
|
||||||
// The expected result..
|
// The expected result..
|
||||||
const std::string expected("; "
|
const std::string expected("int coords [ 4 ] [ 5 ] [ 7 ] [ 2 ] = { 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 } ;");
|
||||||
"int coords [ 4 ] [ 5 ] [ 7 ] [ 2 ] = { 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 } ;");
|
|
||||||
ASSERT_EQUALS(expected, sizeof_(code));
|
ASSERT_EQUALS(expected, sizeof_(code));
|
||||||
|
|
||||||
// Check for output..
|
// Check for output..
|
||||||
|
@ -4953,7 +4910,7 @@ private:
|
||||||
"}";
|
"}";
|
||||||
|
|
||||||
// The expected tokens..
|
// The expected tokens..
|
||||||
const std::string expected1("; void f ( ) { char a [ 256 ] ; char b [ 256 ] ; }");
|
const std::string expected1("void f ( ) { char a [ 256 ] ; char b [ 256 ] ; }");
|
||||||
ASSERT_EQUALS(expected1, sizeof_(code1, false));
|
ASSERT_EQUALS(expected1, sizeof_(code1, false));
|
||||||
|
|
||||||
// Check for output..
|
// Check for output..
|
||||||
|
@ -4967,7 +4924,7 @@ private:
|
||||||
"}";
|
"}";
|
||||||
|
|
||||||
// The expected tokens..
|
// The expected tokens..
|
||||||
const std::string expected2("; void f ( ) { char a [ 256 ] = { 0 } ; char b [ 256 ] = { 0 } ; }");
|
const std::string expected2("void f ( ) { char a [ 256 ] = { 0 } ; char b [ 256 ] = { 0 } ; }");
|
||||||
ASSERT_EQUALS(expected2, tok(code2, false));
|
ASSERT_EQUALS(expected2, tok(code2, false));
|
||||||
|
|
||||||
// Check for output..
|
// Check for output..
|
||||||
|
@ -4981,7 +4938,7 @@ private:
|
||||||
"}";
|
"}";
|
||||||
|
|
||||||
// The expected tokens..
|
// The expected tokens..
|
||||||
const std::string expected3("; void f ( ) { char a [ 256 ] = \"\" ; char b [ 256 ] = \"\" ; }");
|
const std::string expected3("void f ( ) { char a [ 256 ] = \"\" ; char b [ 256 ] = \"\" ; }");
|
||||||
ASSERT_EQUALS(expected3, tok(code3, false));
|
ASSERT_EQUALS(expected3, tok(code3, false));
|
||||||
|
|
||||||
// Check for output..
|
// Check for output..
|
||||||
|
@ -4995,7 +4952,7 @@ private:
|
||||||
"}";
|
"}";
|
||||||
|
|
||||||
// The expected tokens..
|
// The expected tokens..
|
||||||
const std::string expected4("; void f ( ) { char a [ 256 ] = \"1234\" ; char b [ 256 ] = \"5678\" ; }");
|
const std::string expected4("void f ( ) { char a [ 256 ] = \"1234\" ; char b [ 256 ] = \"5678\" ; }");
|
||||||
ASSERT_EQUALS(expected4, tok(code4, false));
|
ASSERT_EQUALS(expected4, tok(code4, false));
|
||||||
|
|
||||||
// Check for output..
|
// Check for output..
|
||||||
|
@ -5007,7 +4964,7 @@ private:
|
||||||
const char code[] = "typedef float x[3];\n"
|
const char code[] = "typedef float x[3];\n"
|
||||||
"x a,b,c;\n";
|
"x a,b,c;\n";
|
||||||
const std::string actual(sizeof_(code));
|
const std::string actual(sizeof_(code));
|
||||||
ASSERT_EQUALS("; float a [ 3 ] ; float b [ 3 ] ; float c [ 3 ] ;", actual);
|
ASSERT_EQUALS("float a [ 3 ] ; float b [ 3 ] ; float c [ 3 ] ;", actual);
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5015,7 +4972,7 @@ private:
|
||||||
const char code[] = "typedef __typeof__(__type1() + __type2()) __type;"
|
const char code[] = "typedef __typeof__(__type1() + __type2()) __type;"
|
||||||
"__type t;\n";
|
"__type t;\n";
|
||||||
const std::string actual(sizeof_(code));
|
const std::string actual(sizeof_(code));
|
||||||
ASSERT_EQUALS("; __typeof__ ( __type1 ( ) + __type2 ( ) ) t ;", actual);
|
ASSERT_EQUALS("__typeof__ ( __type1 ( ) + __type2 ( ) ) t ;", actual);
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5026,7 +4983,7 @@ private:
|
||||||
" return b > Foo(10); \n"
|
" return b > Foo(10); \n"
|
||||||
"}";
|
"}";
|
||||||
const std::string actual(sizeof_(code));
|
const std::string actual(sizeof_(code));
|
||||||
ASSERT_EQUALS("; int main ( ) { BAR < int > b ( 0 ) ; return b > BAR < int > ( 10 ) ; }", actual);
|
ASSERT_EQUALS("int main ( ) { BAR < int > b ( 0 ) ; return b > BAR < int > ( 10 ) ; }", actual);
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5042,8 +4999,7 @@ private:
|
||||||
"void f ( ) {\n"
|
"void f ( ) {\n"
|
||||||
" ((Function * (*) (char *, char *, int, int)) global[6]) ( \"assoc\", \"eggdrop\", 106, 0);\n"
|
" ((Function * (*) (char *, char *, int, int)) global[6]) ( \"assoc\", \"eggdrop\", 106, 0);\n"
|
||||||
"}\n";
|
"}\n";
|
||||||
const std::string expected = "; "
|
const std::string expected = "void f ( ) { "
|
||||||
"void f ( ) { "
|
|
||||||
"( ( int ( * * ( * ) ( char * , char * , int , int ) ) ( ) ) global [ 6 ] ) ( \"assoc\" , \"eggdrop\" , 106 , 0 ) ; "
|
"( ( int ( * * ( * ) ( char * , char * , int , int ) ) ( ) ) global [ 6 ] ) ( \"assoc\" , \"eggdrop\" , 106 , 0 ) ; "
|
||||||
"}";
|
"}";
|
||||||
ASSERT_EQUALS(expected, sizeof_(code));
|
ASSERT_EQUALS(expected, sizeof_(code));
|
||||||
|
@ -5064,8 +5020,7 @@ private:
|
||||||
"{\n"
|
"{\n"
|
||||||
" CompilerHook *(*compilerHookVector)(void);\n"
|
" CompilerHook *(*compilerHookVector)(void);\n"
|
||||||
"}VirtualMachine;\n";
|
"}VirtualMachine;\n";
|
||||||
const std::string expected = "; "
|
const std::string expected = "struct VirtualMachine "
|
||||||
"struct VirtualMachine "
|
|
||||||
"{ "
|
"{ "
|
||||||
"int ( * * ( * compilerHookVector ) ( void ) ) ( ) ; "
|
"int ( * * ( * compilerHookVector ) ( void ) ) ( ) ; "
|
||||||
"} ;";
|
"} ;";
|
||||||
|
@ -5076,8 +5031,7 @@ private:
|
||||||
void simplifyTypedef70() { // ticket #2348
|
void simplifyTypedef70() { // ticket #2348
|
||||||
const char code[] = "typedef int pread_f ( int ) ;\n"
|
const char code[] = "typedef int pread_f ( int ) ;\n"
|
||||||
"pread_f *(*test_func)(char *filename);\n";
|
"pread_f *(*test_func)(char *filename);\n";
|
||||||
const std::string expected = "; "
|
const std::string expected = "int ( * ( * test_func ) ( char * filename ) ) ( int ) ;";
|
||||||
"int ( * ( * test_func ) ( char * filename ) ) ( int ) ;";
|
|
||||||
ASSERT_EQUALS(expected, sizeof_(code));
|
ASSERT_EQUALS(expected, sizeof_(code));
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
}
|
}
|
||||||
|
@ -5086,16 +5040,14 @@ private:
|
||||||
{
|
{
|
||||||
const char code[] = "typedef int RexxFunctionHandler();\n"
|
const char code[] = "typedef int RexxFunctionHandler();\n"
|
||||||
"RexxFunctionHandler *(efuncs[1]);\n";
|
"RexxFunctionHandler *(efuncs[1]);\n";
|
||||||
const std::string expected = "; "
|
const std::string expected = "int ( * ( efuncs [ 1 ] ) ) ( ) ;";
|
||||||
"int ( * ( efuncs [ 1 ] ) ) ( ) ;";
|
|
||||||
ASSERT_EQUALS(expected, sizeof_(code));
|
ASSERT_EQUALS(expected, sizeof_(code));
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
const char code[] = "typedef int RexxFunctionHandler();\n"
|
const char code[] = "typedef int RexxFunctionHandler();\n"
|
||||||
"RexxFunctionHandler *(efuncs[]) = { NULL, NULL };\n";
|
"RexxFunctionHandler *(efuncs[]) = { NULL, NULL };\n";
|
||||||
const std::string expected = "; "
|
const std::string expected = "int ( * ( efuncs [ ] ) ) ( ) = { 0 , 0 } ;";
|
||||||
"int ( * ( efuncs [ ] ) ) ( ) = { 0 , 0 } ;";
|
|
||||||
ASSERT_EQUALS(expected, sizeof_(code));
|
ASSERT_EQUALS(expected, sizeof_(code));
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
}
|
}
|
||||||
|
@ -5178,8 +5130,7 @@ private:
|
||||||
"typedef state_func_t (*state_t)(void);\n"
|
"typedef state_func_t (*state_t)(void);\n"
|
||||||
"state_t current_state = death;\n"
|
"state_t current_state = death;\n"
|
||||||
"static char get_runlevel(const state_t);\n";
|
"static char get_runlevel(const state_t);\n";
|
||||||
const std::string expected = "; "
|
const std::string expected = "long ( * ( * current_state ) ( void ) ) ( void ) = death ; "
|
||||||
"long ( * ( * current_state ) ( void ) ) ( void ) = death ; "
|
|
||||||
"static char get_runlevel ( const long ( * ( * ) ( void ) ) ( void ) ) ;";
|
"static char get_runlevel ( const long ( * ( * ) ( void ) ) ( void ) ) ;";
|
||||||
ASSERT_EQUALS(expected, sizeof_(code));
|
ASSERT_EQUALS(expected, sizeof_(code));
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
@ -5201,7 +5152,7 @@ private:
|
||||||
|
|
||||||
void simplifyTypedef77() { // ticket #2554
|
void simplifyTypedef77() { // ticket #2554
|
||||||
const char code[] = "typedef char Str[10]; int x = sizeof(Str);\n";
|
const char code[] = "typedef char Str[10]; int x = sizeof(Str);\n";
|
||||||
const std::string expected = "; int x ; x = 10 ;";
|
const std::string expected = "int x ; x = 10 ;";
|
||||||
ASSERT_EQUALS(expected, sizeof_(code));
|
ASSERT_EQUALS(expected, sizeof_(code));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5210,7 +5161,7 @@ private:
|
||||||
"A_t a;\n"
|
"A_t a;\n"
|
||||||
"typedef struct A { } A_t;\n"
|
"typedef struct A { } A_t;\n"
|
||||||
"A_t a1;\n";
|
"A_t a1;\n";
|
||||||
const std::string expected = "; struct A a ; struct A { } ; struct A a1 ;";
|
const std::string expected = "struct A a ; struct A { } ; struct A a1 ;";
|
||||||
ASSERT_EQUALS(expected, sizeof_(code));
|
ASSERT_EQUALS(expected, sizeof_(code));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5220,8 +5171,7 @@ private:
|
||||||
"{\n"
|
"{\n"
|
||||||
" Tcl_ObjCmdProc * (*V_LangOptionCommand);\n"
|
" Tcl_ObjCmdProc * (*V_LangOptionCommand);\n"
|
||||||
"} LangVtab;\n";
|
"} LangVtab;\n";
|
||||||
const std::string expected = "; "
|
const std::string expected = "struct LangVtab "
|
||||||
"struct LangVtab "
|
|
||||||
"{ "
|
"{ "
|
||||||
"int ( * ( * V_LangOptionCommand ) ) ( int x ) ; "
|
"int ( * ( * V_LangOptionCommand ) ) ( int x ) ; "
|
||||||
"} ;";
|
"} ;";
|
||||||
|
@ -5274,8 +5224,7 @@ private:
|
||||||
"void f(Str &cl) { }\n";
|
"void f(Str &cl) { }\n";
|
||||||
|
|
||||||
// The expected result..
|
// The expected result..
|
||||||
const std::string expected("; "
|
const std::string expected("void f ( char ( & cl ) [ 10 ] ) { }");
|
||||||
"void f ( char ( & cl ) [ 10 ] ) { }");
|
|
||||||
|
|
||||||
ASSERT_EQUALS(expected, sizeof_(code));
|
ASSERT_EQUALS(expected, sizeof_(code));
|
||||||
}
|
}
|
||||||
|
@ -5350,7 +5299,7 @@ private:
|
||||||
void simplifyTypedef90() { // ticket #2718
|
void simplifyTypedef90() { // ticket #2718
|
||||||
const char code[] = "typedef int IA[2];\n"
|
const char code[] = "typedef int IA[2];\n"
|
||||||
"void f(const IA&) {};\n";
|
"void f(const IA&) {};\n";
|
||||||
const char expected[] = "; void f ( const int ( & ) [ 2 ] ) { } ;";
|
const char expected[] = "void f ( const int ( & ) [ 2 ] ) { } ;";
|
||||||
checkSimplifyTypedef(code);
|
checkSimplifyTypedef(code);
|
||||||
ASSERT_EQUALS(expected, sizeof_(code));
|
ASSERT_EQUALS(expected, sizeof_(code));
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
@ -5458,8 +5407,7 @@ private:
|
||||||
const char code[] = "typedef long Long;\n"
|
const char code[] = "typedef long Long;\n"
|
||||||
"namespace NS {\n"
|
"namespace NS {\n"
|
||||||
"}\n";
|
"}\n";
|
||||||
const char expected[] = "; "
|
const char expected[] = "namespace NS { "
|
||||||
"namespace NS { "
|
|
||||||
"}";
|
"}";
|
||||||
|
|
||||||
checkSimplifyTypedef(code);
|
checkSimplifyTypedef(code);
|
||||||
|
@ -5636,8 +5584,7 @@ private:
|
||||||
"std::queue<my_func> func_queue;";
|
"std::queue<my_func> func_queue;";
|
||||||
|
|
||||||
// The expected result..
|
// The expected result..
|
||||||
const std::string expected("; "
|
const std::string expected("std :: queue < void ( * ) ( ) > func_queue ;");
|
||||||
"std :: queue < void ( * ) ( ) > func_queue ;");
|
|
||||||
ASSERT_EQUALS(expected, sizeof_(code));
|
ASSERT_EQUALS(expected, sizeof_(code));
|
||||||
|
|
||||||
// Check for output..
|
// Check for output..
|
||||||
|
@ -5650,8 +5597,7 @@ private:
|
||||||
"std::queue<my_func> func_queue;";
|
"std::queue<my_func> func_queue;";
|
||||||
|
|
||||||
// The expected result..
|
// The expected result..
|
||||||
const std::string expected("; "
|
const std::string expected("std :: queue < void ( * ) ( void ) > func_queue ;");
|
||||||
"std :: queue < void ( * ) ( void ) > func_queue ;");
|
|
||||||
ASSERT_EQUALS(expected, sizeof_(code));
|
ASSERT_EQUALS(expected, sizeof_(code));
|
||||||
|
|
||||||
// Check for output..
|
// Check for output..
|
||||||
|
@ -5664,8 +5610,7 @@ private:
|
||||||
"std::queue<my_func> func_queue;";
|
"std::queue<my_func> func_queue;";
|
||||||
|
|
||||||
// The expected result..
|
// The expected result..
|
||||||
const std::string expected("; "
|
const std::string expected("std :: queue < void ( * ) ( int ) > func_queue ;");
|
||||||
"std :: queue < void ( * ) ( int ) > func_queue ;");
|
|
||||||
ASSERT_EQUALS(expected, sizeof_(code));
|
ASSERT_EQUALS(expected, sizeof_(code));
|
||||||
|
|
||||||
// Check for output..
|
// Check for output..
|
||||||
|
@ -5678,8 +5623,7 @@ private:
|
||||||
"std::queue<my_func> func_queue;";
|
"std::queue<my_func> func_queue;";
|
||||||
|
|
||||||
// The expected result..
|
// The expected result..
|
||||||
const std::string expected("; "
|
const std::string expected("std :: queue < void ( * ) ( int * ) > func_queue ;");
|
||||||
"std :: queue < void ( * ) ( int * ) > func_queue ;");
|
|
||||||
ASSERT_EQUALS(expected, sizeof_(code));
|
ASSERT_EQUALS(expected, sizeof_(code));
|
||||||
|
|
||||||
// Check for output..
|
// Check for output..
|
||||||
|
@ -5693,8 +5637,7 @@ private:
|
||||||
"std::queue<my_func> func_queue;";
|
"std::queue<my_func> func_queue;";
|
||||||
|
|
||||||
// The expected result..
|
// The expected result..
|
||||||
const std::string expected("; "
|
const std::string expected("std :: queue < void ( * ) ( arg_class * ) > func_queue ;");
|
||||||
"std :: queue < void ( * ) ( arg_class * ) > func_queue ;");
|
|
||||||
ASSERT_EQUALS(expected, sizeof_(code));
|
ASSERT_EQUALS(expected, sizeof_(code));
|
||||||
|
|
||||||
// Check for output..
|
// Check for output..
|
||||||
|
@ -5708,8 +5651,7 @@ private:
|
||||||
"std::queue<my_func *> func_queue;";
|
"std::queue<my_func *> func_queue;";
|
||||||
|
|
||||||
// The expected result..
|
// The expected result..
|
||||||
const std::string expected("; "
|
const std::string expected("std :: queue < void ( * ) ( ) > func_queue ;");
|
||||||
"std :: queue < void ( * ) ( ) > func_queue ;");
|
|
||||||
ASSERT_EQUALS(expected, sizeof_(code));
|
ASSERT_EQUALS(expected, sizeof_(code));
|
||||||
|
|
||||||
// Check for output..
|
// Check for output..
|
||||||
|
@ -5722,8 +5664,7 @@ private:
|
||||||
"std::queue<my_func *> func_queue;";
|
"std::queue<my_func *> func_queue;";
|
||||||
|
|
||||||
// The expected result..
|
// The expected result..
|
||||||
const std::string expected("; "
|
const std::string expected("std :: queue < void ( * ) ( void ) > func_queue ;");
|
||||||
"std :: queue < void ( * ) ( void ) > func_queue ;");
|
|
||||||
ASSERT_EQUALS(expected, sizeof_(code));
|
ASSERT_EQUALS(expected, sizeof_(code));
|
||||||
|
|
||||||
// Check for output..
|
// Check for output..
|
||||||
|
@ -5736,8 +5677,7 @@ private:
|
||||||
"std::queue<my_func *> func_queue;";
|
"std::queue<my_func *> func_queue;";
|
||||||
|
|
||||||
// The expected result..
|
// The expected result..
|
||||||
const std::string expected("; "
|
const std::string expected("std :: queue < void ( * ) ( int ) > func_queue ;");
|
||||||
"std :: queue < void ( * ) ( int ) > func_queue ;");
|
|
||||||
ASSERT_EQUALS(expected, sizeof_(code));
|
ASSERT_EQUALS(expected, sizeof_(code));
|
||||||
|
|
||||||
// Check for output..
|
// Check for output..
|
||||||
|
@ -5750,8 +5690,7 @@ private:
|
||||||
"std::queue<my_func *> func_queue;";
|
"std::queue<my_func *> func_queue;";
|
||||||
|
|
||||||
// The expected result..
|
// The expected result..
|
||||||
const std::string expected("; "
|
const std::string expected("std :: queue < void ( * ) ( int * ) > func_queue ;");
|
||||||
"std :: queue < void ( * ) ( int * ) > func_queue ;");
|
|
||||||
ASSERT_EQUALS(expected, sizeof_(code));
|
ASSERT_EQUALS(expected, sizeof_(code));
|
||||||
|
|
||||||
// Check for output..
|
// Check for output..
|
||||||
|
@ -5764,8 +5703,7 @@ private:
|
||||||
"std::queue<my_func *> func_queue;";
|
"std::queue<my_func *> func_queue;";
|
||||||
|
|
||||||
// The expected result..
|
// The expected result..
|
||||||
const std::string expected("; "
|
const std::string expected("std :: queue < void ( * ) ( arg_class * ) > func_queue ;");
|
||||||
"std :: queue < void ( * ) ( arg_class * ) > func_queue ;");
|
|
||||||
ASSERT_EQUALS(expected, sizeof_(code));
|
ASSERT_EQUALS(expected, sizeof_(code));
|
||||||
|
|
||||||
// Check for output..
|
// Check for output..
|
||||||
|
@ -5779,8 +5717,7 @@ private:
|
||||||
"std::queue<my_func *> func_queue;";
|
"std::queue<my_func *> func_queue;";
|
||||||
|
|
||||||
// The expected result..
|
// The expected result..
|
||||||
const std::string expected("; "
|
const std::string expected("std :: queue < void ( * ) ( ) > func_queue ;");
|
||||||
"std :: queue < void ( * ) ( ) > func_queue ;");
|
|
||||||
ASSERT_EQUALS(expected, sizeof_(code));
|
ASSERT_EQUALS(expected, sizeof_(code));
|
||||||
|
|
||||||
// Check for output..
|
// Check for output..
|
||||||
|
@ -5793,8 +5730,7 @@ private:
|
||||||
"std::queue<my_func *> func_queue;";
|
"std::queue<my_func *> func_queue;";
|
||||||
|
|
||||||
// The expected result..
|
// The expected result..
|
||||||
const std::string expected("; "
|
const std::string expected("std :: queue < void ( * ) ( void ) > func_queue ;");
|
||||||
"std :: queue < void ( * ) ( void ) > func_queue ;");
|
|
||||||
ASSERT_EQUALS(expected, sizeof_(code));
|
ASSERT_EQUALS(expected, sizeof_(code));
|
||||||
|
|
||||||
// Check for output..
|
// Check for output..
|
||||||
|
@ -5807,8 +5743,7 @@ private:
|
||||||
"std::queue<my_func *> func_queue;";
|
"std::queue<my_func *> func_queue;";
|
||||||
|
|
||||||
// The expected result..
|
// The expected result..
|
||||||
const std::string expected("; "
|
const std::string expected("std :: queue < void ( * ) ( int ) > func_queue ;");
|
||||||
"std :: queue < void ( * ) ( int ) > func_queue ;");
|
|
||||||
ASSERT_EQUALS(expected, sizeof_(code));
|
ASSERT_EQUALS(expected, sizeof_(code));
|
||||||
|
|
||||||
// Check for output..
|
// Check for output..
|
||||||
|
@ -5821,8 +5756,7 @@ private:
|
||||||
"std::queue<my_func *> func_queue;";
|
"std::queue<my_func *> func_queue;";
|
||||||
|
|
||||||
// The expected result..
|
// The expected result..
|
||||||
const std::string expected("; "
|
const std::string expected("std :: queue < void ( * ) ( int * ) > func_queue ;");
|
||||||
"std :: queue < void ( * ) ( int * ) > func_queue ;");
|
|
||||||
ASSERT_EQUALS(expected, sizeof_(code));
|
ASSERT_EQUALS(expected, sizeof_(code));
|
||||||
|
|
||||||
// Check for output..
|
// Check for output..
|
||||||
|
@ -5835,8 +5769,7 @@ private:
|
||||||
"std::queue<my_func *> func_queue;";
|
"std::queue<my_func *> func_queue;";
|
||||||
|
|
||||||
// The expected result..
|
// The expected result..
|
||||||
const std::string expected("; "
|
const std::string expected("std :: queue < void ( * ) ( arg_class * ) > func_queue ;");
|
||||||
"std :: queue < void ( * ) ( arg_class * ) > func_queue ;");
|
|
||||||
ASSERT_EQUALS(expected, sizeof_(code));
|
ASSERT_EQUALS(expected, sizeof_(code));
|
||||||
|
|
||||||
// Check for output..
|
// Check for output..
|
||||||
|
@ -5850,8 +5783,7 @@ private:
|
||||||
"std::queue<my_func *> func_queue;";
|
"std::queue<my_func *> func_queue;";
|
||||||
|
|
||||||
// The expected result..
|
// The expected result..
|
||||||
const std::string expected("; "
|
const std::string expected("std :: queue < void ( * ) ( ) > func_queue ;");
|
||||||
"std :: queue < void ( * ) ( ) > func_queue ;");
|
|
||||||
ASSERT_EQUALS(expected, sizeof_(code));
|
ASSERT_EQUALS(expected, sizeof_(code));
|
||||||
|
|
||||||
// Check for output..
|
// Check for output..
|
||||||
|
@ -5864,8 +5796,7 @@ private:
|
||||||
"std::queue<my_func *> func_queue;";
|
"std::queue<my_func *> func_queue;";
|
||||||
|
|
||||||
// The expected result..
|
// The expected result..
|
||||||
const std::string expected("; "
|
const std::string expected("std :: queue < void ( * ) ( void ) > func_queue ;");
|
||||||
"std :: queue < void ( * ) ( void ) > func_queue ;");
|
|
||||||
ASSERT_EQUALS(expected, sizeof_(code));
|
ASSERT_EQUALS(expected, sizeof_(code));
|
||||||
|
|
||||||
// Check for output..
|
// Check for output..
|
||||||
|
@ -5878,8 +5809,7 @@ private:
|
||||||
"std::queue<my_func *> func_queue;";
|
"std::queue<my_func *> func_queue;";
|
||||||
|
|
||||||
// The expected result..
|
// The expected result..
|
||||||
const std::string expected("; "
|
const std::string expected("std :: queue < void ( * ) ( int ) > func_queue ;");
|
||||||
"std :: queue < void ( * ) ( int ) > func_queue ;");
|
|
||||||
ASSERT_EQUALS(expected, sizeof_(code));
|
ASSERT_EQUALS(expected, sizeof_(code));
|
||||||
|
|
||||||
// Check for output..
|
// Check for output..
|
||||||
|
@ -5892,8 +5822,7 @@ private:
|
||||||
"std::queue<my_func *> func_queue;";
|
"std::queue<my_func *> func_queue;";
|
||||||
|
|
||||||
// The expected result..
|
// The expected result..
|
||||||
const std::string expected("; "
|
const std::string expected("std :: queue < void ( * ) ( int * ) > func_queue ;");
|
||||||
"std :: queue < void ( * ) ( int * ) > func_queue ;");
|
|
||||||
ASSERT_EQUALS(expected, sizeof_(code));
|
ASSERT_EQUALS(expected, sizeof_(code));
|
||||||
|
|
||||||
// Check for output..
|
// Check for output..
|
||||||
|
@ -5906,8 +5835,7 @@ private:
|
||||||
"std::queue<my_func *> func_queue;";
|
"std::queue<my_func *> func_queue;";
|
||||||
|
|
||||||
// The expected result..
|
// The expected result..
|
||||||
const std::string expected("; "
|
const std::string expected("std :: queue < void ( * ) ( arg_class * ) > func_queue ;");
|
||||||
"std :: queue < void ( * ) ( arg_class * ) > func_queue ;");
|
|
||||||
ASSERT_EQUALS(expected, sizeof_(code));
|
ASSERT_EQUALS(expected, sizeof_(code));
|
||||||
|
|
||||||
// Check for output..
|
// Check for output..
|
||||||
|
@ -5921,8 +5849,7 @@ private:
|
||||||
"voidfn xxx;";
|
"voidfn xxx;";
|
||||||
|
|
||||||
// The expected result..
|
// The expected result..
|
||||||
const std::string expected("; "
|
const std::string expected("void xxx ( int ) ;");
|
||||||
"void xxx ( int ) ;");
|
|
||||||
ASSERT_EQUALS(expected, sizeof_(code));
|
ASSERT_EQUALS(expected, sizeof_(code));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5944,8 +5871,7 @@ private:
|
||||||
"func7 f7;";
|
"func7 f7;";
|
||||||
|
|
||||||
// The expected result..
|
// The expected result..
|
||||||
const std::string expected("; "
|
const std::string expected("C f1 ( ) ; "
|
||||||
"C f1 ( ) ; "
|
|
||||||
"C * f2 ; " // this gets simplified to a regular pointer
|
"C * f2 ; " // this gets simplified to a regular pointer
|
||||||
"C ( & f3 ) ( ) ; "
|
"C ( & f3 ) ( ) ; "
|
||||||
"C ( C :: * f4 ) ( ) ; "
|
"C ( C :: * f4 ) ( ) ; "
|
||||||
|
@ -5976,8 +5902,7 @@ private:
|
||||||
|
|
||||||
// The expected result..
|
// The expected result..
|
||||||
// C const -> const C
|
// C const -> const C
|
||||||
const std::string expected("; "
|
const std::string expected("const C f1 ( ) ; "
|
||||||
"const C f1 ( ) ; "
|
|
||||||
"const C * f2 ; " // this gets simplified to a regular pointer
|
"const C * f2 ; " // this gets simplified to a regular pointer
|
||||||
"const C ( & f3 ) ( ) ; "
|
"const C ( & f3 ) ( ) ; "
|
||||||
"const C ( C :: * f4 ) ( ) ; "
|
"const C ( C :: * f4 ) ( ) ; "
|
||||||
|
@ -6007,8 +5932,7 @@ private:
|
||||||
"func7 f7;";
|
"func7 f7;";
|
||||||
|
|
||||||
// The expected result..
|
// The expected result..
|
||||||
const std::string expected("; "
|
const std::string expected("const C f1 ( ) ; "
|
||||||
"const C f1 ( ) ; "
|
|
||||||
"const C * f2 ; " // this gets simplified to a regular pointer
|
"const C * f2 ; " // this gets simplified to a regular pointer
|
||||||
"const C ( & f3 ) ( ) ; "
|
"const C ( & f3 ) ( ) ; "
|
||||||
"const C ( C :: * f4 ) ( ) ; "
|
"const C ( C :: * f4 ) ( ) ; "
|
||||||
|
@ -6038,8 +5962,7 @@ private:
|
||||||
"func7 f7;";
|
"func7 f7;";
|
||||||
|
|
||||||
// The expected result..
|
// The expected result..
|
||||||
const std::string expected("; "
|
const std::string expected("C * f1 ( ) ; "
|
||||||
"C * f1 ( ) ; "
|
|
||||||
"C * * f2 ; " // this gets simplified to a regular pointer
|
"C * * f2 ; " // this gets simplified to a regular pointer
|
||||||
"C * ( & f3 ) ( ) ; "
|
"C * ( & f3 ) ( ) ; "
|
||||||
"C * ( C :: * f4 ) ( ) ; "
|
"C * ( C :: * f4 ) ( ) ; "
|
||||||
|
@ -6069,8 +5992,7 @@ private:
|
||||||
"func7 f7;";
|
"func7 f7;";
|
||||||
|
|
||||||
// The expected result..
|
// The expected result..
|
||||||
const std::string expected("; "
|
const std::string expected("const C * f1 ( ) ; "
|
||||||
"const C * f1 ( ) ; "
|
|
||||||
"const C * * f2 ; " // this gets simplified to a regular pointer
|
"const C * * f2 ; " // this gets simplified to a regular pointer
|
||||||
"const C * ( & f3 ) ( ) ; "
|
"const C * ( & f3 ) ( ) ; "
|
||||||
"const C * ( C :: * f4 ) ( ) ; "
|
"const C * ( C :: * f4 ) ( ) ; "
|
||||||
|
@ -6101,8 +6023,7 @@ private:
|
||||||
|
|
||||||
// The expected result..
|
// The expected result..
|
||||||
// C const -> const C
|
// C const -> const C
|
||||||
const std::string expected("; "
|
const std::string expected("const C * f1 ( ) ; "
|
||||||
"const C * f1 ( ) ; "
|
|
||||||
"const C * * f2 ; " // this gets simplified to a regular pointer
|
"const C * * f2 ; " // this gets simplified to a regular pointer
|
||||||
"const C * ( & f3 ) ( ) ; "
|
"const C * ( & f3 ) ( ) ; "
|
||||||
"const C * ( C :: * f4 ) ( ) ; "
|
"const C * ( C :: * f4 ) ( ) ; "
|
||||||
|
@ -6125,8 +6046,7 @@ private:
|
||||||
"type3 t3;";
|
"type3 t3;";
|
||||||
|
|
||||||
// The expected result..
|
// The expected result..
|
||||||
const std::string expected("; "
|
const std::string expected("int ( * ( * t1 ) ( bool ) ) ( int , int ) ; "
|
||||||
"int ( * ( * t1 ) ( bool ) ) ( int , int ) ; "
|
|
||||||
"int ( * t2 ( bool ) ) ( int , int ) ; "
|
"int ( * t2 ( bool ) ) ( int , int ) ; "
|
||||||
"int ( * t3 ( bool ) ) ( int , int ) ;");
|
"int ( * t3 ( bool ) ) ( int , int ) ;");
|
||||||
ASSERT_EQUALS(expected, tok(code, false));
|
ASSERT_EQUALS(expected, tok(code, false));
|
||||||
|
@ -6162,8 +6082,7 @@ private:
|
||||||
"type12 t12;";
|
"type12 t12;";
|
||||||
|
|
||||||
// The expected result..
|
// The expected result..
|
||||||
const std::string expected("; "
|
const std::string expected("int * t1 ; " // simplified to regular pointer
|
||||||
"int * t1 ; " // simplified to regular pointer
|
|
||||||
"int ( * const t2 ) ( float ) ; "
|
"int ( * const t2 ) ( float ) ; "
|
||||||
"int * t3 ; " // volatile removed, gets simplified to regular pointer
|
"int * t3 ; " // volatile removed, gets simplified to regular pointer
|
||||||
"int ( * const t4 ) ( float ) ; " // volatile removed
|
"int ( * const t4 ) ( float ) ; " // volatile removed
|
||||||
|
@ -6194,8 +6113,7 @@ private:
|
||||||
"void ( * Fred::get4 ( ) ) ( ) { return 0 ; }\n";
|
"void ( * Fred::get4 ( ) ) ( ) { return 0 ; }\n";
|
||||||
|
|
||||||
// The expected result..
|
// The expected result..
|
||||||
const std::string expected("; "
|
const std::string expected("struct Fred "
|
||||||
"struct Fred "
|
|
||||||
"{ "
|
"{ "
|
||||||
"void ( * get1 ( ) ) ( ) { return 0 ; } "
|
"void ( * get1 ( ) ) ( ) { return 0 ; } "
|
||||||
"void ( * get2 ( ) ) ( ) { return 0 ; } "
|
"void ( * get2 ( ) ) ( ) { return 0 ; } "
|
||||||
|
@ -6216,8 +6134,7 @@ private:
|
||||||
"_func_Tp_SGIAssignableConcept X;\n";
|
"_func_Tp_SGIAssignableConcept X;\n";
|
||||||
|
|
||||||
// The expected result..
|
// The expected result..
|
||||||
const std::string expected("; "
|
const std::string expected("void ( __gnu_cxx :: _SGIAssignableConcept < _Tp > :: * X ) ( ) ;");
|
||||||
"void ( __gnu_cxx :: _SGIAssignableConcept < _Tp > :: * X ) ( ) ;");
|
|
||||||
|
|
||||||
ASSERT_EQUALS(expected, tok(code, false));
|
ASSERT_EQUALS(expected, tok(code, false));
|
||||||
|
|
||||||
|
@ -7355,7 +7272,7 @@ private:
|
||||||
ASSERT_EQUALS("int * p ;", tok("int * restrict p;", true));
|
ASSERT_EQUALS("int * p ;", tok("int * restrict p;", true));
|
||||||
ASSERT_EQUALS("int * * p ;", tok("int * restrict * p;", true));
|
ASSERT_EQUALS("int * * p ;", tok("int * restrict * p;", true));
|
||||||
ASSERT_EQUALS("void foo ( float * a , float * b ) ;", tok("void foo(float * restrict a, float * restrict b);", true));
|
ASSERT_EQUALS("void foo ( float * a , float * b ) ;", tok("void foo(float * restrict a, float * restrict b);", true));
|
||||||
ASSERT_EQUALS("; int * p ;", tok("typedef int * __restrict__ rint; rint p;", true));
|
ASSERT_EQUALS("int * p ;", tok("typedef int * __restrict__ rint; rint p;", true));
|
||||||
}
|
}
|
||||||
|
|
||||||
void simplifyCallingConvention() {
|
void simplifyCallingConvention() {
|
||||||
|
@ -7398,8 +7315,7 @@ private:
|
||||||
" testfp get3();\n"
|
" testfp get3();\n"
|
||||||
" void ( * get4 ( ) ) ( );\n"
|
" void ( * get4 ( ) ) ( );\n"
|
||||||
"};";
|
"};";
|
||||||
const char expected[] = "; "
|
const char expected[] = "struct Fred "
|
||||||
"struct Fred "
|
|
||||||
"{ "
|
"{ "
|
||||||
"void ( * get1 ( ) ) ( ) { return 0 ; } "
|
"void ( * get1 ( ) ) ( ) { return 0 ; } "
|
||||||
"void ( * get2 ( ) ) ( ) { return 0 ; } "
|
"void ( * get2 ( ) ) ( ) { return 0 ; } "
|
||||||
|
|
|
@ -3684,7 +3684,7 @@ private:
|
||||||
|
|
||||||
const std::string expected("\n\n"
|
const std::string expected("\n\n"
|
||||||
"##file 0\n"
|
"##file 0\n"
|
||||||
"1: ; class A {\n"
|
"1: class A {\n"
|
||||||
"2: public:\n"
|
"2: public:\n"
|
||||||
"3: void f ( char ( & cl ) [ 10 ] ) ;\n"
|
"3: void f ( char ( & cl ) [ 10 ] ) ;\n"
|
||||||
"4: void g ( char cl@1 [ 10 ] ) ;\n"
|
"4: void g ( char cl@1 [ 10 ] ) ;\n"
|
||||||
|
@ -4948,8 +4948,7 @@ private:
|
||||||
"void f1 ( ) { }"
|
"void f1 ( ) { }"
|
||||||
"PF pf = &f1;"
|
"PF pf = &f1;"
|
||||||
"PF pfs[] = { &f1, &f1 };";
|
"PF pfs[] = { &f1, &f1 };";
|
||||||
const char expected[] = "; "
|
const char expected[] = " void f1(){} "
|
||||||
"void f1(){} "
|
|
||||||
"void* pf; pf=& f1; "
|
"void* pf; pf=& f1; "
|
||||||
"void* pfs[]={& f1,& f1};";
|
"void* pfs[]={& f1,& f1};";
|
||||||
ASSERT_EQUALS(expected, simplifyFunctionPointers(code));
|
ASSERT_EQUALS(expected, simplifyFunctionPointers(code));
|
||||||
|
|
Loading…
Reference in New Issue