]> git.wh0rd.org - ICEs.git/blame - bfin-boost-sync-fetch/test.ii
initial import
[ICEs.git] / bfin-boost-sync-fetch / test.ii
CommitLineData
45516216 1extern "C++" {
2 namespace std {
3 class exception {
4 };
5 }
6 }
7 namespace __gnu_cxx {
8 template<typename _Tp> class new_allocator {
9 public: typedef _Tp& reference;
10 template<typename _Tp1> struct rebind {
11 typedef new_allocator<_Tp1> other;
12 };
13 };
14 }
15 namespace std {
16 template<class _CharT> struct char_traits;
17 template<typename _Tp> class allocator: public __gnu_cxx::new_allocator<_Tp> {
18 };
19 template<typename _Tp, typename _Alloc> struct _Vector_base {
20 typedef typename _Alloc::template rebind<_Tp>::other _Tp_alloc_type;
21 };
22 template<typename _Tp, typename _Alloc = std::allocator<_Tp> > class vector : protected _Vector_base<_Tp, _Alloc> {
23 typedef _Vector_base<_Tp, _Alloc> _Base;
24 typedef typename _Base::_Tp_alloc_type _Tp_alloc_type;
25 public: typedef _Tp value_type;
26 typedef typename _Tp_alloc_type::reference reference;
27 long unsigned int size() const {
28 }
29 reference operator[](long unsigned int __n) {
30 }
31 };
32 template<typename _CharT, typename _Traits, typename _Alloc> class basic_string {
33 };
34 class locale {
35 };
36 enum _Ios_Fmtflags {
37 _S_boolalpha = 1L << 0, _S_dec = 1L << 1, _S_fixed = 1L << 2, _S_hex = 1L << 3, _S_internal = 1L << 4, _S_left = 1L << 5, _S_oct = 1L << 6, _S_right = 1L << 7, _S_scientific = 1L << 8, _S_showbase = 1L << 9, _S_showpoint = 1L << 10, _S_showpos = 1L << 11, _S_skipws = 1L << 12, _S_unitbuf = 1L << 13, _S_uppercase = 1L << 14, _S_adjustfield = _S_left | _S_right | _S_internal, _S_basefield = _S_dec | _S_oct | _S_hex, _S_floatfield = _S_scientific | _S_fixed, _S_ios_fmtflags_end = 1L << 16 };
38 class ios_base {
39 public: class failure : public exception {
40 };
41 typedef _Ios_Fmtflags fmtflags;
42 inline fmtflags flags() const {
43 }
44 };
45 template<typename _CharT, typename _Traits> class basic_streambuf {
46 };
47 template<typename _CharT, typename _Traits> class basic_ios : public ios_base {
48 };
49 template<typename _CharT, typename _Traits> class basic_ostream : virtual public basic_ios<_CharT, _Traits> {
50 public: typedef _CharT char_type;
51 typedef basic_streambuf<_CharT, _Traits> __streambuf_type;
52 explicit basic_ostream(__streambuf_type* __sb) {
53 }
54 };
55 }
56 namespace boost {
57 template <class Ch, class Tr = ::std:: char_traits<Ch>, class Alloc = std::allocator<Ch> > class basic_format;
58 typedef basic_format<char > format;
59 namespace io {
60 namespace detail {
61 typedef ::std:: locale locale_t;
62 template<class Ch, class Tr, class Alloc, class T> basic_format<Ch, Tr, Alloc>& feed (basic_format<Ch,Tr, Alloc>& self, T x);
63 }
64 }
65 }
66 namespace mpl_ {
67 template< typename T, T N > struct integral_c {
68 static const T value = N;
69 };
70 struct na {
71 };
72 }
73 namespace boost {
74 namespace mpl {
75 using namespace mpl_;
76 }
77 template <class T, T val> struct integral_constant : public mpl::integral_c<T, val> {
78 typedef integral_constant<bool,false> type;
79 };
80 namespace mpl {
81 template< bool C , typename T1 , typename T2 > struct if_c {
82 typedef T2 type;
83 };
84 template< typename T1 = na , typename T2 = na , typename T3 = na > struct if_ {
85 private: typedef if_c< static_cast<bool>(T1::value) , T2 , T3 > almost_type_;
86 public: typedef typename almost_type_::type type;
87 };
88 }
89 template< typename T > struct is_reference : ::boost::integral_constant<bool,false> {
90 };
91 namespace optional_detail {
92 template<class T> struct types_when_isnt_ref {
93 typedef T * pointer_type;
94 };
95 template<class T> struct types_when_is_ref {
96 };
97 struct optional_tag {
98 };
99 template<class T> class optional_base : public optional_tag {
100 typedef types_when_isnt_ref<T> types_when_not_ref;
101 typedef types_when_is_ref<T> types_when_ref;
102 typedef typename is_reference<T>::type is_reference_predicate;
103 typedef typename mpl::if_<is_reference_predicate,types_when_ref,types_when_not_ref>::type types;
104 typedef typename types::pointer_type pointer_type;
105 };
106 }
107 template<class T> class optional : public optional_detail::optional_base<T> {
108 typedef optional_detail::optional_base<T> base;
109 public : typedef optional<T> this_type;
110 typedef typename base::pointer_type pointer_type;
111 };
112 template<class T> inline typename optional<T>::pointer_type get_pointer ( optional<T>& opt ) {
113 }
114 template < typename MemberType, int UniqueID = 0 > class base_from_member {
115 protected: MemberType member;
116 template < typename T0 , typename T1 > explicit base_from_member( T0 x0 , T1 x1 ) : member( x0 , x1 ) {
117 }
118 };
119 namespace detail {
120 inline int atomic_decrement( int * pw ) {
121 return __sync_fetch_and_add( pw, -1 );
122 }
123 class sp_counted_base {
124 int use_count_;
125 int weak_count_;
126 public: sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) {
127 }
128 void release() {
129 if( atomic_decrement( &use_count_ ) == 1 ) {
130 }
131 }
132 };
133 class shared_count {
134 private: sp_counted_base * pi_;
135 public: shared_count(): pi_(0) {
136 }
137 template<class P, class D> shared_count(P p, D d): pi_(0) {
138 if( pi_ != 0 ) pi_->release();
139 }
140 };
141 }
142 template<class T> class shared_ptr {
143 public: typedef T element_type;
144 template<class Y, class D> shared_ptr(Y * p, D d): px(p), pn(p, d) {
145 }
146 T * px;
147 boost::detail::shared_count pn;
148 };
149 namespace io {
150 template<class Ch, class Tr, class Alloc> class basic_altstringbuf : public ::std::basic_streambuf<Ch, Tr> {
151 };
152 template <class Ch, class Tr, class Alloc> class basic_oaltstringstream : private base_from_member< shared_ptr< basic_altstringbuf< Ch, Tr, Alloc> > >, public ::std::basic_ostream<Ch, Tr> {
153 class No_Op {
154 };
155 typedef ::std::basic_ostream<Ch, Tr> stream_t;
156 typedef boost::base_from_member<boost::shared_ptr< basic_altstringbuf<Ch,Tr, Alloc> > > pbase_type;
157 typedef basic_altstringbuf<Ch, Tr, Alloc> stringbuf_t;
158 public: typedef Alloc allocator_type;
159 basic_oaltstringstream() : pbase_type(new stringbuf_t), stream_t(rdbuf()) {
160 }
161 basic_oaltstringstream(stringbuf_t * buf) : pbase_type(buf, No_Op() ), stream_t(rdbuf()) {
162 }
163 stringbuf_t * rdbuf() const {
164 }
165 };
166 namespace detail {
167 template<class Ch, class Tr, class Alloc> struct format_item {
168 typedef ::std::basic_string<Ch, Tr, Alloc> string_type;
169 int argN_;
170 string_type res_;
171 };
172 }
173 }
174 template<class Ch, class Tr, class Alloc> class basic_format {
175 public: typedef Ch CharT;
176 typedef std::basic_string<Ch, Tr, Alloc> string_type;
177 typedef io::detail::format_item<Ch, Tr, Alloc> format_item_t;
178 typedef io::basic_altstringbuf<Ch, Tr, Alloc> internal_streambuf_t;
179 explicit basic_format(const Ch* str=__null);
180 template<class T> basic_format& operator%(const T& x) {
181 return io::detail::feed<CharT, Tr, Alloc, const T&>(*this,x);
182 }
183 std::vector<format_item_t> items_;
184 int cur_arg_;
185 internal_streambuf_t buf_;
186 boost::optional<io::detail::locale_t> loc_;
187 };
188 namespace io {
189 namespace detail {
190 template< class Ch, class Tr, class Alloc, class T> void put( T x, const format_item<Ch, Tr, Alloc>& specs, typename basic_format<Ch, Tr, Alloc>::string_type& res, typename basic_format<Ch, Tr, Alloc>::internal_streambuf_t & buf, io::detail::locale_t *loc_p = __null) {
191 basic_oaltstringstream<Ch, Tr, Alloc> oss( &buf);
192 }
193 template< class Ch, class Tr, class Alloc, class T> void distribute (basic_format<Ch,Tr, Alloc>& self, T x) {
194 for(unsigned long i=0;
195 i < self.items_.size();
196 ++i) {
197 if(self.items_[i].argN_ == self.cur_arg_) {
198 put<Ch, Tr, Alloc, T> (x, self.items_[i], self.items_[i].res_, self.buf_, boost::get_pointer(self.loc_) );
199 }
200 }
201 }
202 template<class Ch, class Tr, class Alloc, class T> basic_format<Ch, Tr, Alloc>& feed (basic_format<Ch,Tr, Alloc>& self, T x) {
203 distribute<Ch, Tr, Alloc, T> (self, x);
204 }
205 }
206 }
207 }
208 int main() {
209 boost::format f("%d\n");
210 f %-123;
211 }