[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.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@257612 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Dan Gohman
2016-01-13 16:32:00 +00:00
parent 4f4a07d66a
commit 2afbf71fdd
2 changed files with 4 additions and 2 deletions

View File

@@ -237,7 +237,8 @@ protected:
static _LIBCPP_CONSTEXPR const bool is_bounded = true; static _LIBCPP_CONSTEXPR const bool is_bounded = true;
static _LIBCPP_CONSTEXPR const bool is_modulo = !_VSTD::is_signed<_Tp>::value; 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; static _LIBCPP_CONSTEXPR const bool traps = true;
#else #else
static _LIBCPP_CONSTEXPR const bool traps = false; static _LIBCPP_CONSTEXPR const bool traps = false;

View File

@@ -13,7 +13,8 @@
#include <limits> #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; static const bool integral_types_trap = true;
#else #else
static const bool integral_types_trap = false; static const bool integral_types_trap = false;