diff options
| author | Dan Gohman <dan433584@gmail.com> | 2016-01-13 16:32:00 +0000 |
|---|---|---|
| committer | Dan Gohman <dan433584@gmail.com> | 2016-01-13 16:32:00 +0000 |
| commit | 4a9e173e08bff6887ae793ef52e8313611ef0abb (patch) | |
| tree | 420c3447050d7b05710c3d5af256c26936191811 | |
| parent | bf83f9aaf238a9f77d4219ecdc00d7fa2c6af539 (diff) | |
| download | bcm5719-llvm-4a9e173e08bff6887ae793ef52e8313611ef0abb.tar.gz bcm5719-llvm-4a9e173e08bff6887ae793ef52e8313611ef0abb.zip | |
[WebAssembly] Set std::numeric_limits's traps field for WebAssembly.
WebAssembly's integer division instruction traps on division by zero; set the
traps field of integral std::numeric_limits to true.
llvm-svn: 257612
| -rw-r--r-- | libcxx/include/limits | 3 | ||||
| -rw-r--r-- | libcxx/test/std/language.support/support.limits/limits/numeric.limits.members/traps.pass.cpp | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/libcxx/include/limits b/libcxx/include/limits index ce967ea1b23..80a1be40fe4 100644 --- a/libcxx/include/limits +++ b/libcxx/include/limits @@ -237,7 +237,8 @@ protected: static _LIBCPP_CONSTEXPR const bool is_bounded = true; static _LIBCPP_CONSTEXPR const bool is_modulo = !_VSTD::is_signed<_Tp>::value; -#if defined(__i386__) || defined(__x86_64__) || defined(__pnacl__) +#if defined(__i386__) || defined(__x86_64__) || defined(__pnacl__) || \ + defined(__wasm__) static _LIBCPP_CONSTEXPR const bool traps = true; #else static _LIBCPP_CONSTEXPR const bool traps = false; diff --git a/libcxx/test/std/language.support/support.limits/limits/numeric.limits.members/traps.pass.cpp b/libcxx/test/std/language.support/support.limits/limits/numeric.limits.members/traps.pass.cpp index af93e78c0e9..23811fada5e 100644 --- a/libcxx/test/std/language.support/support.limits/limits/numeric.limits.members/traps.pass.cpp +++ b/libcxx/test/std/language.support/support.limits/limits/numeric.limits.members/traps.pass.cpp @@ -13,7 +13,8 @@ #include <limits> -#if defined(__i386__) || defined(__x86_64__) || defined(__pnacl__) +#if defined(__i386__) || defined(__x86_64__) || defined(__pnacl__) || \ + defined(__wasm__) static const bool integral_types_trap = true; #else static const bool integral_types_trap = false; |

