This patch simplifies the function pointer return type code and allows more complex return types.
This commit is contained in:
parent
e9e64033e7
commit
9f0b9551cf
|
@ -644,10 +644,6 @@ void Tokenizer::simplifyTypedef()
|
|||
}
|
||||
}
|
||||
}
|
||||
else if (functionPtr)
|
||||
{
|
||||
tok2->str(type1);
|
||||
}
|
||||
else
|
||||
{
|
||||
tok2->str(type1);
|
||||
|
|
|
@ -2693,6 +2693,41 @@ private:
|
|||
ASSERT_EQUALS(expected, tok(code, false));
|
||||
}
|
||||
|
||||
{
|
||||
const char code[] = "class Fred {\n"
|
||||
" typedef unsigned int * (*testfp)(unsigned int *);\n"
|
||||
" testfp get() { return test; }\n"
|
||||
" static unsigned int * test(unsigned int * p) { return p; }\n"
|
||||
"};\n";
|
||||
|
||||
const char expected[] =
|
||||
"class Fred { "
|
||||
"; "
|
||||
"unsigned int * ( * get ( ) ) ( unsigned int * ) { return test ; } "
|
||||
"static unsigned int * test ( unsigned int * p ) { return p ; } "
|
||||
"} ;";
|
||||
|
||||
ASSERT_EQUALS(expected, tok(code, false));
|
||||
}
|
||||
|
||||
{
|
||||
const char code[] = "class Fred {\n"
|
||||
" typedef const unsigned int * (*testfp)(const unsigned int *);\n"
|
||||
" testfp get() { return test; }\n"
|
||||
" static const unsigned int * test(const unsigned int * p) { return p; }\n"
|
||||
"};\n";
|
||||
|
||||
// static const gets changed to const static
|
||||
const char expected[] =
|
||||
"class Fred { "
|
||||
"; "
|
||||
"const unsigned int * ( * get ( ) ) ( const unsigned int * ) { return test ; } "
|
||||
"const static unsigned int * test ( const unsigned int * p ) { return p ; } "
|
||||
"} ;";
|
||||
|
||||
ASSERT_EQUALS(expected, tok(code, false));
|
||||
}
|
||||
|
||||
{
|
||||
const char code[] = "class Fred {\n"
|
||||
" typedef void * (*testfp)(void *);\n"
|
||||
|
|
Loading…
Reference in New Issue