@@ -725,8 +725,8 @@ class TestSimplifyTypedef : public TestFixture {
725725 " void addCallback1(Callback callback, int j) { }" ;
726726
727727 const char expected[] =
728- " void addCallback ( bool * callback ) { } "
729- " void addCallback1 ( bool * callback , int j ) { }" ;
728+ " void addCallback ( bool ( * callback ) ( ) ) { } "
729+ " void addCallback1 ( bool ( * callback ) ( ) , int j ) { }" ;
730730
731731 ASSERT_EQUALS (expected, tok (code, false ));
732732 }
@@ -740,9 +740,9 @@ class TestSimplifyTypedef : public TestFixture {
740740 " }" ;
741741
742742 const char expected[] =
743- " void g ( int * f ) "
743+ " void g ( int ( * f ) ( ) ) "
744744 " { "
745- " int * f2 ; f2 = ( int * ) f ; "
745+ " int ( * f2 ) ( ) ; f2 = ( int * ) f ; "
746746 " }" ;
747747
748748 ASSERT_EQUALS (expected, tok (code, false ));
@@ -756,9 +756,9 @@ class TestSimplifyTypedef : public TestFixture {
756756 " }" ;
757757
758758 const char expected[] =
759- " void g ( int * f ) "
759+ " void g ( int ( * f ) ( ) ) "
760760 " { "
761- " int * f2 ; f2 = static_cast < int * > ( f ) ; "
761+ " int ( * f2 ) ( ) ; f2 = static_cast < int * > ( f ) ; "
762762 " }" ;
763763
764764 ASSERT_EQUALS (expected, tok (code, false ));
@@ -1078,7 +1078,7 @@ class TestSimplifyTypedef : public TestFixture {
10781078 " class X { } ; "
10791079 " int main ( ) "
10801080 " { "
1081- " X * * Foo ; Foo = new X ( * ) ( const X & ) [ 2 ] ; "
1081+ " X ( * * Foo ) ( ) ; Foo = new X ( * ) ( const X & ) [ 2 ] ; "
10821082 " }" ;
10831083
10841084 ASSERT_EQUALS (expected, tok (code, false ));
@@ -1354,7 +1354,7 @@ class TestSimplifyTypedef : public TestFixture {
13541354 " F f;" ;
13551355
13561356 // The expected result..
1357- const char expected[] = " void * f ;" ;
1357+ const char expected[] = " void ( * f ) ( ) ;" ;
13581358 ASSERT_EQUALS (expected, tok (code));
13591359 }
13601360 }
@@ -1489,7 +1489,7 @@ class TestSimplifyTypedef : public TestFixture {
14891489 // The expected result..
14901490 const char expected[] = " struct C { "
14911491 " "
1492- " const void * pr ; " // this gets simplified to a regular pointer
1492+ " const void ( * pr ) ( ) ; "
14931493 " operatorconstvoid(*)()& ( ) { return pr ; } "
14941494 " } ;" ;
14951495 ASSERT_EQUALS (expected, tok (code));
@@ -1552,7 +1552,7 @@ class TestSimplifyTypedef : public TestFixture {
15521552 " localEntitiyAddFunc_t f;\n "
15531553 " }" ;
15541554 // The expected result..
1555- const char expected[] = " enum qboolean { qfalse , qtrue } ; void f ( ) { qboolean b ; qboolean * f ; }" ;
1555+ const char expected[] = " enum qboolean { qfalse , qtrue } ; void f ( ) { qboolean b ; qboolean ( * f ) ( ) ; }" ;
15561556 ASSERT_EQUALS (expected, tok (code, false ));
15571557 ASSERT_EQUALS (" " , errout.str ());
15581558 }
@@ -1669,7 +1669,7 @@ class TestSimplifyTypedef : public TestFixture {
16691669 const char code[] = " typedef FMAC1 void (* a) ();\n "
16701670 " void *(*b) ();" ;
16711671 const std::string actual (tok (code));
1672- ASSERT_EQUALS (" void * * b ;" , actual);
1672+ ASSERT_EQUALS (" void * ( * b ) ( ) ;" , actual);
16731673 ASSERT_EQUALS (" " , errout.str ());
16741674 }
16751675
@@ -2120,7 +2120,7 @@ class TestSimplifyTypedef : public TestFixture {
21202120 " };" ;
21212121 const char expected[] = " class symbol_table { "
21222122 " public: "
2123- " expression_error :: error_code * f ; "
2123+ " expression_error :: error_code ( * f ) ( ) ; "
21242124 " } ;" ;
21252125 ASSERT_EQUALS (expected, tok (code, true , Settings::Native, false ));
21262126 ASSERT_EQUALS (" " , errout.str ());
@@ -2867,12 +2867,12 @@ class TestSimplifyTypedef : public TestFixture {
28672867
28682868 // The expected result..
28692869 const char expected[] = " C f1 ( ) ; "
2870- " C * f2 ; " // this gets simplified to a regular pointer
2870+ " C ( * f2 ) ( ) ; "
28712871 " C ( & f3 ) ( ) ; "
2872- " C * f4 ; " // this gets simplified to a regular pointer
2873- " C * f5 ; " // this gets simplified to a regular pointer
2874- " C * f6 ; " // this gets simplified to a regular pointer
2875- " C * f7 ; " ; // this gets simplified to a regular pointer
2872+ " C ( * f4 ) ( ) ; "
2873+ " C ( * f5 ) ( ) ; "
2874+ " C ( * f6 ) ( ) ; "
2875+ " C ( * f7 ) ( ) ; " ;
28762876 ASSERT_EQUALS (expected, tok (code, true , Settings::Native, false ));
28772877 ASSERT_EQUALS (" " , errout.str ());
28782878 }
@@ -2896,12 +2896,12 @@ class TestSimplifyTypedef : public TestFixture {
28962896 // The expected result..
28972897 // C const -> const C
28982898 const char expected[] = " const C f1 ( ) ; "
2899- " const C * f2 ; " // this gets simplified to a regular pointer
2899+ " const C ( * f2 ) ( ) ; "
29002900 " const C ( & f3 ) ( ) ; "
2901- " const C * f4 ; " // this gets simplified to a regular pointer
2902- " const C * f5 ; " // this gets simplified to a regular pointer
2903- " const C * f6 ; " // this gets simplified to a regular pointer
2904- " const C * f7 ; " ; // this gets simplified to a regular pointer
2901+ " const C ( * f4 ) ( ) ; "
2902+ " const C ( * f5 ) ( ) ; "
2903+ " const C ( * f6 ) ( ) ; "
2904+ " const C ( * f7 ) ( ) ; " ;
29052905 ASSERT_EQUALS (expected, tok (code, true , Settings::Native, false ));
29062906 ASSERT_EQUALS (" " , errout.str ());
29072907 }
@@ -2924,12 +2924,12 @@ class TestSimplifyTypedef : public TestFixture {
29242924
29252925 // The expected result..
29262926 const char expected[] = " const C f1 ( ) ; "
2927- " const C * f2 ; " // this gets simplified to a regular pointer
2927+ " const C ( * f2 ) ( ) ; "
29282928 " const C ( & f3 ) ( ) ; "
2929- " const C * f4 ; " // this gets simplified to a regular pointer
2930- " const C * f5 ; " // this gets simplified to a regular pointer
2931- " const C * f6 ; " // this gets simplified to a regular pointer
2932- " const C * f7 ; " ; // this gets simplified to a regular pointer
2929+ " const C ( * f4 ) ( ) ; "
2930+ " const C ( * f5 ) ( ) ; "
2931+ " const C ( * f6 ) ( ) ; "
2932+ " const C ( * f7 ) ( ) ; " ;
29332933 ASSERT_EQUALS (expected, tok (code, true , Settings::Native, false ));
29342934 ASSERT_EQUALS (" " , errout.str ());
29352935 }
@@ -2952,12 +2952,12 @@ class TestSimplifyTypedef : public TestFixture {
29522952
29532953 // The expected result..
29542954 const char expected[] = " C * f1 ( ) ; "
2955- " C * * f2 ; " // this gets simplified to a regular pointer
2955+ " C * ( * f2 ) ( ) ; "
29562956 " C * ( & f3 ) ( ) ; "
2957- " C * * f4 ; " // this gets simplified to a regular pointer
2958- " C * * f5 ; " // this gets simplified to a regular pointer
2959- " C * * f6 ; " // this gets simplified to a regular pointer
2960- " C * * f7 ; " ; // this gets simplified to a regular pointer
2957+ " C * ( * f4 ) ( ) ; "
2958+ " C * ( * f5 ) ( ) ; "
2959+ " C * ( * f6 ) ( ) ; "
2960+ " C * ( * f7 ) ( ) ; " ;
29612961 ASSERT_EQUALS (expected, tok (code, true , Settings::Native, false ));
29622962 ASSERT_EQUALS (" " , errout.str ());
29632963 }
@@ -2980,12 +2980,12 @@ class TestSimplifyTypedef : public TestFixture {
29802980
29812981 // The expected result..
29822982 const char expected[] = " const C * f1 ( ) ; "
2983- " const C * * f2 ; " // this gets simplified to a regular pointer
2983+ " const C * ( * f2 ) ( ) ; "
29842984 " const C * ( & f3 ) ( ) ; "
2985- " const C * * f4 ; " // this gets simplified to a regular pointer
2986- " const C * * f5 ; " // this gets simplified to a regular pointer
2987- " const C * * f6 ; " // this gets simplified to a regular pointer
2988- " const C * * f7 ; " ; // this gets simplified to a regular pointer
2985+ " const C * ( * f4 ) ( ) ; "
2986+ " const C * ( * f5 ) ( ) ; "
2987+ " const C * ( * f6 ) ( ) ; "
2988+ " const C * ( * f7 ) ( ) ; " ;
29892989 ASSERT_EQUALS (expected, tok (code, true , Settings::Native, false ));
29902990 ASSERT_EQUALS (" " , errout.str ());
29912991 }
@@ -3009,12 +3009,12 @@ class TestSimplifyTypedef : public TestFixture {
30093009 // The expected result..
30103010 // C const -> const C
30113011 const char expected[] = " const C * f1 ( ) ; "
3012- " const C * * f2 ; " // this gets simplified to a regular pointer
3012+ " const C * ( * f2 ) ( ) ; "
30133013 " const C * ( & f3 ) ( ) ; "
3014- " const C * * f4 ; " // this gets simplified to a regular pointer
3015- " const C * * f5 ; " // this gets simplified to a regular pointer
3016- " const C * * f6 ; " // this gets simplified to a regular pointer
3017- " const C * * f7 ; " ; // this gets simplified to a regular pointer
3014+ " const C * ( * f4 ) ( ) ; "
3015+ " const C * ( * f5 ) ( ) ; "
3016+ " const C * ( * f6 ) ( ) ; "
3017+ " const C * ( * f7 ) ( ) ; " ;
30183018 ASSERT_EQUALS (expected, tok (code, true , Settings::Native, false ));
30193019 ASSERT_EQUALS (" " , errout.str ());
30203020 }
@@ -3063,14 +3063,14 @@ class TestSimplifyTypedef : public TestFixture {
30633063 " type12 t12;" ;
30643064
30653065 // The expected result..
3066- const char expected[] = " int * t1 ; " // simplified to regular pointer
3067- " int * const t2 ; "
3068- " int * volatile t3 ; "
3069- " int * const volatile t4 ; "
3070- " int * t5 ; "
3071- " int * const t6 ; "
3072- " int * volatile t7 ; "
3073- " int * const volatile t8 ; "
3066+ const char expected[] = " int ( * t1 ) ( ) ; "
3067+ " int ( * const t2 ) ( ) ; "
3068+ " int ( * volatile t3 ) ( ) ; "
3069+ " int ( * const volatile t4 ) ( ) ; "
3070+ " int ( * t5 ) ( ) ; "
3071+ " int ( * const t6 ) ( ) ; "
3072+ " int ( * volatile t7 ) ( ) ; "
3073+ " int ( * const volatile t8 ) ( ) ; "
30743074 " int ( :: C :: * t9 ) ( float ) ; "
30753075 " int ( :: C :: * const t10 ) ( float ) ; "
30763076 " int ( :: C :: * volatile t11 ) ( float ) ; "
@@ -3156,10 +3156,10 @@ class TestSimplifyTypedef : public TestFixture {
31563156 " func4 f4;" ;
31573157
31583158 // The expected result..
3159- const char expected[] = " B :: C * f1 ; "
3160- " B :: C * f2 ; "
3161- " B :: C * f3 ; "
3162- " B :: C * f4 ;" ;
3159+ const char expected[] = " B :: C ( * f1 ) ( ) ; "
3160+ " B :: C ( * f2 ) ( ) ; "
3161+ " B :: C ( * f3 ) ( ) ; "
3162+ " B :: C ( * f4 ) ( ) ;" ;
31633163 ASSERT_EQUALS (expected, tok (code, true , Settings::Native, false ));
31643164 ASSERT_EQUALS (" " , errout.str ());
31653165 }
@@ -3194,10 +3194,10 @@ class TestSimplifyTypedef : public TestFixture {
31943194 " func4 f4;" ;
31953195
31963196 // The expected result..
3197- const char expected[] = " A :: B :: C * f1 ; "
3198- " A :: B :: C * f2 ; "
3199- " A :: B :: C * f3 ; "
3200- " A :: B :: C * f4 ;" ;
3197+ const char expected[] = " A :: B :: C ( * f1 ) ( ) ; "
3198+ " A :: B :: C ( * f2 ) ( ) ; "
3199+ " A :: B :: C ( * f3 ) ( ) ; "
3200+ " A :: B :: C ( * f4 ) ( ) ;" ;
32013201 ASSERT_EQUALS (expected, tok (code, true , Settings::Native, false ));
32023202 ASSERT_EQUALS (" " , errout.str ());
32033203 }
@@ -3216,8 +3216,8 @@ class TestSimplifyTypedef : public TestFixture {
32163216 " namespace MySpace { "
32173217 " enum Format_E2 { FORMAT21 , FORMAT22 } ; enum Format_E2 Format_T2 ; "
32183218 " } "
3219- " Format_E1 * * t1 ; "
3220- " MySpace :: Format_E2 * * t2 ;" ,
3219+ " Format_E1 ( * * t1 ) ( ) ; "
3220+ " MySpace :: Format_E2 ( * * t2 ) ( ) ;" ,
32213221 tok (code,false ));
32223222 }
32233223
0 commit comments