Skip to content

Add compile-time refcount bug hunt build mode #952

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Mar 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -592,3 +592,11 @@ jobs:
- name: test
run: |
make test RUN262=$RUNNER_TEMP/run-test262

jscheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: jscheck
run: |
make jscheck
19 changes: 18 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,23 @@ distclean:
stats: $(QJS)
$(QJS) -qd

jscheck: CFLAGS=-I. -D_GNU_SOURCE -DJS_CHECK_JSVALUE -Wall -Werror -fsyntax-only -c -o /dev/null
jscheck:
$(CC) $(CFLAGS) api-test.c
$(CC) $(CFLAGS) ctest.c
$(CC) $(CFLAGS) fuzz.c
$(CC) $(CFLAGS) gen/function_source.c
$(CC) $(CFLAGS) gen/hello.c
$(CC) $(CFLAGS) gen/hello_module.c
$(CC) $(CFLAGS) gen/repl.c
$(CC) $(CFLAGS) gen/standalone.c
$(CC) $(CFLAGS) gen/test_fib.c
$(CC) $(CFLAGS) qjs.c
$(CC) $(CFLAGS) qjsc.c
$(CC) $(CFLAGS) quickjs-libc.c
$(CC) $(CFLAGS) quickjs.c
$(CC) $(CFLAGS) run-test262.c

# effectively .PHONY because it doesn't generate output
ctest: CFLAGS=-std=c11 -fsyntax-only -Wall -Wextra -Werror -pedantic
ctest: ctest.c quickjs.h
Expand Down Expand Up @@ -126,4 +143,4 @@ unicode_gen: $(BUILD_DIR)
libunicode-table.h: unicode_gen
$(BUILD_DIR)/unicode_gen unicode $@

.PHONY: all amalgam ctest cxxtest debug fuzz install clean codegen distclean stats test test262 test262-update test262-check microbench unicode_gen $(QJS) $(QJSC)
.PHONY: all amalgam ctest cxxtest debug fuzz jscheck install clean codegen distclean stats test test262 test262-update test262-check microbench unicode_gen $(QJS) $(QJSC)
3 changes: 2 additions & 1 deletion api-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ static void async_call(void)
JS_FreeRuntime(rt);
}

static JSValue save_value(JSContext *ctx, JSValue this_val, int argc, JSValue *argv)
static JSValue save_value(JSContext *ctx, JSValueConst this_val,
int argc, JSValueConst *argv)
{
assert(argc == 1);
JSValue *p = (JSValue *)JS_GetContextOpaque(ctx);
Expand Down
8 changes: 4 additions & 4 deletions qjs.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,14 +199,14 @@ static int64_t parse_limit(const char *arg) {
return (int64_t)(d * unit);
}

static JSValue js_gc(JSContext *ctx, JSValue this_val,
int argc, JSValue *argv)
static JSValue js_gc(JSContext *ctx, JSValueConst this_val,
int argc, JSValueConst *argv)
{
JS_RunGC(JS_GetRuntime(ctx));
return JS_UNDEFINED;
}

static JSValue js_navigator_get_userAgent(JSContext *ctx, JSValue this_val)
static JSValue js_navigator_get_userAgent(JSContext *ctx, JSValueConst this_val)
{
char version[32];
snprintf(version, sizeof(version), "quickjs-ng/%s", JS_GetVersion());
Expand Down Expand Up @@ -667,7 +667,7 @@ int main(int argc, char **argv)
args[0] = JS_NewString(ctx, compile_file);
args[1] = JS_NewString(ctx, out);
args[2] = JS_NewString(ctx, exe != NULL ? exe : argv[0]);
ret = JS_Call(ctx, func, JS_UNDEFINED, countof(args), args);
ret = JS_Call(ctx, func, JS_UNDEFINED, 3, (JSValueConst *)args);
JS_FreeValue(ctx, func);
JS_FreeValue(ctx, args[0]);
JS_FreeValue(ctx, args[1]);
Expand Down
Loading