diff options
author | trav90 <travawine@protonmail.ch> | 2015-12-02 00:46:37 -0600 |
---|---|---|
committer | trav90 <travawine@protonmail.ch> | 2015-12-02 00:46:37 -0600 |
commit | 95476e43f2b3204b62c38d788a379c3f5ea713db (patch) | |
tree | 06345c3d09004c3a5f9c525c8f733f974b62237f /build | |
parent | ac3f1e352ffbbd9bacb87964da568b9513074960 (diff) | |
download | palemoon-gre-95476e43f2b3204b62c38d788a379c3f5ea713db.tar.gz |
Add stdc++-compat hack for std::__throw_out_of_range_fmt and __cxa_throw_bad_array_new_length (for GCC 4.9)
Diffstat (limited to 'build')
-rw-r--r-- | build/unix/stdc++compat/stdc++compat.cpp | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/build/unix/stdc++compat/stdc++compat.cpp b/build/unix/stdc++compat/stdc++compat.cpp index cf1baafc0..f95c7befb 100644 --- a/build/unix/stdc++compat/stdc++compat.cpp +++ b/build/unix/stdc++compat/stdc++compat.cpp @@ -5,6 +5,9 @@ #include <ostream> #include <istream> #include <string> +#include <stdarg.h> +#include <stdio.h> +#include <mozilla/Assertions.h> /* GLIBCXX_3.4.8 is from gcc 4.1.1 (111691) GLIBCXX_3.4.9 is from gcc 4.2.0 (111690) @@ -14,7 +17,11 @@ GLIBCXX_3.4.13 is from gcc 4.4.2 (151127) GLIBCXX_3.4.14 is from gcc 4.5.0 (151126) GLIBCXX_3.4.15 is from gcc 4.6.0 (160071) - GLIBCXX_3.4.16 is form gcc 4.6.1 (172240) */ + GLIBCXX_3.4.16 is from gcc 4.6.1 (172240) + GLIBCXX_3.4.17 is from gcc 4.7.0 (174383) + GLIBCXX_3.4.18 is from gcc 4.8.0 (190787) + GLIBCXX_3.4.19 is from gcc 4.8.1 (199309) + GLIBCXX_3.4.20 is from gcc 4.9.0 (199307) */ #define GLIBCXX_VERSION(a, b, c) (((a) << 16) | ((b) << 8) | (c)) @@ -130,4 +137,32 @@ namespace std __attribute__((visibility("default"))) { void ctype<char>::_M_widen_init() const {} #endif +#if MOZ_LIBSTDCXX_VERSION >= GLIBCXX_VERSION(3, 4, 20) + /* We shouldn't be throwing exceptions at all, but it turns out + we call STL (inline) functions that do. */ + void __throw_out_of_range_fmt(char const* fmt, ...) + { + va_list ap; + char buf[1024]; // That should be big enough. + + va_start(ap, fmt); + vsnprintf(buf, sizeof(buf), fmt, ap); + buf[sizeof(buf) - 1] = 0; + va_end(ap); + + __throw_range_error(buf); + } +#endif + +} + +#if MOZ_LIBSTDCXX_VERSION >= GLIBCXX_VERSION(3, 4, 20) +/* Technically, this symbol is not in GLIBCXX_3.4.20, but in CXXABI_1.3.8, + but that's equivalent, version-wise. Those calls are added by the compiler + itself on `new Class[n]` calls. */ +extern "C" void +__cxa_throw_bad_array_new_length() +{ + MOZ_CRASH(); } +#endif |