[libcxx] r257612 - [WebAssembly] Set std::numeric_limits's traps field for WebAssembly.

Dan Gohman via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 13 08:32:01 PST 2016


Author: djg
Date: Wed Jan 13 10:32:00 2016
New Revision: 257612

URL: http://llvm.org/viewvc/llvm-project?rev=257612&view=rev
Log:
[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.

Modified:
    libcxx/trunk/include/limits
    libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/traps.pass.cpp

Modified: libcxx/trunk/include/limits
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/limits?rev=257612&r1=257611&r2=257612&view=diff
==============================================================================
--- libcxx/trunk/include/limits (original)
+++ libcxx/trunk/include/limits Wed Jan 13 10:32:00 2016
@@ -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;

Modified: libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/traps.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/traps.pass.cpp?rev=257612&r1=257611&r2=257612&view=diff
==============================================================================
--- libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/traps.pass.cpp (original)
+++ libcxx/trunk/test/std/language.support/support.limits/limits/numeric.limits.members/traps.pass.cpp Wed Jan 13 10:32:00 2016
@@ -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;




More information about the cfe-commits mailing list