mirror of
https://github.com/DoneJS-Runtime/quickjs-done-nextgen.git
synced 2025-01-09 17:43:15 +00:00
Make quickjs.h -Wall -Wextra -pedantic clean (#628)
Fixes: https://github.com/quickjs-ng/quickjs/issues/585
This commit is contained in:
parent
89883ae657
commit
d2bca87c64
4 changed files with 33 additions and 21 deletions
12
Makefile
12
Makefile
|
@ -83,8 +83,14 @@ distclean:
|
|||
stats: $(QJS)
|
||||
$(QJS) -qd
|
||||
|
||||
# implicitly .PHONY because it doesn't generate output
|
||||
cxxtest: CXXFLAGS+=-std=c++11 -fsyntax-only -Wall -Wextra -Werror -Wno-unused-parameter
|
||||
# effectively .PHONY because it doesn't generate output
|
||||
ctest: CFLAGS=-std=c11 -fsyntax-only -Wall -Wextra -Werror -pedantic
|
||||
ctest: ctest.c quickjs.h
|
||||
$(CC) $(CFLAGS) -DJS_NAN_BOXING=0 $<
|
||||
$(CC) $(CFLAGS) -DJS_NAN_BOXING=1 $<
|
||||
|
||||
# effectively .PHONY because it doesn't generate output
|
||||
cxxtest: CXXFLAGS=-std=c++11 -fsyntax-only -Wall -Wextra -Werror -pedantic
|
||||
cxxtest: cxxtest.cc quickjs.h
|
||||
$(CXX) $(CXXFLAGS) -DJS_NAN_BOXING=0 $<
|
||||
$(CXX) $(CXXFLAGS) -DJS_NAN_BOXING=1 $<
|
||||
|
@ -116,4 +122,4 @@ unicode_gen: $(BUILD_DIR)
|
|||
libunicode-table.h: unicode_gen
|
||||
$(BUILD_DIR)/unicode_gen unicode $@
|
||||
|
||||
.PHONY: all cxxtest debug fuzz install clean codegen distclean stats test test262 test262-update test262-check microbench unicode_gen $(QJS) $(QJSC)
|
||||
.PHONY: all ctest cxxtest debug fuzz install clean codegen distclean stats test test262 test262-update test262-check microbench unicode_gen $(QJS) $(QJSC)
|
||||
|
|
17
ctest.c
Normal file
17
ctest.c
Normal file
|
@ -0,0 +1,17 @@
|
|||
// note: file is not actually compiled, only checked for C syntax errors
|
||||
#include "quickjs.h"
|
||||
|
||||
int main(void)
|
||||
{
|
||||
JSRuntime *rt = JS_NewRuntime();
|
||||
JSContext *ctx = JS_NewContext(rt);
|
||||
JS_FreeValue(ctx, JS_NAN);
|
||||
JS_FreeValue(ctx, JS_UNDEFINED);
|
||||
JS_FreeValue(ctx, JS_NewFloat64(ctx, 42));
|
||||
// not a legal way of using JS_MKPTR but this is here
|
||||
// to have the compiler syntax-check its definition
|
||||
JS_FreeValue(ctx, JS_MKPTR(JS_TAG_UNINITIALIZED, 0));
|
||||
JS_FreeContext(ctx);
|
||||
JS_FreeRuntime(rt);
|
||||
return 0;
|
||||
}
|
17
cxxtest.cc
17
cxxtest.cc
|
@ -1,17 +1,2 @@
|
|||
// note: file is not actually compiled, only checked for C++ syntax errors
|
||||
#include "quickjs.h"
|
||||
|
||||
int main(void)
|
||||
{
|
||||
JSRuntime *rt = JS_NewRuntime();
|
||||
JSContext *ctx = JS_NewContext(rt);
|
||||
JS_FreeValue(ctx, JS_NAN);
|
||||
JS_FreeValue(ctx, JS_UNDEFINED);
|
||||
JS_FreeValue(ctx, JS_NewFloat64(ctx, 42));
|
||||
// not a legal way of using JS_MKPTR but this is here
|
||||
// to have the compiler syntax-check its definition
|
||||
JS_FreeValue(ctx, JS_MKPTR(JS_TAG_UNINITIALIZED, 0));
|
||||
JS_FreeContext(ctx);
|
||||
JS_FreeRuntime(rt);
|
||||
return 0;
|
||||
}
|
||||
#include "ctest.c"
|
||||
|
|
|
@ -514,21 +514,25 @@ JS_EXTERN int JS_IsRegisteredClass(JSRuntime *rt, JSClassID class_id);
|
|||
|
||||
static js_force_inline JSValue JS_NewBool(JSContext *ctx, JS_BOOL val)
|
||||
{
|
||||
(void)&ctx;
|
||||
return JS_MKVAL(JS_TAG_BOOL, (val != 0));
|
||||
}
|
||||
|
||||
static js_force_inline JSValue JS_NewInt32(JSContext *ctx, int32_t val)
|
||||
{
|
||||
(void)&ctx;
|
||||
return JS_MKVAL(JS_TAG_INT, val);
|
||||
}
|
||||
|
||||
static js_force_inline JSValue JS_NewFloat64(JSContext *ctx, double val)
|
||||
{
|
||||
(void)&ctx;
|
||||
return __JS_NewFloat64(val);
|
||||
}
|
||||
|
||||
static js_force_inline JSValue JS_NewCatchOffset(JSContext *ctx, int32_t val)
|
||||
{
|
||||
(void)&ctx;
|
||||
return JS_MKVAL(JS_TAG_CATCH_OFFSET, val);
|
||||
}
|
||||
|
||||
|
@ -566,8 +570,8 @@ static inline JS_BOOL JS_IsNumber(JSValue v)
|
|||
|
||||
static inline JS_BOOL JS_IsBigInt(JSContext *ctx, JSValue v)
|
||||
{
|
||||
int tag = JS_VALUE_GET_TAG(v);
|
||||
return tag == JS_TAG_BIG_INT;
|
||||
(void)&ctx;
|
||||
return JS_VALUE_GET_TAG(v) == JS_TAG_BIG_INT;
|
||||
}
|
||||
|
||||
static inline JS_BOOL JS_IsBool(JSValue v)
|
||||
|
|
Loading…
Reference in a new issue