[njs] QuickJS: using JS_AddIntrinsicBigInt() if detected.

noreply at nginx.com noreply at nginx.com
Thu Mar 20 03:43:02 UTC 2025


details:   https://github.com/nginx/njs/commit/f3454f01588a6eabfc7c883577544019fbb50f76
branches:  master
commit:    f3454f01588a6eabfc7c883577544019fbb50f76
user:      Vadim Zhestikov <v.zhestikov at f5.com>
date:      Wed, 19 Mar 2025 09:12:45 -0700
description:
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 <quickjs.h>
+
+                          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++) {


More information about the nginx-devel mailing list