From f9f1a5dd73b918d50bcd3a4b461b87544260b9f8 Mon Sep 17 00:00:00 2001 From: Henrique Nakashima Date: Wed, 24 Jan 2018 22:05:20 +0000 Subject: Support compiling pdfium with emscripten. Bug: chromium:804907 Change-Id: I3562653fbc26d669d1e0a99894a69da032a0349e Reviewed-on: https://pdfium-review.googlesource.com/23810 Reviewed-by: dsinclair Commit-Queue: Henrique Nakashima --- third_party/base/numerics/safe_math_impl.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/third_party/base/numerics/safe_math_impl.h b/third_party/base/numerics/safe_math_impl.h index 4bcc67188c..61f18d2b2a 100644 --- a/third_party/base/numerics/safe_math_impl.h +++ b/third_party/base/numerics/safe_math_impl.h @@ -44,7 +44,11 @@ struct UnsignedOrFloatForSize { }; // Probe for builtin math overflow support on Clang and version check on GCC. -#if defined(__has_builtin) +#if defined(EMSCRIPTEN) +// Emscripten Clang reports that it has the builtins, it may be lowered to an +// instruction that is unsupported in asm.js +#define USE_OVERFLOW_BUILTINS (0) +#elif defined(__has_builtin) #define USE_OVERFLOW_BUILTINS (__has_builtin(__builtin_add_overflow)) #elif defined(__GNUC__) #define USE_OVERFLOW_BUILTINS (__GNUC__ >= 5) -- cgit v1.2.3