111
|
1 /* PR target/36745 */
|
|
2 /* { dg-do compile } */
|
|
3 /* { dg-options "-O2 -fPIC" } */
|
|
4 /* { dg-require-effective-target fpic } */
|
|
5
|
|
6 typedef __SIZE_TYPE__ size_t;
|
|
7 class QBasicAtomicInt
|
|
8 {
|
|
9 public:
|
|
10 int _q_value;
|
|
11 inline bool operator== (int value) const
|
|
12 {
|
|
13 }
|
|
14 bool ref ();
|
|
15 bool deref ();
|
|
16 };
|
|
17 inline bool
|
|
18 QBasicAtomicInt::ref ()
|
|
19 {
|
|
20 __asm__ ("": "=m" (_q_value): :);
|
|
21 return true;
|
|
22 }
|
|
23
|
|
24 namespace std
|
|
25 {
|
|
26 using::size_t;
|
|
27 }
|
|
28 extern "C++"
|
|
29 {
|
|
30 inline void *operator new (std::size_t, void *__p)
|
|
31 {
|
|
32 return __p;
|
|
33 }
|
|
34 }
|
|
35 struct QMapData
|
|
36 {
|
|
37 QBasicAtomicInt ref;
|
|
38 static QMapData shared_null;
|
|
39 };
|
|
40 template < class Key, class T > class QMap
|
|
41 {
|
|
42 QMapData *d;
|
|
43 public: inline QMap ():d (&QMapData::shared_null)
|
|
44 {
|
|
45 }
|
|
46 inline ~ QMap ()
|
|
47 {
|
|
48 if (!d->ref.deref ())
|
|
49 freeData (d);
|
|
50 }
|
|
51 void freeData (QMapData * d);
|
|
52 };
|
|
53 struct QVectorData
|
|
54 {
|
|
55 QBasicAtomicInt ref;
|
|
56 static QVectorData shared_null;
|
|
57 };
|
|
58 template < typename T > struct QVectorTypedData
|
|
59 {
|
|
60 QBasicAtomicInt ref;
|
|
61 };
|
|
62 template < typename T > class QVector
|
|
63 {
|
|
64 union
|
|
65 {
|
|
66 QVectorData *p;
|
|
67 QVectorTypedData < T > *d;
|
|
68 };
|
|
69 public: inline QVector ():p (&QVectorData::shared_null)
|
|
70 {
|
|
71 d->ref.ref ();
|
|
72 }
|
|
73 inline void detach ()
|
|
74 {
|
|
75 if (d->ref == 1)
|
|
76 detach_helper ();
|
|
77 }
|
|
78 inline T *data ()
|
|
79 {
|
|
80 detach ();
|
|
81 }
|
|
82 T & operator[](int i);
|
|
83 void detach_helper ();
|
|
84 void realloc ();
|
|
85 };
|
|
86 template < typename T > void QVector < T >::detach_helper ()
|
|
87 {
|
|
88 realloc ();
|
|
89 }
|
|
90
|
|
91 template < typename T > inline T & QVector < T >::operator[](int i)
|
|
92 {
|
|
93 return data ()[i];
|
|
94 }
|
|
95 template < typename T > void QVector < T >::realloc ()
|
|
96 {
|
|
97 T *j, *i;
|
|
98 i->~T ();
|
|
99 while (j-- == i)
|
|
100 new (j) T;
|
|
101 }
|
|
102
|
|
103 void
|
|
104 mergeInto (QVector < int >*a)
|
|
105 {
|
|
106 };
|
|
107 struct QRegExpAutomatonState
|
|
108 {
|
|
109 QVector < int >outs;
|
|
110 QMap < int, int >reenter;
|
|
111 QMap < int, int >anchors;
|
|
112 };
|
|
113 class QRegExpEngine
|
|
114 {
|
|
115 void addCatTransitions ();
|
|
116 QVector < QRegExpAutomatonState > s;
|
|
117 };
|
|
118 void
|
|
119 QRegExpEngine::addCatTransitions ()
|
|
120 {
|
|
121 mergeInto (&s[2].outs);
|
|
122 }
|