Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 561960 | Differences between
and this patch

Collapse All | Expand All

(-)libraries/source/spidermonkey/FixBug1119228.diff (+65 lines)
Line 0 Link Here
1
# Backport of
2
# HG changeset patch
3
# User Ehsan Akhgari <ehsan@mozilla.com>
4
# Date 1420727118 18000
5
# Node ID bcacb5692ad902fc0ec6ebea2ad382a8a3fd5183
6
# Parent  48f8a884901ba9753d3bddab08f25c60e1915601
7
Bug 1119228 - Fix a fatal warning in PossiblyFail; r=jandem
8
9
Recent clang emits the following warning (which is treated as an error) on this code:
10
error: implicit conversion of nullptr constant to 'bool' [-Werror,-Wnull-conversion]
11
12
13
diff --git a/js/public/Utility.h b/js/public/Utility.h
14
--- a/js/public/Utility.h
15
+++ b/js/public/Utility.h
16
@@ -83,19 +83,28 @@ static MOZ_NEVER_INLINE void js_failedAl
17
 #  define JS_OOM_POSSIBLY_FAIL() \
18
     do \
19
     { \
20
         if (++OOM_counter > OOM_maxAllocations) { \
21
             JS_OOM_CALL_BP_FUNC();\
22
             return nullptr; \
23
         } \
24
     } while (0)
25
+#  define JS_OOM_POSSIBLY_FAIL_BOOL() \
26
+    do \
27
+    { \
28
+        if (++OOM_counter > OOM_maxAllocations) { \
29
+            JS_OOM_CALL_BP_FUNC();\
30
+            return false; \
31
+        } \
32
+    } while (0)
33
 
34
 # else
35
 #  define JS_OOM_POSSIBLY_FAIL() do {} while(0)
36
+#  define JS_OOM_POSSIBLY_FAIL_BOOL() do {} while(0)
37
 # endif /* DEBUG || JS_OOM_BREAKPOINT */
38
 
39
 static inline void* js_malloc(size_t bytes)
40
 {
41
     JS_OOM_POSSIBLY_FAIL();
42
     return malloc(bytes);
43
 }
44
45
--- a/js/src/jsgcinlines.h
46
+++ b/js/src/jsgcinlines.h
47
@@ -403,17 +403,17 @@
48
     }
49
     return nullptr;
50
 }
51
 #endif /* JSGC_GENERATIONAL */
52
53
 static inline bool
54
 PossiblyFail()
55
 {
56
-    JS_OOM_POSSIBLY_FAIL();
57
+    JS_OOM_POSSIBLY_FAIL_BOOL();
58
     return true;
59
 }
60
61
 template <AllowGC allowGC>
62
 static inline bool
63
 CheckAllocatorState(ThreadSafeContext *cx, AllocKind kind)
64
 {
65
     if (!cx->isJSContext())

Return to bug 561960