Browse Source

more compile warning fixes for gcc-4.4.5 (on mips)

pull/1/head
Sami Vaarala 11 years ago
parent
commit
2c2e88fd83
  1. 9
      src/duk_error_macros.c
  2. 1
      src/duk_heap.h

9
src/duk_error_macros.c

@ -23,12 +23,19 @@ void duk_err_handle_panic(const char *filename, int line, int code, const char *
va_list ap;
char msg1[BUFSIZE];
char msg2[BUFSIZE];
const char *tmp;
va_start(ap, fmt);
(void) DUK_VSNPRINTF(msg1, sizeof(msg1), fmt, ap);
msg1[sizeof(msg1) - 1] = (char) 0;
(void) DUK_SNPRINTF(msg2, sizeof(msg2), "(%s:%d): %s", filename ? filename : "null", line, msg1);
msg2[sizeof(msg2) - 1] = (char) 0;
DUK_PANIC_HANDLER(code, msg2);
/* Intermediate variable used to avoid: "warning: the address of ‘msg2’ will always
* evaluate as true" when pragma suppression is not available. For some reason
* this variant does not trigger the warning (although the pointer is most certainly
* always non-NULL).
*/
tmp = (const char *) msg2;
DUK_PANIC_HANDLER(code, tmp);
va_end(ap); /* dead code */
}
#else /* DUK_USE_VARIADIC_MACROS */

1
src/duk_heap.h

@ -299,6 +299,7 @@ struct duk_heap {
/* fatal error handling, called e.g. when a longjmp() is needed but
* lj.jmpbuf_ptr is NULL. fatal_func must never return.
*/
/* FIXME: declaring a function typedef as noreturn? or this specific instance? */
duk_fatal_function fatal_func;
/* longjmp state */

Loading…
Cancel
Save