From f3454f01588a6eabfc7c883577544019fbb50f76 Mon Sep 17 00:00:00 2001 From: Vadim Zhestikov Date: Wed, 19 Mar 2025 09:12:45 -0700 Subject: [PATCH] QuickJS: using JS_AddIntrinsicBigInt() if detected. --- auto/quickjs | 23 +++++++++++++++++++++++ src/qjs.c | 2 ++ 2 files changed, 25 insertions(+) diff --git a/auto/quickjs b/auto/quickjs index 97432142..e4eecd29 100644 --- a/auto/quickjs +++ b/auto/quickjs @@ -137,6 +137,29 @@ if [ $NJS_TRY_QUICKJS = YES ]; then . auto/feature + njs_feature="QuickJS JS_AddIntrinsicBigInt()" + njs_feature_name=NJS_HAVE_QUICKJS_ADD_INTRINSIC_BIG_INT + njs_feature_test="#if defined(__GNUC__) && (__GNUC__ >= 8) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored \"-Wcast-function-type\" + #endif + + #include + + int main() { + JSRuntime *rt; + JSContext *ctx; + + rt = JS_NewRuntime(); + ctx = JS_NewContextRaw(rt); + JS_AddIntrinsicBigInt(ctx); + JS_FreeContext(ctx); + JS_FreeRuntime(rt); + return 0; + }" + + . auto/feature + njs_feature="QuickJS version" njs_feature_name=NJS_QUICKJS_VERSION njs_feature_run=value diff --git a/src/qjs.c b/src/qjs.c index 38015bb9..7763c165 100644 --- a/src/qjs.c +++ b/src/qjs.c @@ -165,7 +165,9 @@ qjs_new_context(JSRuntime *rt, qjs_module_t **addons) JS_AddIntrinsicMapSet(ctx); JS_AddIntrinsicTypedArrays(ctx); JS_AddIntrinsicPromise(ctx); +#ifdef NJS_HAVE_QUICKJS_ADD_INTRINSIC_BIG_INT JS_AddIntrinsicBigInt(ctx); +#endif JS_AddIntrinsicEval(ctx); for (module = qjs_modules; *module != NULL; module++) { -- 2.47.3