From 4908cc5c62837a1386e58913970d8d7b8a811b2b Mon Sep 17 00:00:00 2001 From: John Alanbrook Date: Mon, 5 May 2025 09:13:36 -0500 Subject: [PATCH] fix clash with VERSION and new C++ header on macos --- Makefile | 4 ++-- VERSION => VERSION.md | 0 meson.build | 9 +++++++-- quickjs.c | 9 ++++----- 4 files changed, 13 insertions(+), 9 deletions(-) rename VERSION => VERSION.md (100%) diff --git a/Makefile b/Makefile index 3b1c745..3bd08d6 100644 --- a/Makefile +++ b/Makefile @@ -147,7 +147,7 @@ CFLAGS+=-fwrapv # ensure that signed overflows behave as expected ifdef CONFIG_WERROR CFLAGS+=-Werror endif -DEFINES:=-D_GNU_SOURCE -DCONFIG_VERSION=\"$(shell cat VERSION)\" +DEFINES:=-D_GNU_SOURCE -DCONFIG_VERSION=\"$(shell cat VERSION.md)\" ifdef CONFIG_WIN32 DEFINES+=-D__USE_MINGW_ANSI_STDIO # for standard snprintf behavior endif @@ -423,7 +423,7 @@ build_doc: $(DOCS) clean_doc: rm -f $(DOCS) -doc/version.texi: VERSION +doc/version.texi: VERSION.md @echo "@set VERSION `cat $<`" > $@ doc/%.pdf: doc/%.texi doc/version.texi diff --git a/VERSION b/VERSION.md similarity index 100% rename from VERSION rename to VERSION.md diff --git a/meson.build b/meson.build index cce925f..4974f90 100644 --- a/meson.build +++ b/meson.build @@ -1,4 +1,4 @@ -project('quickjs', 'c') +project('quickjs', 'c', meson_version: '>=1.1') cc = meson.get_compiler('c') @@ -8,7 +8,12 @@ deps = [] deps += cc.find_library('m', required:false) deps += threads -add_project_arguments('-DCONFIG_VERSION="2024-02-14"', '-mcmodel=large', language: 'c') +fs = import('fs') + +ver_file = join_paths(meson.current_source_dir(), 'VERSION.md') +qjs_ver = fs.read(ver_file).strip() + +add_project_arguments('-DCONFIG_VERSION="@0@"'.format(qjs_ver), '-mcmodel=large', language: 'c') if get_option('bignum') add_project_arguments('-DCONFIG_BIGNUM', language : 'c') diff --git a/quickjs.c b/quickjs.c index 0bc5177..3f241ba 100644 --- a/quickjs.c +++ b/quickjs.c @@ -13243,8 +13243,6 @@ static __maybe_unused void JS_DumpObject(FILE *fp, JSRuntime *rt, JSObject *p) static __maybe_unused void JS_DumpGCObject(FILE *fp, JSRuntime *rt, JSGCObjectHeader *p) { - struct gc_object obj; - if (p->gc_obj_type == JS_GC_OBJ_TYPE_JS_OBJECT) { JS_DumpObject(fp, rt, (JSObject *)p); } else { @@ -13423,7 +13421,8 @@ int JS_ArrayLength(JSContext *ctx, JSValueConst val) JSObject *p = JS_VALUE_GET_OBJ(val); if (p->class_id != JS_CLASS_ARRAY) return 0; uint32_t len; - js_get_length32(ctx, &len, val); + if (js_get_length32(ctx, &len, val)) + return 0; return len; } @@ -54977,7 +54976,7 @@ void js_debug_info(JSContext *js, JSValue fn, js_debug *dbg) if (!JS_IsObject(fn)) return; JSObject *p = JS_VALUE_GET_OBJ(fn); - char *fn_name = get_func_name(js,fn); + const char *fn_name = get_func_name(js,fn); if (!fn_name || fn_name[0] == 0) dbg->name = js_strdup(js, ""); @@ -54992,7 +54991,7 @@ void js_debug_info(JSContext *js, JSValue fn, js_debug *dbg) case JS_CLASS_BYTECODE_FUNCTION: { JSFunctionBytecode *b = p->u.func.function_bytecode; // get filename - char *filename = JS_AtomToCString(js, b->debug.filename); + const char *filename = JS_AtomToCString(js, b->debug.filename); if (!filename || filename[0] == 0) dbg->filename = js_strdup(js, "unknown"); else {