Skip to content

Commit 136f5a2

Browse files
andrjohnssaghul
authored andcommittedJun 24, 2024
Cleanup unused-variable warnings
1 parent 2ea0848 commit 136f5a2

File tree

2 files changed

+9
-24
lines changed

2 files changed

+9
-24
lines changed
 

‎CMakeLists.txt

+1-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ xcheck_add_c_compiler_flag(-Wno-implicit-fallthrough)
3535
xcheck_add_c_compiler_flag(-Wno-sign-compare)
3636
xcheck_add_c_compiler_flag(-Wno-missing-field-initializers)
3737
xcheck_add_c_compiler_flag(-Wno-unused-parameter)
38-
xcheck_add_c_compiler_flag(-Wno-unused-variable)
3938
xcheck_add_c_compiler_flag(-Wno-unused-but-set-variable)
4039
xcheck_add_c_compiler_flag(-Wno-array-bounds)
4140
xcheck_add_c_compiler_flag(-Wno-format-truncation)
@@ -173,7 +172,7 @@ if(CMAKE_BUILD_TYPE MATCHES Debug OR DUMP_LEAKS)
173172
)
174173
endif()
175174
target_include_directories(qjs PUBLIC
176-
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
175+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
177176
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
178177
)
179178

‎quickjs.c

+8-22
Original file line numberDiff line numberDiff line change
@@ -2188,15 +2188,13 @@ static inline void set_value(JSContext *ctx, JSValue *pval, JSValue new_val)
21882188

21892189
void JS_SetClassProto(JSContext *ctx, JSClassID class_id, JSValue obj)
21902190
{
2191-
JSRuntime *rt = ctx->rt;
2192-
assert(class_id < rt->class_count);
2191+
assert(class_id < ctx->rt->class_count);
21932192
set_value(ctx, &ctx->class_proto[class_id], obj);
21942193
}
21952194

21962195
JSValue JS_GetClassProto(JSContext *ctx, JSClassID class_id)
21972196
{
2198-
JSRuntime *rt = ctx->rt;
2199-
assert(class_id < rt->class_count);
2197+
assert(class_id < ctx->rt->class_count);
22002198
return js_dup(ctx->class_proto[class_id]);
22012199
}
22022200

@@ -11083,8 +11081,6 @@ static int js_ecvt(double d, int n_digits,
1108311081
char dest[minimum_length(JS_ECVT_BUF_SIZE)],
1108411082
size_t size, int *decpt)
1108511083
{
11086-
int i;
11087-
1108811084
if (n_digits == 0) {
1108911085
/* find the minimum number of digits (XXX: inefficient but simple) */
1109011086
// TODO(chqrlie) use direct method from quickjs-printf
@@ -11134,7 +11130,7 @@ static int js_ecvt(double d, int n_digits,
1113411130
return n_digits; /* truncate the 2 extra digits */
1113511131
}
1113611132
/* round up in the string */
11137-
for(i = n_digits;; i--) {
11133+
for(int i = n_digits;; i--) {
1113811134
/* ignore the locale specific decimal point */
1113911135
if (is_digit(dest[i])) {
1114011136
if (dest[i]++ < '9')
@@ -11164,7 +11160,7 @@ static size_t js_fcvt(double d, int n_digits,
1116411160
char dest[minimum_length(JS_FCVT_BUF_SIZE)], size_t size)
1116511161
{
1116611162
#if defined(FE_DOWNWARD) && defined(FE_TONEAREST)
11167-
int i, n1, n2;
11163+
int i, n1;
1116811164
/* generate 2 extra digits: 99% chances to avoid 2 calls */
1116911165
n1 = snprintf(dest, size, "%.*f", n_digits + 2, d) - 2;
1117011166
if (dest[n1] >= '5') {
@@ -11427,7 +11423,6 @@ static JSValue js_dtoa_radix(JSContext *ctx, double d, int radix)
1142711423
JSValue JS_ToStringInternal(JSContext *ctx, JSValue val, BOOL is_ToPropertyKey)
1142811424
{
1142911425
uint32_t tag;
11430-
const char *str;
1143111426
char buf[32];
1143211427
size_t len;
1143311428

@@ -12061,8 +12056,7 @@ static JSValue JS_CompactBigInt1(JSContext *ctx, JSValue val)
1206112056
return val; /* fail safe */
1206212057
bf_t *a = JS_GetBigInt(val);
1206312058
if (a->expn == BF_EXP_ZERO && a->sign) {
12064-
JSBigInt *p = JS_VALUE_GET_PTR(val);
12065-
assert(p->header.ref_count == 1);
12059+
assert(((JSBigInt*)JS_VALUE_GET_PTR(val))->header.ref_count == 1);
1206612060
a->sign = 0;
1206712061
}
1206812062
return val;
@@ -18830,7 +18824,6 @@ static __exception int js_parse_string(JSParseState *s, int sep,
1883018824
break;
1883118825
}
1883218826
if (c == '\\') {
18833-
const uint8_t *p0 = p;
1883418827
c = *p;
1883518828
switch(c) {
1883618829
case '\0':
@@ -27030,7 +27023,6 @@ static JSValue js_dynamic_import_job(JSContext *ctx,
2703027023
JSValue *resolving_funcs = argv;
2703127024
JSValue basename_val = argv[2];
2703227025
JSValue specifier = argv[3];
27033-
JSModuleDef *m;
2703427026
const char *basename = NULL, *filename;
2703527027
JSValue ret, err;
2703627028

@@ -27371,7 +27363,7 @@ static int js_inner_module_evaluation(JSContext *ctx, JSModuleDef *m,
2737127363
JSReqModuleEntry *rme = &m->req_module_entries[i];
2737227364
m1 = rme->module;
2737327365
index = js_inner_module_evaluation(ctx, m1, index, pstack_top, pvalue);
27374-
if (index < 0)
27366+
if (index < 0)
2737527367
return -1;
2737627368
assert(m1->status == JS_MODULE_STATUS_EVALUATING ||
2737727369
m1->status == JS_MODULE_STATUS_EVALUATING_ASYNC ||
@@ -32962,11 +32954,10 @@ JSValue JS_EvalThis(JSContext *ctx, JSValue this_obj,
3296232954
const char *input, size_t input_len,
3296332955
const char *filename, int eval_flags)
3296432956
{
32965-
int eval_type = eval_flags & JS_EVAL_TYPE_MASK;
3296632957
JSValue ret;
3296732958

32968-
assert(eval_type == JS_EVAL_TYPE_GLOBAL ||
32969-
eval_type == JS_EVAL_TYPE_MODULE);
32959+
assert((eval_flags & JS_EVAL_TYPE_MASK) == JS_EVAL_TYPE_GLOBAL ||
32960+
(eval_flags & JS_EVAL_TYPE_MASK) == JS_EVAL_TYPE_MODULE);
3297032961
ret = JS_EvalInternal(ctx, this_obj, input, input_len, filename,
3297132962
eval_flags, -1);
3297232963
return ret;
@@ -34400,8 +34391,6 @@ static JSValue JS_ReadFunctionTag(BCReaderState *s)
3440034391
int idx, i, local_count, has_debug_info;
3440134392
int function_size, cpool_offset, byte_code_offset;
3440234393
int closure_var_offset, vardefs_offset;
34403-
uint32_t ic_len;
34404-
JSAtom atom;
3440534394

3440634395
memset(&bc, 0, sizeof(bc));
3440734396
bc.header.ref_count = 1;
@@ -37659,8 +37648,6 @@ static JSValue js_array_at(JSContext *ctx, JSValue this_val,
3765937648
{
3766037649
JSValue obj, ret;
3766137650
int64_t len, idx;
37662-
JSValue *arrp;
37663-
uint32_t count;
3766437651

3766537652
ret = JS_EXCEPTION;
3766637653
obj = JS_ToObject(ctx, this_val);
@@ -52250,7 +52237,6 @@ static JSValue js_atomics_wait(JSContext *ctx,
5225052237
int32_t v32;
5225152238
void *ptr;
5225252239
int64_t timeout;
52253-
struct timespec ts;
5225452240
JSAtomicsWaiter waiter_s, *waiter;
5225552241
int ret, size_log2, res;
5225652242
double d;

0 commit comments

Comments
 (0)