parent
36ffa91825
commit
817c748e4d
|
@ -1523,8 +1523,8 @@ void Tokenizer::simplifyTypedef()
|
||||||
if (tok2->str() == "const")
|
if (tok2->str() == "const")
|
||||||
tok2 = tok2->next();
|
tok2 = tok2->next();
|
||||||
|
|
||||||
// reference to array?
|
// reference or pointer to array?
|
||||||
if (tok2->str() == "&") {
|
if (tok2->str() == "&" || tok2->str() == "*") {
|
||||||
tok2 = tok2->previous();
|
tok2 = tok2->previous();
|
||||||
tok2->insertToken("(");
|
tok2->insertToken("(");
|
||||||
Token *tok3 = tok2->next();
|
Token *tok3 = tok2->next();
|
||||||
|
|
|
@ -163,6 +163,7 @@ private:
|
||||||
TEST_CASE(simplifyTypedef123); // ticket #7406
|
TEST_CASE(simplifyTypedef123); // ticket #7406
|
||||||
TEST_CASE(simplifyTypedef124); // ticket #7792
|
TEST_CASE(simplifyTypedef124); // ticket #7792
|
||||||
TEST_CASE(simplifyTypedef125); // #8749 - typedef char A[10]; p = new A[1];
|
TEST_CASE(simplifyTypedef125); // #8749 - typedef char A[10]; p = new A[1];
|
||||||
|
TEST_CASE(simplifyTypedef126); // ticket #5953
|
||||||
|
|
||||||
TEST_CASE(simplifyTypedefFunction1);
|
TEST_CASE(simplifyTypedefFunction1);
|
||||||
TEST_CASE(simplifyTypedefFunction2); // ticket #1685
|
TEST_CASE(simplifyTypedefFunction2); // ticket #1685
|
||||||
|
@ -2532,6 +2533,13 @@ private:
|
||||||
ASSERT_EQUALS(exp, tok(code, false));
|
ASSERT_EQUALS(exp, tok(code, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void simplifyTypedef126() { // #5953
|
||||||
|
const char code[] = "typedef char automap_data_t[100];\n"
|
||||||
|
"void write_array(automap_data_t *data) {}";
|
||||||
|
const char exp [] = "void write_array ( char ( * data ) [ 100 ] ) { }";
|
||||||
|
ASSERT_EQUALS(exp, tok(code, false));
|
||||||
|
}
|
||||||
|
|
||||||
void simplifyTypedefFunction1() {
|
void simplifyTypedefFunction1() {
|
||||||
{
|
{
|
||||||
const char code[] = "typedef void (*my_func)();\n"
|
const char code[] = "typedef void (*my_func)();\n"
|
||||||
|
|
Loading…
Reference in New Issue