Browse Source

compile warning fixes for -Wextra

pull/1/head
Sami Vaarala 11 years ago
parent
commit
835cda7fba
  1. 2
      src/duk_api.c
  2. 4
      src/duk_api_codec.c
  3. 2
      src/duk_api_memory.c
  4. 6
      src/duk_api_string.c
  5. 2
      src/duk_builtin_date.c
  6. 3
      src/duk_builtin_json.c
  7. 1
      src/duk_builtin_thrower.c
  8. 2
      src/duk_debug_heap.c
  9. 2
      src/duk_debug_macros.c
  10. 2
      src/duk_error_augment.c
  11. 1
      src/duk_error_fatal.c
  12. 2
      src/duk_hbuffer_ops.c
  13. 4
      src/duk_heap_alloc.c
  14. 7
      src/duk_heap_markandsweep.c
  15. 5
      src/duk_js_compiler.c

2
src/duk_api.c

@ -2528,6 +2528,8 @@ void duk_push_global_object(duk_context *ctx) {
static int try_push_vsprintf(duk_context *ctx, void *buf, size_t sz, const char *fmt, va_list ap) {
int len;
DUK_UNREF(ctx);
/* NUL terminator handling doesn't matter here */
len = DUK_VSNPRINTF((char *) buf, sz, fmt, ap);
if (len < sz) {

4
src/duk_api_codec.c

@ -12,6 +12,8 @@ static void base64_encode_helper(const unsigned char *src, const unsigned char *
unsigned int i, snip;
unsigned int x, y, t;
DUK_UNREF(dst_end);
while (src < src_end) {
/* read 3 bytes into 't', padded by zero */
snip = 4;
@ -67,6 +69,8 @@ static int base64_decode_helper(const unsigned char *src, const unsigned char *s
unsigned int x, y;
int group_idx;
DUK_UNREF(dst_end);
t = 0;
group_idx = 0;

2
src/duk_api_memory.c

@ -83,6 +83,8 @@ void duk_gc(duk_context *ctx, int flags) {
duk_hthread *thr = (duk_hthread *) ctx;
duk_heap *heap;
DUK_UNREF(flags);
if (!ctx) {
return;
}

6
src/duk_api_string.c

@ -107,10 +107,16 @@ void duk_join(duk_context *ctx, unsigned int count) {
}
void duk_decode_string(duk_context *ctx, int index, duk_decode_char_function callback, void *udata) {
DUK_UNREF(index);
DUK_UNREF(callback);
DUK_UNREF(udata);
DUK_ERROR((duk_hthread *) ctx, DUK_ERR_UNIMPLEMENTED_ERROR, "FIXME");
}
void duk_map_string(duk_context *ctx, int index, duk_map_char_function callback, void *udata) {
DUK_UNREF(index);
DUK_UNREF(callback);
DUK_UNREF(udata);
DUK_ERROR((duk_hthread *) ctx, DUK_ERR_UNIMPLEMENTED_ERROR, "FIXME");
}

2
src/duk_builtin_date.c

@ -304,6 +304,8 @@ static int format_parts_strftime(duk_context *ctx, int *parts, int tzoffset, int
struct tm tm;
const char *fmt;
DUK_UNREF(tzoffset);
/* If platform doesn't support the entire Ecmascript range, we need to
* return 0 so that the caller can fall back to the default formatter.
*

3
src/duk_builtin_json.c

@ -848,6 +848,8 @@ static void json_enc_objarr_shared_exit(duk_json_enc_ctx *js_ctx, duk_hstring **
duk_context *ctx = (duk_context *) js_ctx->thr;
duk_hobject *h_target;
DUK_UNREF(h_indent);
if (js_ctx->h_gap != NULL) {
DUK_ASSERT(js_ctx->h_indent != NULL);
DUK_ASSERT(*h_stepback != NULL);
@ -1361,6 +1363,7 @@ void duk_builtin_json_parse_helper(duk_context *ctx,
#ifdef DUK_USE_ASSERTIONS
int top_at_entry = duk_get_top(ctx);
#endif
DUK_UNREF(flags); /* FIXME: for now, no flags */
DUK_DDDPRINT("JSON parse start: text=%!T, reviver=%!T, flags=0x%08x, stack_top=%d",
duk_get_tval(ctx, idx_value), duk_get_tval(ctx, idx_reviver),

1
src/duk_builtin_thrower.c

@ -5,5 +5,6 @@
#include "duk_internal.h"
int duk_builtin_type_error_thrower(duk_context *ctx) {
DUK_UNREF(ctx);
return DUK_RET_TYPE_ERROR;
}

2
src/duk_debug_heap.c

@ -62,6 +62,8 @@ static void dump_heaphdr_list(duk_heap *heap, duk_heaphdr *root, const char *nam
int count;
duk_heaphdr *curr;
DUK_UNREF(heap);
count = 0;
curr = root;
while (curr) {

2
src/duk_debug_macros.c

@ -43,6 +43,7 @@ static const char *get_level_string(int level) {
#define TERM_RED "\x1b[31m"
static const char *get_term_1(int level) {
DUK_UNREF(level);
return (const char *) TERM_RED;
}
@ -59,6 +60,7 @@ static const char *get_term_2(int level) {
}
static const char *get_term_3(int level) {
DUK_UNREF(level);
return (const char *) TERM_RESET;
}

2
src/duk_error_augment.c

@ -23,6 +23,8 @@ static void add_traceback(duk_hthread *thr, duk_hthread *thr_callstack, duk_hobj
int arr_idx;
double d;
DUK_UNREF(obj); /* FIXME: remove entire argument (it's accessed through the stack)? */
DUK_ASSERT(thr != NULL);
DUK_ASSERT(thr_callstack != NULL);
DUK_ASSERT(obj != NULL);

1
src/duk_error_fatal.c

@ -5,6 +5,7 @@
#include "duk_internal.h"
void duk_default_fatal_handler(duk_context *ctx, int code) {
DUK_UNREF(ctx);
DUK_DPRINT("default fatal handler called, code %d -> calling DUK_PANIC()", code);
DUK_PANIC(code, "fatal error (default handler), code %d", code);
DUK_UNREACHABLE();

2
src/duk_hbuffer_ops.c

@ -364,6 +364,8 @@ void duk_hbuffer_remove_slice(duk_hthread *thr, duk_hbuffer_dynamic *buf, size_t
char *p;
size_t end_offset;
DUK_UNREF(thr);
DUK_ASSERT(thr != NULL);
DUK_ASSERT(buf != NULL);
DUK_ASSERT(DUK_HBUFFER_HAS_DYNAMIC(buf));

4
src/duk_heap_alloc.c

@ -139,7 +139,7 @@ static void free_markandsweep_finalize_list(duk_heap *heap) {
#endif
static void free_stringtable(duk_heap *heap) {
int i;
duk_uint_fast32_t i;
/* strings are only tracked by stringtable */
if (heap->st) {
@ -428,7 +428,7 @@ duk_heap *duk_heap_alloc(duk_alloc_function alloc_func,
res->st_size = DUK_STRTAB_INITIAL_SIZE;
#ifdef DUK_USE_EXPLICIT_NULL_INIT
{
int i;
duk_uint_fast32_t i;
for (i = 0; i < res->st_size; i++) {
res->st[i] = NULL;
}

7
src/duk_heap_markandsweep.c

@ -28,8 +28,10 @@ static duk_hthread *get_temp_hthread(duk_heap *heap) {
*/
static void mark_hstring(duk_heap *heap, duk_hstring *h) {
DUK_DDDPRINT("mark_hstring: %p", (void *) h);
DUK_UNREF(heap);
DUK_UNREF(h);
DUK_DDDPRINT("mark_hstring: %p", (void *) h);
DUK_ASSERT(h);
/* nothing to process */
@ -513,6 +515,7 @@ static void sweep_heap(duk_heap *heap, int flags) {
int count_rescue = 0;
#endif
DUK_UNREF(flags);
DUK_DDPRINT("sweep_heap: %p", (void *) heap);
prev = NULL;
@ -730,6 +733,8 @@ static void compact_object_list(duk_heap *heap, duk_hthread *thr, duk_heaphdr *s
#endif
duk_hobject *obj;
DUK_UNREF(heap);
curr = start;
while (curr) {
DUK_DDDPRINT("mark-and-sweep compact: %p", (void *) curr);

5
src/duk_js_compiler.c

@ -367,6 +367,7 @@ static void recursion_decrease(duk_compiler_ctx *comp_ctx) {
}
static int hstring_is_eval_or_arguments(duk_compiler_ctx *comp_ctx, duk_hstring *h) {
DUK_UNREF(comp_ctx);
DUK_ASSERT(h != NULL);
return DUK_HSTRING_HAS_EVAL_OR_ARGUMENTS(h);
}
@ -4730,6 +4731,8 @@ static void parse_break_or_continue_statement(duk_compiler_ctx *comp_ctx, duk_iv
int label_pc; /* points to LABEL; pc+1 = jump site for break; pc+2 = jump site for continue */
int label_is_closest;
DUK_UNREF(res);
advance(comp_ctx); /* eat 'break' or 'continue' */
if (comp_ctx->curr_token.t == DUK_TOK_SEMICOLON || /* explicit semi follows */
@ -4880,6 +4883,8 @@ static void parse_try_statement(duk_compiler_ctx *comp_ctx, duk_ivalue *res) {
int pc_catch = -1;
int pc_finally = -1;
DUK_UNREF(res);
/*
* See the following documentation for discussion:
*

Loading…
Cancel
Save