Fix test-suite fallout of default -Wreturn-type.
[official-gcc.git] / gcc / testsuite / g++.dg / torture / pr48271.C
blob2e3eb5bfd05b9a2f7745560944fcead0b4670373
1 // { dg-do compile }
2 // { dg-options "-ftree-vrp -fno-guess-branch-probability -fnon-call-exceptions" }
3 // { dg-additional-options "-Wno-return-type" }
5 void *xalloc ();
6 void xfree (void *);
7 void error ();
9 static inline void *
10 MallocT ()
12   void *p = xalloc ();
13   if (!p)
14     error ();
15   return p;
19 struct ByteBlob
21   int *header;
23   ByteBlob();
25   ~ByteBlob ()
26   {
27     Free ();
28   }
30   int RawFree (int * p)
31   {
32     if (!p)
33       error ();
34     xfree (p);
35   }
37   int *LengthRef ();
39   void Free ()
40   {
41     if (*header)
42       RawFree (header);
43   }
45   int Append (int num_ints)
46   {
47     if (*header)
48       MallocT ();
49     *LengthRef () += num_ints;
50   }
53 struct CBlobT:ByteBlob
55   ~CBlobT ()
56   {
57     Free ();
58   }
61 template < class T > struct FixedSizeArray
63   int HeaderSize;
64   T *data;
65   FixedSizeArray ();
66   int RefCnt ()
67   {
68     return *(int *) MallocT ();
69   }
70    ~FixedSizeArray ()
71   {
72     if (RefCnt ())
73       for (T * pItem = data + Length (); pItem != data; pItem--)
74         T ();
75   }
76   int Length ();
79 class SmallArray
81   typedef FixedSizeArray < int > SubArray;
82   typedef FixedSizeArray < SubArray > SuperArray;
83   SuperArray data;
86 struct CHashTableT
88   int *m_slots;
89   ~CHashTableT ()
90   {
91     delete m_slots;
92   }
95 struct CYapfBaseT
97   int *PfGetSettings ();
98   SmallArray m_arr;
99   CHashTableT m_closed;
100   CYapfBaseT ()
101   {
102     MallocT ();
103   }
106 struct CYapfCostRailT:CYapfBaseT
108   CBlobT m_sig_look_ahead_costs;
109   CYapfCostRailT ()
110   {
111     m_sig_look_ahead_costs.Append (*Yapf ()->PfGetSettings ());
112     Yapf ()->PfGetSettings ();
113   }
114   CYapfBaseT *Yapf ();
117 void stCheckReverseTrain ()
119   CYapfCostRailT pf1;