ref: 3715d6d145225f957de9f40d3154e0ef458b94e6
parent: d2741314f1843e8a64e04b440f9cbae52dbecc69
author: Tor Andersson <tor@ccxvii.net>
date: Thu Jan 16 09:15:17 EST 2014
Add JS_NORETURN declaration to longjumping functions.
--- a/js.h
+++ b/js.h
@@ -9,8 +9,28 @@
#include <setjmp.h>
#include <math.h>
-typedef struct js_State js_State;
+/* noreturn is a GCC extension */
+#ifdef __GNUC__
+#define JS_NORETURN __attribute__((noreturn))
+#else
+#ifdef _MSC_VER
+#define JS_NORETURN __declspec(noreturn)
+#else
+#define JS_NORETURN
+#endif
+#endif
+/* GCC can do type checking of printf strings */
+#ifndef __printflike
+#if __GNUC__ > 2 || __GNUC__ == 2 && __GNUC_MINOR__ >= 7
+#define __printflike(fmtarg, firstvararg) \
+ __attribute__((__format__ (__printf__, fmtarg, firstvararg)))
+#else
+#define __printflike(fmtarg, firstvararg)
+#endif
+#endif
+
+typedef struct js_State js_State;
#define JS_REGEXP_G 1
#define JS_REGEXP_I 2
--- a/jscompile.c
+++ b/jscompile.c
@@ -752,7 +752,6 @@
fprintf(stderr, "\n");
longjmp(J->jb, 1);
- return 0;
}
void jsC_freecompile(js_State *J)
--- a/jscompile.h
+++ b/jscompile.h
@@ -109,7 +109,7 @@
js_Function *jsC_compile(js_State *J, js_Ast *prog);
void jsC_freecompile(js_State *J);
-int jsC_error(js_State *J, js_Ast *node, const char *fmt, ...);
+JS_NORETURN int jsC_error(js_State *J, js_Ast *node, const char *fmt, ...);
void jsC_dumpfunction(js_State *J, js_Function *fun);
--- a/jslex.h
+++ b/jslex.h
@@ -68,7 +68,7 @@
void jsP_initlex(js_State *J, const char *filename, const char *source);
int jsP_lex(js_State *J);
const char *jsP_tokenstring(int token);
-int jsP_error(js_State *J, const char *fmt, ...);
+JS_NORETURN int jsP_error(js_State *J, const char *fmt, ...);
void jsP_warning(js_State *J, const char *fmt, ...);
#endif
--- a/jsparse.c
+++ b/jsparse.c
@@ -860,7 +860,6 @@
fprintf(stderr, "\n");
longjmp(J->jb, 1);
- return 0;
}
js_Ast *jsP_parse(js_State *J, const char *filename, const char *source)