Skip to content

Commit 4d57997

Browse files
authored
Remove CONFIG_CHECK_JSVALUE build mode (#194)
It doesn't produce a working build and I'm somewhat skeptical that its purported goal of catching reference counting bugs still works.
1 parent 4c1b9f8 commit 4d57997

File tree

1 file changed

+2
-39
lines changed

1 file changed

+2
-39
lines changed

quickjs.h

Lines changed: 2 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -86,47 +86,12 @@ typedef struct JSRefCountHeader {
8686
} JSRefCountHeader;
8787

8888
#define JS_FLOAT64_NAN NAN
89+
#define JSValueConst JSValue /* For backwards compatibility. */
8990

90-
#ifdef CONFIG_CHECK_JSVALUE
91-
/* JSValue consistency : it is not possible to run the code in this
92-
mode, but it is useful to detect simple reference counting
93-
errors. It would be interesting to modify a static C analyzer to
94-
handle specific annotations (clang has such annotations but only
95-
for objective C) */
96-
typedef struct __JSValue *JSValue;
97-
typedef const struct __JSValue *JSValueConst;
98-
99-
#define JS_VALUE_GET_TAG(v) (int)((uintptr_t)(v) & 0xf)
100-
/* same as JS_VALUE_GET_TAG, but return JS_TAG_FLOAT64 with NaN boxing */
101-
#define JS_VALUE_GET_NORM_TAG(v) JS_VALUE_GET_TAG(v)
102-
#define JS_VALUE_GET_INT(v) (int)((intptr_t)(v) >> 4)
103-
#define JS_VALUE_GET_BOOL(v) JS_VALUE_GET_INT(v)
104-
#define JS_VALUE_GET_FLOAT64(v) (double)JS_VALUE_GET_INT(v)
105-
#define JS_VALUE_GET_PTR(v) (void *)((intptr_t)(v) & ~0xf)
106-
107-
#define JS_MKVAL(tag, val) (JSValue)(intptr_t)(((val) << 4) | (tag))
108-
#define JS_MKPTR(tag, p) (JSValue)((intptr_t)(p) | (tag))
109-
110-
#define JS_TAG_IS_FLOAT64(tag) ((unsigned)(tag) == JS_TAG_FLOAT64)
111-
112-
#define JS_NAN JS_MKVAL(JS_TAG_FLOAT64, 1)
113-
114-
static inline JSValue __JS_NewFloat64(double d)
115-
{
116-
return JS_MKVAL(JS_TAG_FLOAT64, (int)d);
117-
}
118-
119-
static inline JS_BOOL JS_VALUE_IS_NAN(JSValue v)
120-
{
121-
return 0;
122-
}
123-
124-
#elif defined(JS_NAN_BOXING)
91+
#if defined(JS_NAN_BOXING)
12592

12693
typedef uint64_t JSValue;
12794

128-
#define JSValueConst JSValue
129-
13095
#define JS_VALUE_GET_TAG(v) (int)((v) >> 32)
13196
#define JS_VALUE_GET_INT(v) (int)(v)
13297
#define JS_VALUE_GET_BOOL(v) (int)(v)
@@ -199,8 +164,6 @@ typedef struct JSValue {
199164
int64_t tag;
200165
} JSValue;
201166

202-
#define JSValueConst JSValue
203-
204167
#define JS_VALUE_GET_TAG(v) ((int32_t)(v).tag)
205168
/* same as JS_VALUE_GET_TAG, but return JS_TAG_FLOAT64 with NaN boxing */
206169
#define JS_VALUE_GET_NORM_TAG(v) JS_VALUE_GET_TAG(v)

0 commit comments

Comments
 (0)