webruby 0.2.2 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (245) hide show
  1. checksums.yaml +4 -4
  2. data/lib/webruby/config.rb +4 -9
  3. data/lib/webruby/rake/files.rake +2 -2
  4. data/modules/emscripten/AUTHORS +9 -1
  5. data/modules/emscripten/CONTRIBUTING.markdown +5 -0
  6. data/modules/emscripten/ChangeLog +435 -0
  7. data/modules/emscripten/cmake/Modules/FindOpenAL.cmake +26 -0
  8. data/modules/emscripten/cmake/Platform/Emscripten.cmake +9 -2
  9. data/modules/emscripten/em++ +0 -2
  10. data/modules/emscripten/emcc +92 -32
  11. data/modules/emscripten/emlink.py +16 -13
  12. data/modules/emscripten/emmake +1 -1
  13. data/modules/emscripten/emrun +918 -0
  14. data/modules/emscripten/emrun.bat +2 -0
  15. data/modules/emscripten/emscripten.py +545 -20
  16. data/modules/emscripten/src/analyzer.js +6 -1
  17. data/modules/emscripten/src/compiler.js +25 -16
  18. data/modules/emscripten/src/emrun_postjs.js +20 -0
  19. data/modules/emscripten/{tests → src}/hello_world.js +0 -0
  20. data/modules/emscripten/src/intertyper.js +45 -16
  21. data/modules/emscripten/src/jsifier.js +78 -48
  22. data/modules/emscripten/src/library.js +381 -96
  23. data/modules/emscripten/src/library_browser.js +50 -53
  24. data/modules/emscripten/src/library_egl.js +66 -24
  25. data/modules/emscripten/src/library_fs.js +122 -90
  26. data/modules/emscripten/src/library_gl.js +739 -353
  27. data/modules/emscripten/src/library_glfw.js +9 -3
  28. data/modules/emscripten/src/library_glut.js +10 -5
  29. data/modules/emscripten/src/library_idbfs.js +14 -14
  30. data/modules/emscripten/src/library_memfs.js +65 -41
  31. data/modules/emscripten/src/library_nodefs.js +61 -9
  32. data/modules/emscripten/src/library_openal.js +4 -4
  33. data/modules/emscripten/src/library_path.js +9 -13
  34. data/modules/emscripten/src/library_sdl.js +301 -64
  35. data/modules/emscripten/src/library_sockfs.js +7 -5
  36. data/modules/emscripten/src/modules.js +62 -22
  37. data/modules/emscripten/src/parseTools.js +135 -102
  38. data/modules/emscripten/src/postamble.js +3 -4
  39. data/modules/emscripten/src/preamble.js +49 -29
  40. data/modules/emscripten/src/proxyClient.js +1 -1
  41. data/modules/emscripten/src/proxyWorker.js +10 -10
  42. data/modules/emscripten/src/relooper/Relooper.cpp +15 -4
  43. data/modules/emscripten/src/runtime.js +32 -8
  44. data/modules/emscripten/src/settings.js +25 -8
  45. data/modules/emscripten/src/shell.html +6 -3
  46. data/modules/emscripten/src/shell.js +13 -11
  47. data/modules/emscripten/src/simd.js +602 -432
  48. data/modules/emscripten/src/struct_info.json +22 -2
  49. data/modules/emscripten/src/utility.js +32 -17
  50. data/modules/emscripten/system/include/SDL/SDL_events.h +1 -0
  51. data/modules/emscripten/system/include/compat/ctype.h +17 -0
  52. data/modules/emscripten/system/include/compat/wchar.h +23 -0
  53. data/modules/emscripten/system/include/compat/wctype.h +23 -0
  54. data/modules/emscripten/system/include/emscripten/emmintrin.h +87 -0
  55. data/modules/emscripten/system/include/emscripten/emscripten.h +30 -4
  56. data/modules/emscripten/system/include/emscripten/vector.h +29 -1
  57. data/modules/emscripten/system/include/emscripten/xmmintrin.h +131 -0
  58. data/modules/emscripten/system/include/libcxx/CREDITS.TXT +9 -1
  59. data/modules/emscripten/system/include/libcxx/__bit_reference +8 -8
  60. data/modules/emscripten/system/include/libcxx/__config +95 -17
  61. data/modules/emscripten/system/include/libcxx/__debug +25 -4
  62. data/modules/emscripten/system/include/libcxx/__functional_03 +7 -7
  63. data/modules/emscripten/system/include/libcxx/__functional_base +169 -9
  64. data/modules/emscripten/system/include/libcxx/__functional_base_03 +1 -1
  65. data/modules/emscripten/system/include/libcxx/__hash_table +25 -25
  66. data/modules/emscripten/system/include/libcxx/__locale +21 -19
  67. data/modules/emscripten/system/include/libcxx/__mutex_base +2 -33
  68. data/modules/emscripten/system/include/libcxx/__split_buffer +9 -9
  69. data/modules/emscripten/system/include/libcxx/__std_stream +14 -0
  70. data/modules/emscripten/system/include/libcxx/__tree +35 -26
  71. data/modules/emscripten/system/include/libcxx/__tuple +15 -15
  72. data/modules/emscripten/system/include/libcxx/__tuple_03 +2 -2
  73. data/modules/emscripten/system/include/libcxx/__undef_min_max +8 -0
  74. data/modules/emscripten/system/include/libcxx/algorithm +121 -110
  75. data/modules/emscripten/system/include/libcxx/array +15 -15
  76. data/modules/emscripten/system/include/libcxx/bitset +4 -4
  77. data/modules/emscripten/system/include/libcxx/chrono +51 -17
  78. data/modules/emscripten/system/include/libcxx/cmath +25 -23
  79. data/modules/emscripten/system/include/libcxx/codecvt +21 -18
  80. data/modules/emscripten/system/include/libcxx/complex +48 -7
  81. data/modules/emscripten/system/include/libcxx/cstddef +1 -1
  82. data/modules/emscripten/system/include/libcxx/cstdio +8 -1
  83. data/modules/emscripten/system/include/libcxx/cstdlib +1 -1
  84. data/modules/emscripten/system/include/libcxx/cwchar +1 -1
  85. data/modules/emscripten/system/include/libcxx/deque +26 -12
  86. data/modules/emscripten/system/include/libcxx/dynarray +311 -0
  87. data/modules/emscripten/system/include/libcxx/exception +4 -4
  88. data/modules/emscripten/system/include/libcxx/ext/__hash +3 -3
  89. data/modules/emscripten/system/include/libcxx/ext/hash_map +19 -15
  90. data/modules/emscripten/system/include/libcxx/ext/hash_set +7 -3
  91. data/modules/emscripten/system/include/libcxx/forward_list +33 -7
  92. data/modules/emscripten/system/include/libcxx/fstream +4 -4
  93. data/modules/emscripten/system/include/libcxx/functional +200 -170
  94. data/modules/emscripten/system/include/libcxx/future +83 -39
  95. data/modules/emscripten/system/include/libcxx/initializer_list +24 -11
  96. data/modules/emscripten/system/include/libcxx/iomanip +147 -0
  97. data/modules/emscripten/system/include/libcxx/ios +24 -16
  98. data/modules/emscripten/system/include/libcxx/iosfwd +19 -19
  99. data/modules/emscripten/system/include/libcxx/istream +13 -8
  100. data/modules/emscripten/system/include/libcxx/iterator +108 -417
  101. data/modules/emscripten/system/include/libcxx/limits +8 -4
  102. data/modules/emscripten/system/include/libcxx/list +28 -8
  103. data/modules/emscripten/system/include/libcxx/locale +153 -390
  104. data/modules/emscripten/system/include/libcxx/map +280 -100
  105. data/modules/emscripten/system/include/libcxx/memory +49 -97
  106. data/modules/emscripten/system/include/libcxx/mutex +2 -2
  107. data/modules/emscripten/system/include/libcxx/new +43 -14
  108. data/modules/emscripten/system/include/libcxx/numeric +2 -2
  109. data/modules/emscripten/system/include/libcxx/optional +697 -0
  110. data/modules/emscripten/system/include/libcxx/ostream +17 -8
  111. data/modules/emscripten/system/include/libcxx/queue +5 -5
  112. data/modules/emscripten/system/include/libcxx/random +53 -51
  113. data/modules/emscripten/system/include/libcxx/ratio +11 -11
  114. data/modules/emscripten/system/include/libcxx/readme.txt +1 -1
  115. data/modules/emscripten/system/include/libcxx/regex +23 -20
  116. data/modules/emscripten/system/include/libcxx/scoped_allocator +1 -1
  117. data/modules/emscripten/system/include/libcxx/set +166 -2
  118. data/modules/emscripten/system/include/libcxx/shared_mutex +419 -0
  119. data/modules/emscripten/system/include/libcxx/sstream +4 -4
  120. data/modules/emscripten/system/include/libcxx/stack +3 -3
  121. data/modules/emscripten/system/include/libcxx/streambuf +5 -5
  122. data/modules/emscripten/system/include/libcxx/string +372 -324
  123. data/modules/emscripten/system/include/libcxx/support/ibm/limits.h +99 -0
  124. data/modules/emscripten/system/include/libcxx/support/ibm/support.h +54 -0
  125. data/modules/emscripten/system/include/libcxx/support/ibm/xlocale.h +326 -0
  126. data/modules/emscripten/system/include/libcxx/support/win32/limits_win32.h +6 -6
  127. data/modules/emscripten/system/include/libcxx/support/win32/locale_win32.h +15 -15
  128. data/modules/emscripten/system/include/libcxx/support/win32/math_win32.h +2 -0
  129. data/modules/emscripten/system/include/libcxx/support/win32/support.h +6 -1
  130. data/modules/emscripten/system/include/libcxx/system_error +14 -8
  131. data/modules/emscripten/system/include/libcxx/thread +7 -8
  132. data/modules/emscripten/system/include/libcxx/tuple +29 -88
  133. data/modules/emscripten/system/include/libcxx/type_traits +253 -209
  134. data/modules/emscripten/system/include/libcxx/typeindex +3 -3
  135. data/modules/emscripten/system/include/libcxx/unordered_map +162 -101
  136. data/modules/emscripten/system/include/libcxx/unordered_set +79 -2
  137. data/modules/emscripten/system/include/libcxx/utility +20 -20
  138. data/modules/emscripten/system/include/libcxx/valarray +23 -23
  139. data/modules/emscripten/system/include/libcxx/vector +114 -91
  140. data/modules/emscripten/system/lib/libc/musl/src/regex/regcomp.c +3352 -0
  141. data/modules/emscripten/system/lib/libc/musl/src/regex/regerror.c +35 -0
  142. data/modules/emscripten/system/lib/libc/musl/src/regex/regexec.c +1011 -0
  143. data/modules/emscripten/system/lib/libc/musl/src/regex/tre-mem.c +158 -0
  144. data/modules/emscripten/system/lib/libc/musl/src/regex/tre.h +231 -0
  145. data/modules/emscripten/system/lib/libcextra.symbols +7 -0
  146. data/modules/emscripten/system/lib/libcxx/CREDITS.TXT +9 -1
  147. data/modules/emscripten/system/lib/libcxx/algorithm.cpp +1 -0
  148. data/modules/emscripten/system/lib/libcxx/debug.cpp +66 -42
  149. data/modules/emscripten/system/lib/libcxx/exception.cpp +88 -16
  150. data/modules/emscripten/system/lib/libcxx/future.cpp +6 -0
  151. data/modules/emscripten/system/lib/libcxx/ios.cpp +7 -2
  152. data/modules/emscripten/system/lib/libcxx/iostream.cpp +8 -8
  153. data/modules/emscripten/system/lib/libcxx/locale.cpp +38 -11
  154. data/modules/emscripten/system/lib/libcxx/mutex.cpp +3 -0
  155. data/modules/emscripten/system/lib/libcxx/new.cpp +44 -10
  156. data/modules/emscripten/system/lib/libcxx/optional.cpp +25 -0
  157. data/modules/emscripten/system/lib/libcxx/random.cpp +26 -0
  158. data/modules/emscripten/system/lib/libcxx/readme.txt +1 -1
  159. data/modules/emscripten/system/lib/libcxx/shared_mutex.cpp +101 -0
  160. data/modules/emscripten/system/lib/libcxx/stdexcept.cpp +11 -7
  161. data/modules/emscripten/system/lib/libcxx/string.cpp +3 -1
  162. data/modules/emscripten/system/lib/libcxx/strstream.cpp +7 -7
  163. data/modules/emscripten/system/lib/libcxx/support/win32/locale_win32.cpp +12 -13
  164. data/modules/emscripten/system/lib/libcxx/support/win32/support.cpp +33 -36
  165. data/modules/emscripten/system/lib/libcxx/symbols +187 -168
  166. data/modules/emscripten/system/lib/libcxx/system_error.cpp +1 -0
  167. data/modules/emscripten/system/lib/libcxx/thread.cpp +7 -3
  168. data/modules/emscripten/system/lib/libcxx/typeinfo.cpp +9 -6
  169. data/modules/emscripten/system/lib/libcxx/valarray.cpp +2 -0
  170. data/modules/emscripten/third_party/lzma.js/doit.bat +4 -0
  171. data/modules/emscripten/third_party/lzma.js/doit.sh +9 -2
  172. data/modules/emscripten/tools/cache.py +5 -7
  173. data/modules/emscripten/tools/cache.pyc +0 -0
  174. data/modules/emscripten/tools/eliminator/asm-eliminator-test-output.js +7 -0
  175. data/modules/emscripten/tools/eliminator/asm-eliminator-test.js +9 -1
  176. data/modules/emscripten/tools/eliminator/eliminator-test-output.js +3 -0
  177. data/modules/emscripten/tools/eliminator/eliminator-test.js +9 -1
  178. data/modules/emscripten/tools/file_packager.py +93 -50
  179. data/modules/emscripten/tools/js-optimizer.js +98 -48
  180. data/modules/emscripten/tools/js_optimizer.py +4 -4
  181. data/modules/emscripten/tools/js_optimizer.pyc +0 -0
  182. data/modules/emscripten/tools/jsrun.py +1 -1
  183. data/modules/emscripten/tools/jsrun.pyc +0 -0
  184. data/modules/emscripten/tools/response_file.py +6 -0
  185. data/modules/emscripten/tools/response_file.pyc +0 -0
  186. data/modules/emscripten/tools/settings_template_readonly.py +2 -0
  187. data/modules/emscripten/tools/shared.py +88 -34
  188. data/modules/emscripten/tools/shared.pyc +0 -0
  189. data/modules/emscripten/tools/split.py +21 -13
  190. data/modules/mruby/build_config.rb +7 -1
  191. data/modules/mruby/doc/compile/README.md +5 -9
  192. data/modules/mruby/include/mrbconf.h +5 -2
  193. data/modules/mruby/include/mruby/array.h +1 -0
  194. data/modules/mruby/include/mruby/compile.h +2 -4
  195. data/modules/mruby/include/mruby/dump.h +7 -16
  196. data/modules/mruby/include/mruby/hash.h +1 -1
  197. data/modules/mruby/include/mruby/irep.h +14 -2
  198. data/modules/mruby/include/mruby/khash.h +8 -7
  199. data/modules/mruby/include/mruby/string.h +1 -0
  200. data/modules/mruby/include/mruby/value.h +5 -2
  201. data/modules/mruby/include/mruby.h +12 -13
  202. data/modules/mruby/mrbgems/mruby-bin-mirb/tools/mirb/mirb.c +16 -6
  203. data/modules/mruby/mrbgems/mruby-bin-mruby/tools/mruby/mruby.c +18 -30
  204. data/modules/mruby/mrbgems/mruby-fiber/src/fiber.c +21 -0
  205. data/modules/mruby/mrbgems/mruby-math/src/math.c +1 -1
  206. data/modules/mruby/mrbgems/mruby-random/src/random.c +144 -47
  207. data/modules/mruby/mrbgems/mruby-random/test/random.rb +44 -0
  208. data/modules/mruby/mrbgems/mruby-struct/src/struct.c +5 -5
  209. data/modules/mruby/mrblib/numeric.rb +99 -33
  210. data/modules/mruby/src/array.c +11 -4
  211. data/modules/mruby/src/backtrace.c +2 -2
  212. data/modules/mruby/src/class.c +49 -30
  213. data/modules/mruby/src/codegen.c +131 -79
  214. data/modules/mruby/src/debug.c +1 -1
  215. data/modules/mruby/src/dump.c +213 -163
  216. data/modules/mruby/src/error.c +17 -17
  217. data/modules/mruby/src/error.h +1 -1
  218. data/modules/mruby/src/etc.c +10 -0
  219. data/modules/mruby/src/gc.c +35 -17
  220. data/modules/mruby/src/hash.c +5 -5
  221. data/modules/mruby/src/kernel.c +36 -14
  222. data/modules/mruby/src/load.c +238 -296
  223. data/modules/mruby/src/numeric.c +18 -98
  224. data/modules/mruby/src/object.c +3 -5
  225. data/modules/mruby/src/parse.y +63 -56
  226. data/modules/mruby/src/proc.c +8 -5
  227. data/modules/mruby/src/re.h +0 -1
  228. data/modules/mruby/src/state.c +65 -27
  229. data/modules/mruby/src/string.c +3 -31
  230. data/modules/mruby/src/symbol.c +3 -3
  231. data/modules/mruby/src/variable.c +12 -5
  232. data/modules/mruby/src/vm.c +90 -72
  233. data/modules/mruby/tasks/mruby_build.rake +10 -1
  234. data/modules/mruby/tasks/toolchains/gcc.rake +12 -2
  235. data/modules/mruby/tasks/toolchains/{vs2012.rake → visualcpp.rake} +1 -1
  236. data/modules/mruby/test/driver.c +3 -3
  237. data/modules/mruby/test/t/array.rb +5 -5
  238. data/modules/mruby/test/t/class.rb +14 -1
  239. data/modules/mruby/test/t/kernel.rb +4 -0
  240. data/modules/mruby/test/t/module.rb +4 -4
  241. data/modules/mruby/test/t/nameerror.rb +1 -1
  242. data/modules/mruby/tools/mrbc/mrbc.c +23 -17
  243. data/modules/mruby/travis_config.rb +10 -1
  244. metadata +28 -5
  245. data/modules/mruby/tasks/toolchains/vs2010.rake +0 -3
@@ -10,6 +10,7 @@
10
10
  #include <stdio.h>
11
11
 
12
12
  #include "exception"
13
+ #include "new"
13
14
 
14
15
  #ifndef __has_include
15
16
  #define __has_include(inc) 0
@@ -90,14 +91,14 @@ terminate() _NOEXCEPT
90
91
  (*get_terminate())();
91
92
  // handler should not return
92
93
  printf("terminate_handler unexpectedly returned\n");
93
- ::abort ();
94
+ ::abort();
94
95
  #ifndef _LIBCPP_NO_EXCEPTIONS
95
96
  }
96
97
  catch (...)
97
98
  {
98
99
  // handler should not throw exception
99
100
  printf("terminate_handler unexpectedly threw an exception\n");
100
- ::abort ();
101
+ ::abort();
101
102
  }
102
103
  #endif // _LIBCPP_NO_EXCEPTIONS
103
104
  }
@@ -111,12 +112,17 @@ bool uncaught_exception() _NOEXCEPT
111
112
  // on Darwin, there is a helper function so __cxa_get_globals is private
112
113
  return __cxa_uncaught_exception();
113
114
  #else // __APPLE__
114
- #warning uncaught_exception not yet implemented
115
+ # if defined(_MSC_VER) && ! defined(__clang__)
116
+ _LIBCPP_WARNING("uncaught_exception not yet implemented")
117
+ # else
118
+ # warning uncaught_exception not yet implemented
119
+ # endif
115
120
  printf("uncaught_exception not yet implemented\n");
116
121
  ::abort();
117
122
  #endif // __APPLE__
118
123
  }
119
124
 
125
+
120
126
  #ifndef _LIBCPPABI_VERSION
121
127
 
122
128
  exception::~exception() _NOEXCEPT
@@ -143,16 +149,50 @@ const char* bad_exception::what() const _NOEXCEPT
143
149
 
144
150
  #endif
145
151
 
152
+ #if defined(__GLIBCXX__)
153
+
154
+ // libsupc++ does not implement the dependent EH ABI and the functionality
155
+ // it uses to implement std::exception_ptr (which it declares as an alias of
156
+ // std::__exception_ptr::exception_ptr) is not directly exported to clients. So
157
+ // we have little choice but to hijack std::__exception_ptr::exception_ptr's
158
+ // (which fortunately has the same layout as our std::exception_ptr) copy
159
+ // constructor, assignment operator and destructor (which are part of its
160
+ // stable ABI), and its rethrow_exception(std::__exception_ptr::exception_ptr)
161
+ // function.
162
+
163
+ namespace __exception_ptr
164
+ {
165
+
166
+ struct exception_ptr
167
+ {
168
+ void* __ptr_;
169
+
170
+ exception_ptr(const exception_ptr&) _NOEXCEPT;
171
+ exception_ptr& operator=(const exception_ptr&) _NOEXCEPT;
172
+ ~exception_ptr() _NOEXCEPT;
173
+ };
174
+
175
+ }
176
+
177
+ _LIBCPP_NORETURN void rethrow_exception(__exception_ptr::exception_ptr);
178
+
179
+ #endif
146
180
 
147
181
  exception_ptr::~exception_ptr() _NOEXCEPT
148
182
  {
149
183
  #if HAVE_DEPENDENT_EH_ABI
150
184
  __cxa_decrement_exception_refcount(__ptr_);
185
+ #elif defined(__GLIBCXX__)
186
+ reinterpret_cast<__exception_ptr::exception_ptr*>(this)->~exception_ptr();
151
187
  #else
152
- #warning exception_ptr not yet implemented
188
+ # if defined(_MSC_VER) && ! defined(__clang__)
189
+ _LIBCPP_WARNING("exception_ptr not yet implemented")
190
+ # else
191
+ # warning exception_ptr not yet implemented
192
+ # endif
153
193
  printf("exception_ptr not yet implemented\n");
154
194
  ::abort();
155
- #endif // __APPLE__
195
+ #endif
156
196
  }
157
197
 
158
198
  exception_ptr::exception_ptr(const exception_ptr& other) _NOEXCEPT
@@ -160,11 +200,18 @@ exception_ptr::exception_ptr(const exception_ptr& other) _NOEXCEPT
160
200
  {
161
201
  #if HAVE_DEPENDENT_EH_ABI
162
202
  __cxa_increment_exception_refcount(__ptr_);
203
+ #elif defined(__GLIBCXX__)
204
+ new (reinterpret_cast<void*>(this)) __exception_ptr::exception_ptr(
205
+ reinterpret_cast<const __exception_ptr::exception_ptr&>(other));
163
206
  #else
164
- #warning exception_ptr not yet implemented
207
+ # if defined(_MSC_VER) && ! defined(__clang__)
208
+ _LIBCPP_WARNING("exception_ptr not yet implemented")
209
+ # else
210
+ # warning exception_ptr not yet implemented
211
+ # endif
165
212
  printf("exception_ptr not yet implemented\n");
166
213
  ::abort();
167
- #endif // __APPLE__
214
+ #endif
168
215
  }
169
216
 
170
217
  exception_ptr& exception_ptr::operator=(const exception_ptr& other) _NOEXCEPT
@@ -177,11 +224,19 @@ exception_ptr& exception_ptr::operator=(const exception_ptr& other) _NOEXCEPT
177
224
  __ptr_ = other.__ptr_;
178
225
  }
179
226
  return *this;
180
- #else // __APPLE__
181
- #warning exception_ptr not yet implemented
227
+ #elif defined(__GLIBCXX__)
228
+ *reinterpret_cast<__exception_ptr::exception_ptr*>(this) =
229
+ reinterpret_cast<const __exception_ptr::exception_ptr&>(other);
230
+ return *this;
231
+ #else
232
+ # if defined(_MSC_VER) && ! defined(__clang__)
233
+ _LIBCPP_WARNING("exception_ptr not yet implemented")
234
+ # else
235
+ # warning exception_ptr not yet implemented
236
+ # endif
182
237
  printf("exception_ptr not yet implemented\n");
183
238
  ::abort();
184
- #endif // __APPLE__
239
+ #endif
185
240
  }
186
241
 
187
242
  nested_exception::nested_exception() _NOEXCEPT
@@ -189,10 +244,14 @@ nested_exception::nested_exception() _NOEXCEPT
189
244
  {
190
245
  }
191
246
 
247
+ #if !defined(__GLIBCXX__)
248
+
192
249
  nested_exception::~nested_exception() _NOEXCEPT
193
250
  {
194
251
  }
195
252
 
253
+ #endif
254
+
196
255
  _LIBCPP_NORETURN
197
256
  void
198
257
  nested_exception::rethrow_nested() const
@@ -202,6 +261,7 @@ nested_exception::rethrow_nested() const
202
261
  rethrow_exception(__ptr_);
203
262
  }
204
263
 
264
+ #if !defined(__GLIBCXX__)
205
265
 
206
266
  exception_ptr current_exception() _NOEXCEPT
207
267
  {
@@ -212,13 +272,19 @@ exception_ptr current_exception() _NOEXCEPT
212
272
  exception_ptr ptr;
213
273
  ptr.__ptr_ = __cxa_current_primary_exception();
214
274
  return ptr;
215
- #else // __APPLE__
216
- #warning exception_ptr not yet implemented
275
+ #else
276
+ # if defined(_MSC_VER) && ! defined(__clang__)
277
+ _LIBCPP_WARNING( "exception_ptr not yet implemented" )
278
+ # else
279
+ # warning exception_ptr not yet implemented
280
+ # endif
217
281
  printf("exception_ptr not yet implemented\n");
218
282
  ::abort();
219
- #endif // __APPLE__
283
+ #endif
220
284
  }
221
285
 
286
+ #endif // !__GLIBCXX__
287
+
222
288
  _LIBCPP_NORETURN
223
289
  void rethrow_exception(exception_ptr p)
224
290
  {
@@ -226,10 +292,16 @@ void rethrow_exception(exception_ptr p)
226
292
  __cxa_rethrow_primary_exception(p.__ptr_);
227
293
  // if p.__ptr_ is NULL, above returns so we terminate
228
294
  terminate();
229
- #else // __APPLE__
230
- #warning exception_ptr not yet implemented
295
+ #elif defined(__GLIBCXX__)
296
+ rethrow_exception(reinterpret_cast<__exception_ptr::exception_ptr&>(p));
297
+ #else
298
+ # if defined(_MSC_VER) && ! defined(__clang__)
299
+ _LIBCPP_WARNING("exception_ptr not yet implemented")
300
+ # else
301
+ # warning exception_ptr not yet implemented
302
+ # endif
231
303
  printf("exception_ptr not yet implemented\n");
232
304
  ::abort();
233
- #endif // __APPLE__
305
+ #endif
234
306
  }
235
307
  } // std
@@ -26,11 +26,15 @@ __future_error_category::name() const _NOEXCEPT
26
26
  return "future";
27
27
  }
28
28
 
29
+ #pragma clang diagnostic push
30
+ #pragma clang diagnostic ignored "-Wswitch"
31
+
29
32
  string
30
33
  __future_error_category::message(int ev) const
31
34
  {
32
35
  switch (static_cast<future_errc>(ev))
33
36
  {
37
+ case future_errc(0): // For backwards compatibility with C++11 (LWG 2056)
34
38
  case future_errc::broken_promise:
35
39
  return string("The associated promise has been destructed prior "
36
40
  "to the associated state becoming ready.");
@@ -46,6 +50,8 @@ __future_error_category::message(int ev) const
46
50
  return string("unspecified future_errc value\n");
47
51
  }
48
52
 
53
+ #pragma clang diagnostic pop
54
+
49
55
  const error_category&
50
56
  future_category() _NOEXCEPT
51
57
  {
@@ -7,6 +7,8 @@
7
7
  //
8
8
  //===----------------------------------------------------------------------===//
9
9
 
10
+ #define _LIBCPP_EXTERN_TEMPLATE(...) extern template __VA_ARGS__;
11
+
10
12
  #include "ios"
11
13
  #include "streambuf"
12
14
  #include "istream"
@@ -61,7 +63,7 @@ __iostream_category::message(int ev) const
61
63
  }
62
64
 
63
65
  const error_category&
64
- iostream_category()
66
+ iostream_category() _NOEXCEPT
65
67
  {
66
68
  static __iostream_category s;
67
69
  return s;
@@ -147,8 +149,11 @@ ios_base::getloc() const
147
149
  }
148
150
 
149
151
  // xalloc
150
-
152
+ #if __has_feature(cxx_atomic) && !defined(__EMSCRIPTEN__)
153
+ atomic<int> ios_base::__xindex_ = ATOMIC_VAR_INIT(0);
154
+ #else
151
155
  int ios_base::__xindex_ = 0;
156
+ #endif
152
157
 
153
158
  int
154
159
  ios_base::xalloc()
@@ -22,14 +22,14 @@ _ALIGNAS_TYPE (__stdinbuf<wchar_t> ) static char __wcin [sizeof(__stdinbuf <wcha
22
22
  _ALIGNAS_TYPE (__stdoutbuf<wchar_t>) static char __wcout[sizeof(__stdoutbuf<wchar_t>)];
23
23
  _ALIGNAS_TYPE (__stdoutbuf<wchar_t>) static char __wcerr[sizeof(__stdoutbuf<wchar_t>)];
24
24
 
25
- _ALIGNAS_TYPE (istream) char cin [sizeof(istream)];
26
- _ALIGNAS_TYPE (ostream) char cout[sizeof(ostream)];
27
- _ALIGNAS_TYPE (ostream) char cerr[sizeof(ostream)];
28
- _ALIGNAS_TYPE (ostream) char clog[sizeof(ostream)];
29
- _ALIGNAS_TYPE (wistream) char wcin [sizeof(wistream)];
30
- _ALIGNAS_TYPE (wostream) char wcout[sizeof(wostream)];
31
- _ALIGNAS_TYPE (wostream) char wcerr[sizeof(wostream)];
32
- _ALIGNAS_TYPE (wostream) char wclog[sizeof(wostream)];
25
+ _ALIGNAS_TYPE (istream) _LIBCPP_FUNC_VIS char cin [sizeof(istream)];
26
+ _ALIGNAS_TYPE (ostream) _LIBCPP_FUNC_VIS char cout[sizeof(ostream)];
27
+ _ALIGNAS_TYPE (ostream) _LIBCPP_FUNC_VIS char cerr[sizeof(ostream)];
28
+ _ALIGNAS_TYPE (ostream) _LIBCPP_FUNC_VIS char clog[sizeof(ostream)];
29
+ _ALIGNAS_TYPE (wistream) _LIBCPP_FUNC_VIS char wcin [sizeof(wistream)];
30
+ _ALIGNAS_TYPE (wostream) _LIBCPP_FUNC_VIS char wcout[sizeof(wostream)];
31
+ _ALIGNAS_TYPE (wostream) _LIBCPP_FUNC_VIS char wcerr[sizeof(wostream)];
32
+ _ALIGNAS_TYPE (wostream) _LIBCPP_FUNC_VIS char wclog[sizeof(wostream)];
33
33
 
34
34
  ios_base::Init __start_std_streams;
35
35
 
@@ -7,6 +7,8 @@
7
7
  //
8
8
  //===----------------------------------------------------------------------===//
9
9
 
10
+ #define _LIBCPP_EXTERN_TEMPLATE(...) extern template __VA_ARGS__;
11
+
10
12
  // On Solaris, we need to define something to make the C99 parts of localeconv
11
13
  // visible.
12
14
  #ifdef __sun__
@@ -26,7 +28,7 @@
26
28
  #include "cstring"
27
29
  #include "cwctype"
28
30
  #include "__sso_allocator"
29
- #ifdef _LIBCPP_MSVCRT
31
+ #if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__)
30
32
  #include <support/win32/locale_win32.h>
31
33
  #else // _LIBCPP_MSVCRT
32
34
  #include <langinfo.h>
@@ -36,7 +38,9 @@
36
38
 
37
39
  // On Linux, wint_t and wchar_t have different signed-ness, and this causes
38
40
  // lots of noise in the build log, but no bugs that I know of.
41
+ #if defined(__clang__)
39
42
  #pragma clang diagnostic ignored "-Wsign-conversion"
43
+ #endif
40
44
 
41
45
  _LIBCPP_BEGIN_NAMESPACE_STD
42
46
 
@@ -107,6 +111,11 @@ countof(const T * const begin, const T * const end)
107
111
 
108
112
  }
109
113
 
114
+ #if defined(_AIX)
115
+ // Set priority to INT_MIN + 256 + 150
116
+ # pragma priority ( -2147483242 )
117
+ #endif
118
+
110
119
  const locale::category locale::none;
111
120
  const locale::category locale::collate;
112
121
  const locale::category locale::ctype;
@@ -116,14 +125,23 @@ const locale::category locale::time;
116
125
  const locale::category locale::messages;
117
126
  const locale::category locale::all;
118
127
 
128
+ #if defined(__clang__)
119
129
  #pragma clang diagnostic push
120
130
  #pragma clang diagnostic ignored "-Wpadded"
131
+ #endif
121
132
 
122
133
  class _LIBCPP_HIDDEN locale::__imp
123
134
  : public facet
124
135
  {
125
136
  enum {N = 28};
137
+ #if defined(_LIBCPP_MSVC)
138
+ // FIXME: MSVC doesn't support aligned parameters by value.
139
+ // I can't get the __sso_allocator to work here
140
+ // for MSVC I think for this reason.
141
+ vector<facet*> facets_;
142
+ #else
126
143
  vector<facet*, __sso_allocator<facet*, N> > facets_;
144
+ #endif
127
145
  string name_;
128
146
  public:
129
147
  explicit __imp(size_t refs = 0);
@@ -147,7 +165,9 @@ private:
147
165
  template <class F> void install_from(const __imp& other);
148
166
  };
149
167
 
168
+ #if defined(__clang__)
150
169
  #pragma clang diagnostic pop
170
+ #endif
151
171
 
152
172
  locale::__imp::__imp(size_t refs)
153
173
  : facet(refs),
@@ -757,7 +777,7 @@ ctype<wchar_t>::~ctype()
757
777
  bool
758
778
  ctype<wchar_t>::do_is(mask m, char_type c) const
759
779
  {
760
- return isascii(c) ? ctype<char>::classic_table()[c] & m : false;
780
+ return isascii(c) ? (ctype<char>::classic_table()[c] & m) != 0 : false;
761
781
  }
762
782
 
763
783
  const wchar_t*
@@ -1009,12 +1029,14 @@ ctype<char>::classic_table() _NOEXCEPT
1009
1029
  return __cloc()->__ctype_b;
1010
1030
  #elif __sun__
1011
1031
  return __ctype_mask;
1012
- #elif defined(_LIBCPP_MSVCRT)
1032
+ #elif defined(_LIBCPP_MSVCRT) || defined(__MINGW32__)
1013
1033
  return _ctype+1; // internal ctype mask table defined in msvcrt.dll
1014
1034
  // This is assumed to be safe, which is a nonsense assumption because we're
1015
1035
  // going to end up dereferencing it later...
1016
1036
  #elif defined(__EMSCRIPTEN__)
1017
1037
  return *__ctype_b_loc();
1038
+ #elif defined(_AIX)
1039
+ return (const unsigned long *)__lc_ctype_ptr->obj->mask;
1018
1040
  #else
1019
1041
  // Platform not supported: abort so the person doing the port knows what to
1020
1042
  // fix
@@ -4350,7 +4372,7 @@ __num_put_base::__format_float(char* __fmtp, const char* __len,
4350
4372
  if (__flags & ios_base::showpoint)
4351
4373
  *__fmtp++ = '#';
4352
4374
  ios_base::fmtflags floatfield = __flags & ios_base::floatfield;
4353
- bool uppercase = __flags & ios_base::uppercase;
4375
+ bool uppercase = (__flags & ios_base::uppercase) != 0;
4354
4376
  if (floatfield == (ios_base::fixed | ios_base::scientific))
4355
4377
  specify_precision = false;
4356
4378
  else
@@ -4681,9 +4703,12 @@ __time_get::~__time_get()
4681
4703
  {
4682
4704
  freelocale(__loc_);
4683
4705
  }
4684
-
4706
+ #if defined(__clang__)
4685
4707
  #pragma clang diagnostic ignored "-Wmissing-field-initializers"
4708
+ #endif
4709
+ #if defined(__GNUG__)
4686
4710
  #pragma GCC diagnostic ignored "-Wmissing-field-initializers"
4711
+ #endif
4687
4712
 
4688
4713
  template <>
4689
4714
  string
@@ -4829,7 +4854,9 @@ __time_get_storage<char>::__analyze(char fmt, const ctype<char>& ct)
4829
4854
  return result;
4830
4855
  }
4831
4856
 
4857
+ #if defined(__clang__)
4832
4858
  #pragma clang diagnostic ignored "-Wmissing-braces"
4859
+ #endif
4833
4860
 
4834
4861
  template <>
4835
4862
  wstring
@@ -5848,7 +5875,7 @@ moneypunct_byname<char, true>::init(const char* nm)
5848
5875
  __frac_digits_ = lc->int_frac_digits;
5849
5876
  else
5850
5877
  __frac_digits_ = base::do_frac_digits();
5851
- #ifdef _LIBCPP_MSVCRT
5878
+ #if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__)
5852
5879
  if (lc->p_sign_posn == 0)
5853
5880
  #else // _LIBCPP_MSVCRT
5854
5881
  if (lc->int_p_sign_posn == 0)
@@ -5856,7 +5883,7 @@ moneypunct_byname<char, true>::init(const char* nm)
5856
5883
  __positive_sign_ = "()";
5857
5884
  else
5858
5885
  __positive_sign_ = lc->positive_sign;
5859
- #ifdef _LIBCPP_MSVCRT
5886
+ #if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__)
5860
5887
  if(lc->n_sign_posn == 0)
5861
5888
  #else // _LIBCPP_MSVCRT
5862
5889
  if (lc->int_n_sign_posn == 0)
@@ -5868,7 +5895,7 @@ moneypunct_byname<char, true>::init(const char* nm)
5868
5895
  // the same places in curr_symbol since there's no way to
5869
5896
  // represent anything else.
5870
5897
  string_type __dummy_curr_symbol = __curr_symbol_;
5871
- #ifdef _LIBCPP_MSVCRT
5898
+ #if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__)
5872
5899
  __init_pat(__pos_format_, __dummy_curr_symbol, true,
5873
5900
  lc->p_cs_precedes, lc->p_sep_by_space, lc->p_sign_posn, ' ');
5874
5901
  __init_pat(__neg_format_, __curr_symbol_, true,
@@ -6007,7 +6034,7 @@ moneypunct_byname<wchar_t, true>::init(const char* nm)
6007
6034
  __frac_digits_ = lc->int_frac_digits;
6008
6035
  else
6009
6036
  __frac_digits_ = base::do_frac_digits();
6010
- #ifdef _LIBCPP_MSVCRT
6037
+ #if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__)
6011
6038
  if (lc->p_sign_posn == 0)
6012
6039
  #else // _LIBCPP_MSVCRT
6013
6040
  if (lc->int_p_sign_posn == 0)
@@ -6027,7 +6054,7 @@ moneypunct_byname<wchar_t, true>::init(const char* nm)
6027
6054
  wbe = wbuf + j;
6028
6055
  __positive_sign_.assign(wbuf, wbe);
6029
6056
  }
6030
- #ifdef _LIBCPP_MSVCRT
6057
+ #if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__)
6031
6058
  if (lc->n_sign_posn == 0)
6032
6059
  #else // _LIBCPP_MSVCRT
6033
6060
  if (lc->int_n_sign_posn == 0)
@@ -6051,7 +6078,7 @@ moneypunct_byname<wchar_t, true>::init(const char* nm)
6051
6078
  // the same places in curr_symbol since there's no way to
6052
6079
  // represent anything else.
6053
6080
  string_type __dummy_curr_symbol = __curr_symbol_;
6054
- #ifdef _LIBCPP_MSVCRT
6081
+ #if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__)
6055
6082
  __init_pat(__pos_format_, __dummy_curr_symbol, true,
6056
6083
  lc->p_cs_precedes, lc->p_sep_by_space, lc->p_sign_posn, L' ');
6057
6084
  __init_pat(__neg_format_, __curr_symbol_, true,
@@ -42,6 +42,7 @@ void
42
42
  mutex::unlock() _NOEXCEPT
43
43
  {
44
44
  int ec = pthread_mutex_unlock(&__m_);
45
+ (void)ec;
45
46
  assert(ec == 0);
46
47
  }
47
48
 
@@ -79,6 +80,7 @@ fail:
79
80
  recursive_mutex::~recursive_mutex()
80
81
  {
81
82
  int e = pthread_mutex_destroy(&__m_);
83
+ (void)e;
82
84
  assert(e == 0);
83
85
  }
84
86
 
@@ -94,6 +96,7 @@ void
94
96
  recursive_mutex::unlock() _NOEXCEPT
95
97
  {
96
98
  int e = pthread_mutex_unlock(&__m_);
99
+ (void)e;
97
100
  assert(e == 0);
98
101
  }
99
102
 
@@ -7,6 +7,8 @@
7
7
  //
8
8
  //===----------------------------------------------------------------------===//
9
9
 
10
+ #define _LIBCPP_BUILDING_NEW
11
+
10
12
  #include <stdlib.h>
11
13
 
12
14
  #include "new"
@@ -28,16 +30,18 @@
28
30
  #if defined(LIBCXXRT) || __has_include(<cxxabi.h>)
29
31
  #include <cxxabi.h>
30
32
  #endif // __has_include(<cxxabi.h>)
31
- #ifndef _LIBCPPABI_VERSION
33
+ #if !defined(_LIBCPPABI_VERSION) && !defined(__GLIBCXX__)
32
34
  static std::new_handler __new_handler;
33
35
  #endif // _LIBCPPABI_VERSION
34
36
  #endif
35
37
 
38
+ #ifndef __GLIBCXX__
39
+
36
40
  // Implement all new and delete operators as weak definitions
37
41
  // in this shared library, so that they can be overriden by programs
38
42
  // that define non-weak copies of the functions.
39
43
 
40
- __attribute__((__weak__, __visibility__("default")))
44
+ _LIBCPP_WEAK _LIBCPP_NEW_DELETE_VIS
41
45
  void *
42
46
  operator new(std::size_t size)
43
47
  #if !__has_feature(cxx_noexcept)
@@ -64,7 +68,7 @@ operator new(std::size_t size)
64
68
  return p;
65
69
  }
66
70
 
67
- __attribute__((__weak__, __visibility__("default")))
71
+ _LIBCPP_WEAK _LIBCPP_NEW_DELETE_VIS
68
72
  void*
69
73
  operator new(size_t size, const std::nothrow_t&) _NOEXCEPT
70
74
  {
@@ -83,7 +87,7 @@ operator new(size_t size, const std::nothrow_t&) _NOEXCEPT
83
87
  return p;
84
88
  }
85
89
 
86
- __attribute__((__weak__, __visibility__("default")))
90
+ _LIBCPP_WEAK _LIBCPP_NEW_DELETE_VIS
87
91
  void*
88
92
  operator new[](size_t size)
89
93
  #if !__has_feature(cxx_noexcept)
@@ -93,7 +97,7 @@ operator new[](size_t size)
93
97
  return ::operator new(size);
94
98
  }
95
99
 
96
- __attribute__((__weak__, __visibility__("default")))
100
+ _LIBCPP_WEAK _LIBCPP_NEW_DELETE_VIS
97
101
  void*
98
102
  operator new[](size_t size, const std::nothrow_t&) _NOEXCEPT
99
103
  {
@@ -112,7 +116,7 @@ operator new[](size_t size, const std::nothrow_t&) _NOEXCEPT
112
116
  return p;
113
117
  }
114
118
 
115
- __attribute__((__weak__, __visibility__("default")))
119
+ _LIBCPP_WEAK _LIBCPP_NEW_DELETE_VIS
116
120
  void
117
121
  operator delete(void* ptr) _NOEXCEPT
118
122
  {
@@ -120,34 +124,40 @@ operator delete(void* ptr) _NOEXCEPT
120
124
  ::free(ptr);
121
125
  }
122
126
 
123
- __attribute__((__weak__, __visibility__("default")))
127
+ _LIBCPP_WEAK _LIBCPP_NEW_DELETE_VIS
124
128
  void
125
129
  operator delete(void* ptr, const std::nothrow_t&) _NOEXCEPT
126
130
  {
127
131
  ::operator delete(ptr);
128
132
  }
129
133
 
130
- __attribute__((__weak__, __visibility__("default")))
134
+ _LIBCPP_WEAK _LIBCPP_NEW_DELETE_VIS
131
135
  void
132
136
  operator delete[] (void* ptr) _NOEXCEPT
133
137
  {
134
138
  ::operator delete (ptr);
135
139
  }
136
140
 
137
- __attribute__((__weak__, __visibility__("default")))
141
+ _LIBCPP_WEAK _LIBCPP_NEW_DELETE_VIS
138
142
  void
139
143
  operator delete[] (void* ptr, const std::nothrow_t&) _NOEXCEPT
140
144
  {
141
145
  ::operator delete[](ptr);
142
146
  }
143
147
 
148
+ #endif // !__GLIBCXX__
149
+
144
150
  namespace std
145
151
  {
146
152
 
153
+ #ifndef __GLIBCXX__
147
154
  const nothrow_t nothrow = {};
155
+ #endif
148
156
 
149
157
  #ifndef _LIBCPPABI_VERSION
150
158
 
159
+ #ifndef __GLIBCXX__
160
+
151
161
  new_handler
152
162
  set_new_handler(new_handler handler) _NOEXCEPT
153
163
  {
@@ -160,12 +170,16 @@ get_new_handler() _NOEXCEPT
160
170
  return __sync_fetch_and_add(&__new_handler, (new_handler)0);
161
171
  }
162
172
 
173
+ #endif // !__GLIBCXX__
174
+
163
175
  #ifndef LIBCXXRT
164
176
 
165
177
  bad_alloc::bad_alloc() _NOEXCEPT
166
178
  {
167
179
  }
168
180
 
181
+ #ifndef __GLIBCXX__
182
+
169
183
  bad_alloc::~bad_alloc() _NOEXCEPT
170
184
  {
171
185
  }
@@ -176,6 +190,8 @@ bad_alloc::what() const _NOEXCEPT
176
190
  return "std::bad_alloc";
177
191
  }
178
192
 
193
+ #endif // !__GLIBCXX__
194
+
179
195
  #endif //LIBCXXRT
180
196
 
181
197
  bad_array_new_length::bad_array_new_length() _NOEXCEPT
@@ -186,13 +202,29 @@ bad_array_new_length::~bad_array_new_length() _NOEXCEPT
186
202
  {
187
203
  }
188
204
 
205
+ const char*
206
+ bad_array_length::what() const _NOEXCEPT
207
+ {
208
+ return "bad_array_length";
209
+ }
210
+
211
+ bad_array_length::bad_array_length() _NOEXCEPT
212
+ {
213
+ }
214
+
215
+ bad_array_length::~bad_array_length() _NOEXCEPT
216
+ {
217
+ }
218
+
189
219
  const char*
190
220
  bad_array_new_length::what() const _NOEXCEPT
191
221
  {
192
222
  return "bad_array_new_length";
193
223
  }
194
224
 
195
- #endif
225
+ #endif // _LIBCPPABI_VERSION
226
+
227
+ #ifndef LIBSTDCXX
196
228
 
197
229
  void
198
230
  __throw_bad_alloc()
@@ -202,4 +234,6 @@ __throw_bad_alloc()
202
234
  #endif
203
235
  }
204
236
 
237
+ #endif // !LIBSTDCXX
238
+
205
239
  } // std
@@ -0,0 +1,25 @@
1
+ //===------------------------ optional.cpp --------------------------------===//
2
+ //
3
+ // The LLVM Compiler Infrastructure
4
+ //
5
+ // This file is dual licensed under the MIT and the University of Illinois Open
6
+ // Source Licenses. See LICENSE.TXT for details.
7
+ //
8
+ //===----------------------------------------------------------------------===//
9
+
10
+ #include "optional"
11
+
12
+ namespace std // purposefully not using versioning namespace
13
+ {
14
+
15
+ #ifdef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
16
+
17
+ bad_optional_access::~bad_optional_access() _NOEXCEPT {}
18
+
19
+ #else
20
+
21
+ bad_optional_access::~bad_optional_access() _NOEXCEPT = default;
22
+
23
+ #endif
24
+
25
+ } // std