Cleanup unused-variable warnings

This commit is contained in:
Andrew Johnson 2024-06-24 13:40:42 +03:00 committed by Saúl Ibarra Corretgé
parent 2ea0848616
commit 136f5a2c66
2 changed files with 9 additions and 24 deletions

View file

@ -35,7 +35,6 @@ xcheck_add_c_compiler_flag(-Wno-implicit-fallthrough)
xcheck_add_c_compiler_flag(-Wno-sign-compare)
xcheck_add_c_compiler_flag(-Wno-missing-field-initializers)
xcheck_add_c_compiler_flag(-Wno-unused-parameter)
xcheck_add_c_compiler_flag(-Wno-unused-variable)
xcheck_add_c_compiler_flag(-Wno-unused-but-set-variable)
xcheck_add_c_compiler_flag(-Wno-array-bounds)
xcheck_add_c_compiler_flag(-Wno-format-truncation)
@ -173,7 +172,7 @@ if(CMAKE_BUILD_TYPE MATCHES Debug OR DUMP_LEAKS)
)
endif()
target_include_directories(qjs PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)

View file

@ -2188,15 +2188,13 @@ static inline void set_value(JSContext *ctx, JSValue *pval, JSValue new_val)
void JS_SetClassProto(JSContext *ctx, JSClassID class_id, JSValue obj)
{
JSRuntime *rt = ctx->rt;
assert(class_id < rt->class_count);
assert(class_id < ctx->rt->class_count);
set_value(ctx, &ctx->class_proto[class_id], obj);
}
JSValue JS_GetClassProto(JSContext *ctx, JSClassID class_id)
{
JSRuntime *rt = ctx->rt;
assert(class_id < rt->class_count);
assert(class_id < ctx->rt->class_count);
return js_dup(ctx->class_proto[class_id]);
}
@ -11083,8 +11081,6 @@ static int js_ecvt(double d, int n_digits,
char dest[minimum_length(JS_ECVT_BUF_SIZE)],
size_t size, int *decpt)
{
int i;
if (n_digits == 0) {
/* find the minimum number of digits (XXX: inefficient but simple) */
// TODO(chqrlie) use direct method from quickjs-printf
@ -11134,7 +11130,7 @@ static int js_ecvt(double d, int n_digits,
return n_digits; /* truncate the 2 extra digits */
}
/* round up in the string */
for(i = n_digits;; i--) {
for(int i = n_digits;; i--) {
/* ignore the locale specific decimal point */
if (is_digit(dest[i])) {
if (dest[i]++ < '9')
@ -11164,7 +11160,7 @@ static size_t js_fcvt(double d, int n_digits,
char dest[minimum_length(JS_FCVT_BUF_SIZE)], size_t size)
{
#if defined(FE_DOWNWARD) && defined(FE_TONEAREST)
int i, n1, n2;
int i, n1;
/* generate 2 extra digits: 99% chances to avoid 2 calls */
n1 = snprintf(dest, size, "%.*f", n_digits + 2, d) - 2;
if (dest[n1] >= '5') {
@ -11427,7 +11423,6 @@ done:
JSValue JS_ToStringInternal(JSContext *ctx, JSValue val, BOOL is_ToPropertyKey)
{
uint32_t tag;
const char *str;
char buf[32];
size_t len;
@ -12061,8 +12056,7 @@ static JSValue JS_CompactBigInt1(JSContext *ctx, JSValue val)
return val; /* fail safe */
bf_t *a = JS_GetBigInt(val);
if (a->expn == BF_EXP_ZERO && a->sign) {
JSBigInt *p = JS_VALUE_GET_PTR(val);
assert(p->header.ref_count == 1);
assert(((JSBigInt*)JS_VALUE_GET_PTR(val))->header.ref_count == 1);
a->sign = 0;
}
return val;
@ -18830,7 +18824,6 @@ static __exception int js_parse_string(JSParseState *s, int sep,
break;
}
if (c == '\\') {
const uint8_t *p0 = p;
c = *p;
switch(c) {
case '\0':
@ -27030,7 +27023,6 @@ static JSValue js_dynamic_import_job(JSContext *ctx,
JSValue *resolving_funcs = argv;
JSValue basename_val = argv[2];
JSValue specifier = argv[3];
JSModuleDef *m;
const char *basename = NULL, *filename;
JSValue ret, err;
@ -27371,7 +27363,7 @@ static int js_inner_module_evaluation(JSContext *ctx, JSModuleDef *m,
JSReqModuleEntry *rme = &m->req_module_entries[i];
m1 = rme->module;
index = js_inner_module_evaluation(ctx, m1, index, pstack_top, pvalue);
if (index < 0)
if (index < 0)
return -1;
assert(m1->status == JS_MODULE_STATUS_EVALUATING ||
m1->status == JS_MODULE_STATUS_EVALUATING_ASYNC ||
@ -32962,11 +32954,10 @@ JSValue JS_EvalThis(JSContext *ctx, JSValue this_obj,
const char *input, size_t input_len,
const char *filename, int eval_flags)
{
int eval_type = eval_flags & JS_EVAL_TYPE_MASK;
JSValue ret;
assert(eval_type == JS_EVAL_TYPE_GLOBAL ||
eval_type == JS_EVAL_TYPE_MODULE);
assert((eval_flags & JS_EVAL_TYPE_MASK) == JS_EVAL_TYPE_GLOBAL ||
(eval_flags & JS_EVAL_TYPE_MASK) == JS_EVAL_TYPE_MODULE);
ret = JS_EvalInternal(ctx, this_obj, input, input_len, filename,
eval_flags, -1);
return ret;
@ -34400,8 +34391,6 @@ static JSValue JS_ReadFunctionTag(BCReaderState *s)
int idx, i, local_count, has_debug_info;
int function_size, cpool_offset, byte_code_offset;
int closure_var_offset, vardefs_offset;
uint32_t ic_len;
JSAtom atom;
memset(&bc, 0, sizeof(bc));
bc.header.ref_count = 1;
@ -37659,8 +37648,6 @@ static JSValue js_array_at(JSContext *ctx, JSValue this_val,
{
JSValue obj, ret;
int64_t len, idx;
JSValue *arrp;
uint32_t count;
ret = JS_EXCEPTION;
obj = JS_ToObject(ctx, this_val);
@ -52250,7 +52237,6 @@ static JSValue js_atomics_wait(JSContext *ctx,
int32_t v32;
void *ptr;
int64_t timeout;
struct timespec ts;
JSAtomicsWaiter waiter_s, *waiter;
int ret, size_log2, res;
double d;