forked from chapuni/clang
-
Notifications
You must be signed in to change notification settings - Fork 2
/
libstdc++4.4-clang0x.patch
608 lines (555 loc) · 17.1 KB
/
libstdc++4.4-clang0x.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
This patch was generated from the headers installed by MacPorts
gcc-4.4 on OS X 10.6. You can apply it there with
`cd /opt/local/include/gcc44/c++ ; sudo patch -p1 <this_patch`, or similar
on other operating systems. Mail cfe-dev if you find other problems in the
standard headers.
This patch is offered under the same modified GPLv3 as libstdc++-4.4.
diff -ur a/bits/forward_list.h b/bits/forward_list.h
--- a/bits/forward_list.h 2011-03-15 14:49:05.000000000 -0700
+++ b/bits/forward_list.h 2011-05-02 23:51:33.000000000 -0700
@@ -983,7 +983,7 @@
* function.
*/
void
- swap(forward_list&& __list)
+ swap(forward_list& __list)
{ _Node_base::swap(this->_M_impl._M_head, __list._M_impl._M_head); }
/**
diff -ur a/bits/move.h b/bits/move.h
--- a/bits/move.h 2011-03-15 14:49:05.000000000 -0700
+++ b/bits/move.h 2011-03-29 10:33:39.000000000 -0700
@@ -48,13 +48,35 @@
template<typename _Tp>
inline _Tp&&
- forward(typename std::identity<_Tp>::type&& __t)
+ forward(typename std::remove_reference<_Tp>::type& __t)
+#ifdef __clang__
+ { return static_cast<_Tp&&>(__t); }
+#else
{ return __t; }
+#endif
+
+ template<typename _Tp>
+ inline _Tp&&
+ forward(typename std::remove_reference<_Tp>::type&& __t)
+ {
+#ifdef __clang__
+ static_assert(!std::is_lvalue_reference<_Tp>::value,
+ "Can't instantiate this forward() with an"
+ " lvalue reference type.");
+ return static_cast<_Tp&&>(__t);
+#else
+ return __t;
+#endif
+ }
template<typename _Tp>
inline typename std::remove_reference<_Tp>::type&&
move(_Tp&& __t)
+#ifdef __clang__
+ { return static_cast<typename std::remove_reference<_Tp>::type&&>(__t); }
+#else
{ return __t; }
+#endif
_GLIBCXX_END_NAMESPACE
diff -ur a/bits/shared_ptr.h b/bits/shared_ptr.h
--- a/bits/shared_ptr.h 2011-03-15 14:49:05.000000000 -0700
+++ b/bits/shared_ptr.h 2011-03-31 16:40:45.000000000 -0700
@@ -833,7 +833,7 @@
{ return _M_refcount._M_get_use_count(); }
void
- swap(__shared_ptr<_Tp, _Lp>&& __other) // never throws
+ swap(__shared_ptr<_Tp, _Lp>& __other) // never throws
{
std::swap(_M_ptr, __other._M_ptr);
_M_refcount._M_swap(__other._M_refcount);
@@ -943,16 +943,6 @@
swap(__shared_ptr<_Tp, _Lp>& __a, __shared_ptr<_Tp, _Lp>& __b)
{ __a.swap(__b); }
- template<typename _Tp, _Lock_policy _Lp>
- inline void
- swap(__shared_ptr<_Tp, _Lp>&& __a, __shared_ptr<_Tp, _Lp>& __b)
- { __a.swap(__b); }
-
- template<typename _Tp, _Lock_policy _Lp>
- inline void
- swap(__shared_ptr<_Tp, _Lp>& __a, __shared_ptr<_Tp, _Lp>&& __b)
- { __a.swap(__b); }
-
// 2.2.3.9 shared_ptr casts
/** @warning The seemingly equivalent
* <code>shared_ptr<_Tp, _Lp>(static_cast<_Tp*>(__r.get()))</code>
@@ -1372,16 +1362,6 @@
swap(shared_ptr<_Tp>& __a, shared_ptr<_Tp>& __b)
{ __a.swap(__b); }
- template<typename _Tp>
- inline void
- swap(shared_ptr<_Tp>&& __a, shared_ptr<_Tp>& __b)
- { __a.swap(__b); }
-
- template<typename _Tp>
- inline void
- swap(shared_ptr<_Tp>& __a, shared_ptr<_Tp>&& __b)
- { __a.swap(__b); }
-
// 20.8.13.2.10 shared_ptr casts.
template<typename _Tp, typename _Tp1>
inline shared_ptr<_Tp>
diff -ur a/bits/stl_bvector.h b/bits/stl_bvector.h
--- a/bits/stl_bvector.h 2011-03-15 14:49:05.000000000 -0700
+++ b/bits/stl_bvector.h 2011-05-02 23:34:46.000000000 -0700
@@ -743,11 +743,7 @@
}
void
-#ifdef __GXX_EXPERIMENTAL_CXX0X__
- swap(vector&& __x)
-#else
swap(vector& __x)
-#endif
{
std::swap(this->_M_impl._M_start, __x._M_impl._M_start);
std::swap(this->_M_impl._M_finish, __x._M_impl._M_finish);
diff -ur a/bits/stl_deque.h b/bits/stl_deque.h
--- a/bits/stl_deque.h 2011-03-15 14:49:05.000000000 -0700
+++ b/bits/stl_deque.h 2011-03-29 10:33:39.000000000 -0700
@@ -1395,11 +1395,7 @@
* std::swap(d1,d2) will feed to this function.
*/
void
-#ifdef __GXX_EXPERIMENTAL_CXX0X__
- swap(deque&& __x)
-#else
swap(deque& __x)
-#endif
{
std::swap(this->_M_impl._M_start, __x._M_impl._M_start);
std::swap(this->_M_impl._M_finish, __x._M_impl._M_finish);
diff -ur a/bits/stl_iterator.h b/bits/stl_iterator.h
--- a/bits/stl_iterator.h 2011-03-15 14:49:05.000000000 -0700
+++ b/bits/stl_iterator.h 2011-03-29 10:33:39.000000000 -0700
@@ -913,7 +913,7 @@
reference
operator*() const
- { return *_M_current; }
+ { return std::move(*_M_current); }
pointer
operator->() const
diff -ur a/bits/stl_list.h b/bits/stl_list.h
--- a/bits/stl_list.h 2011-03-15 14:49:05.000000000 -0700
+++ b/bits/stl_list.h 2011-03-29 10:33:39.000000000 -0700
@@ -1106,11 +1106,7 @@
* function.
*/
void
-#ifdef __GXX_EXPERIMENTAL_CXX0X__
- swap(list&& __x)
-#else
swap(list& __x)
-#endif
{
_List_node_base::swap(this->_M_impl._M_node, __x._M_impl._M_node);
@@ -1160,6 +1156,12 @@
}
}
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ void
+ splice(iterator __position, list& __x)
+ { splice(__position, std::move(__x)); }
+#endif
+
/**
* @brief Insert element from another %list.
* @param position Iterator referencing the element to insert before.
@@ -1187,6 +1189,12 @@
this->_M_transfer(__position, __i, __j);
}
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ void
+ splice(iterator __position, list& __x, iterator __i)
+ { splice(__position, std::move(__x), __i); }
+#endif
+
/**
* @brief Insert range from another %list.
* @param position Iterator referencing the element to insert before.
@@ -1217,6 +1225,13 @@
}
}
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ void
+ splice(iterator __position, list& __x, iterator __first,
+ iterator __last)
+ { splice(__position, std::move(__x), __first, __last); }
+#endif
+
/**
* @brief Remove all elements equal to value.
* @param value The value to remove.
@@ -1287,6 +1302,10 @@
void
#ifdef __GXX_EXPERIMENTAL_CXX0X__
merge(list&& __x);
+
+ void
+ merge(list& __x)
+ { merge(std::move(__x)); }
#else
merge(list& __x);
#endif
@@ -1307,6 +1326,11 @@
void
#ifdef __GXX_EXPERIMENTAL_CXX0X__
merge(list&&, _StrictWeakOrdering);
+
+ template<typename _StrictWeakOrdering>
+ void
+ merge(list& __l, _StrictWeakOrdering __comp)
+ { merge(std::move(__l), __comp); }
#else
merge(list&, _StrictWeakOrdering);
#endif
diff -ur a/bits/stl_map.h b/bits/stl_map.h
--- a/bits/stl_map.h 2011-03-15 14:49:05.000000000 -0700
+++ b/bits/stl_map.h 2011-03-29 10:33:39.000000000 -0700
@@ -608,11 +608,7 @@
* that std::swap(m1,m2) will feed to this function.
*/
void
-#ifdef __GXX_EXPERIMENTAL_CXX0X__
- swap(map&& __x)
-#else
swap(map& __x)
-#endif
{ _M_t.swap(__x._M_t); }
/**
diff -ur a/bits/stl_multimap.h b/bits/stl_multimap.h
--- a/bits/stl_multimap.h 2011-03-15 14:49:05.000000000 -0700
+++ b/bits/stl_multimap.h 2011-03-29 10:33:39.000000000 -0700
@@ -544,11 +544,7 @@
* std::swap(m1,m2) will feed to this function.
*/
void
-#ifdef __GXX_EXPERIMENTAL_CXX0X__
- swap(multimap&& __x)
-#else
swap(multimap& __x)
-#endif
{ _M_t.swap(__x._M_t); }
/**
diff -ur a/bits/stl_multiset.h b/bits/stl_multiset.h
--- a/bits/stl_multiset.h 2011-03-15 14:49:05.000000000 -0700
+++ b/bits/stl_multiset.h 2011-03-29 10:33:39.000000000 -0700
@@ -376,11 +376,7 @@
* std::swap(s1,s2) will feed to this function.
*/
void
-#ifdef __GXX_EXPERIMENTAL_CXX0X__
- swap(multiset&& __x)
-#else
swap(multiset& __x)
-#endif
{ _M_t.swap(__x._M_t); }
// insert/erase
diff -ur a/bits/stl_pair.h b/bits/stl_pair.h
--- a/bits/stl_pair.h 2011-03-15 14:49:05.000000000 -0700
+++ b/bits/stl_pair.h 2011-03-29 10:33:39.000000000 -0700
@@ -84,10 +84,21 @@
: first(__a), second(__b) { }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
- template<class _U1, class _U2>
+ template<class _U1, class = typename
+ std::enable_if<std::is_convertible<_U1, _T1>::value>::type>
+ pair(_U1&& __x, const _T2& __y)
+ : first(std::forward<_U1>(__x)), second(__y) { }
+
+ template<class _U2, class = typename
+ std::enable_if<std::is_convertible<_U2, _T2>::value>::type>
+ pair(const _T1& __x, _U2&& __y)
+ : first(__x), second(std::forward<_U2>(__y)) { }
+
+ template<class _U1, class _U2, class = typename
+ std::enable_if<std::is_convertible<_U1, _T1>::value
+ && std::is_convertible<_U2, _T2>::value>::type>
pair(_U1&& __x, _U2&& __y)
- : first(std::forward<_U1>(__x)),
- second(std::forward<_U2>(__y)) { }
+ : first(std::forward<_U1>(__x)), second(std::forward<_U2>(__y)) { }
pair(pair&& __p)
: first(std::move(__p.first)),
@@ -107,11 +118,19 @@
second(std::move(__p.second)) { }
// http://gcc.gnu.org/ml/libstdc++/2007-08/msg00052.html
+
+#if 0
+ // This constructor is incompatible with libstdc++-4.6, and it
+ // interferes with passing NULL pointers to the 2-argument
+ // constructors, so we disable it. map::emplace isn't
+ // implemented in libstdc++-4.4 anyway, and that's what this
+ // constructor was here for.
template<class _U1, class _Arg0, class... _Args>
pair(_U1&& __x, _Arg0&& __arg0, _Args&&... __args)
: first(std::forward<_U1>(__x)),
second(std::forward<_Arg0>(__arg0),
std::forward<_Args>(__args)...) { }
+#endif
pair&
operator=(pair&& __p)
@@ -131,7 +150,7 @@
}
void
- swap(pair&& __p)
+ swap(pair& __p)
{
using std::swap;
swap(first, __p.first);
diff -ur a/bits/stl_queue.h b/bits/stl_queue.h
--- a/bits/stl_queue.h 2011-03-15 14:49:05.000000000 -0700
+++ b/bits/stl_queue.h 2011-05-02 23:36:15.000000000 -0700
@@ -249,7 +249,7 @@
#ifdef __GXX_EXPERIMENTAL_CXX0X__
void
- swap(queue&& __q)
+ swap(queue& __q)
{ c.swap(__q.c); }
#endif
};
@@ -550,7 +550,7 @@
#ifdef __GXX_EXPERIMENTAL_CXX0X__
void
- swap(priority_queue&& __pq)
+ swap(priority_queue& __pq)
{
using std::swap;
c.swap(__pq.c);
diff -ur a/bits/stl_set.h b/bits/stl_set.h
--- a/bits/stl_set.h 2011-03-15 14:49:05.000000000 -0700
+++ b/bits/stl_set.h 2011-03-29 10:33:39.000000000 -0700
@@ -383,11 +383,7 @@
* std::swap(s1,s2) will feed to this function.
*/
void
-#ifdef __GXX_EXPERIMENTAL_CXX0X__
- swap(set&& __x)
-#else
swap(set& __x)
-#endif
{ _M_t.swap(__x._M_t); }
// insert/erase
diff -ur a/bits/stl_stack.h b/bits/stl_stack.h
--- a/bits/stl_stack.h 2011-03-15 14:49:05.000000000 -0700
+++ b/bits/stl_stack.h 2011-05-02 23:36:36.000000000 -0700
@@ -213,7 +213,7 @@
#ifdef __GXX_EXPERIMENTAL_CXX0X__
void
- swap(stack&& __s)
+ swap(stack& __s)
{ c.swap(__s.c); }
#endif
};
diff -ur a/bits/stl_tree.h b/bits/stl_tree.h
--- a/bits/stl_tree.h 2011-03-15 14:49:05.000000000 -0700
+++ b/bits/stl_tree.h 2011-03-29 10:33:39.000000000 -0700
@@ -675,11 +675,7 @@
{ return _M_get_Node_allocator().max_size(); }
void
-#ifdef __GXX_EXPERIMENTAL_CXX0X__
- swap(_Rb_tree&& __t);
-#else
swap(_Rb_tree& __t);
-#endif
// Insert/erase.
pair<iterator, bool>
@@ -1104,11 +1100,7 @@
typename _Compare, typename _Alloc>
void
_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
-#ifdef __GXX_EXPERIMENTAL_CXX0X__
- swap(_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>&& __t)
-#else
swap(_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __t)
-#endif
{
if (_M_root() == 0)
{
diff -ur a/bits/stl_vector.h b/bits/stl_vector.h
--- a/bits/stl_vector.h 2011-03-15 14:49:05.000000000 -0700
+++ b/bits/stl_vector.h 2011-03-29 10:33:39.000000000 -0700
@@ -923,11 +923,7 @@
* std::swap(v1,v2) will feed to this function.
*/
void
-#ifdef __GXX_EXPERIMENTAL_CXX0X__
- swap(vector&& __x)
-#else
swap(vector& __x)
-#endif
{
std::swap(this->_M_impl._M_start, __x._M_impl._M_start);
std::swap(this->_M_impl._M_finish, __x._M_impl._M_finish);
diff -ur a/bits/unique_ptr.h b/bits/unique_ptr.h
--- a/bits/unique_ptr.h 2011-03-15 14:49:05.000000000 -0700
+++ b/bits/unique_ptr.h 2011-03-31 16:40:45.000000000 -0700
@@ -204,7 +204,7 @@
}
void
- swap(unique_ptr&& __u)
+ swap(unique_ptr& __u)
{
using std::swap;
swap(_M_t, __u._M_t);
@@ -350,7 +350,7 @@
void reset(_Up) = delete;
void
- swap(unique_ptr&& __u)
+ swap(unique_ptr& __u)
{
using std::swap;
swap(_M_t, __u._M_t);
@@ -389,18 +389,6 @@
unique_ptr<_Tp, _Tp_Deleter>& __y)
{ __x.swap(__y); }
- template<typename _Tp, typename _Tp_Deleter>
- inline void
- swap(unique_ptr<_Tp, _Tp_Deleter>&& __x,
- unique_ptr<_Tp, _Tp_Deleter>& __y)
- { __x.swap(__y); }
-
- template<typename _Tp, typename _Tp_Deleter>
- inline void
- swap(unique_ptr<_Tp, _Tp_Deleter>& __x,
- unique_ptr<_Tp, _Tp_Deleter>&& __y)
- { __x.swap(__y); }
-
template<typename _Tp, typename _Tp_Deleter,
typename _Up, typename _Up_Deleter>
inline bool
diff -ur a/exception_ptr.h b/exception_ptr.h
--- a/exception_ptr.h 2011-03-15 14:49:08.000000000 -0700
+++ b/exception_ptr.h 2011-03-29 10:33:39.000000000 -0700
@@ -140,7 +140,7 @@
friend bool
operator==(const exception_ptr&, const exception_ptr&) throw();
- const type_info*
+ const class type_info*
__cxa_exception_type() const throw();
};
diff -ur a/ext/algorithm b/ext/algorithm
--- a/ext/algorithm 2011-03-15 14:49:05.000000000 -0700
+++ b/ext/algorithm 2011-03-29 10:33:39.000000000 -0700
@@ -423,6 +423,9 @@
__out_last - __out_first);
}
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ using std::is_heap;
+#else
/**
* This is an SGI extension.
* @ingroup SGIextensions
@@ -462,6 +465,7 @@
return std::__is_heap(__first, __comp, __last - __first);
}
+#endif
// is_sorted, a predicated testing whether a range is sorted in
// nondescending order. This is an extension, not part of the C++
diff -ur a/ext/vstring.h b/ext/vstring.h
--- a/ext/vstring.h 2011-03-15 14:49:05.000000000 -0700
+++ b/ext/vstring.h 2011-03-29 10:33:39.000000000 -0700
@@ -152,7 +152,7 @@
* string.
*/
__versa_string(__versa_string&& __str)
- : __vstring_base(std::forward<__vstring_base>(__str)) { }
+ : __vstring_base(std::move(__str)) { }
/**
* @brief Construct string from an initializer list.
@@ -1439,11 +1439,7 @@
* constant time.
*/
void
-#ifdef __GXX_EXPERIMENTAL_CXX0X__
- swap(__versa_string&& __s)
-#else
swap(__versa_string& __s)
-#endif
{ this->_M_swap(__s); }
// String operations:
diff -ur a/tr1_impl/hashtable b/tr1_impl/hashtable
--- a/tr1_impl/hashtable 2011-03-15 14:49:07.000000000 -0700
+++ b/tr1_impl/hashtable 2011-05-02 23:41:55.000000000 -0700
@@ -225,11 +225,7 @@
~_Hashtable();
-#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
- void swap(_Hashtable&&);
-#else
void swap(_Hashtable&);
-#endif
// Basic container operations
iterator
@@ -732,11 +728,7 @@
void
_Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
_H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::
-#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
- swap(_Hashtable&& __x)
-#else
swap(_Hashtable& __x)
-#endif
{
// The only base class with member variables is hash_code_base. We
// define _Hash_code_base::_M_swap because different specializations
diff -ur a/tuple b/tuple
--- a/tuple 2011-03-15 14:49:07.000000000 -0700
+++ b/tuple 2011-05-02 23:33:23.000000000 -0700
@@ -77,7 +77,7 @@
_Head& _M_head() { return *this; }
const _Head& _M_head() const { return *this; }
- void _M_swap_impl(_Head&&) { /* no-op */ }
+ void _M_swap_impl(_Head&) { /* no-op */ }
};
template<std::size_t _Idx, typename _Head>
@@ -97,7 +97,7 @@
const _Head& _M_head() const { return _M_head_impl; }
void
- _M_swap_impl(_Head&& __h)
+ _M_swap_impl(_Head& __h)
{
using std::swap;
swap(__h, _M_head_impl);
@@ -125,7 +125,7 @@
struct _Tuple_impl<_Idx>
{
protected:
- void _M_swap_impl(_Tuple_impl&&) { /* no-op */ }
+ void _M_swap_impl(_Tuple_impl&) { /* no-op */ }
};
/**
@@ -214,7 +214,7 @@
protected:
void
- _M_swap_impl(_Tuple_impl&& __in)
+ _M_swap_impl(_Tuple_impl& __in)
{
_Base::_M_swap_impl(__in._M_head());
_Inherited::_M_swap_impl(__in._M_tail());
@@ -292,7 +292,7 @@
}
void
- swap(tuple&& __in)
+ swap(tuple& __in)
{ _Inherited::_M_swap_impl(__in); }
};
@@ -301,7 +301,7 @@
class tuple<>
{
public:
- void swap(tuple&&) { /* no-op */ }
+ void swap(tuple&) { /* no-op */ }
};
/// tuple (2-element), with construction and assignment from a pair.
@@ -394,7 +394,7 @@
}
void
- swap(tuple&& __in)
+ swap(tuple& __in)
{
using std::swap;
swap(this->_M_head(), __in._M_head());