diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2013-03-10 11:47:52 -0400 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2013-03-20 11:10:12 +0000 |
commit | 9d3b728a5f3664161fee1913a0d04ff65a752740 (patch) | |
tree | fba4eff63b8463c7b5b1f074888f5fec6d7828ad /fitz | |
parent | 9b439089b23139e0d0e17e8a54680f9e84e25dc8 (diff) | |
download | mupdf-9d3b728a5f3664161fee1913a0d04ff65a752740.tar.xz |
Add noreturn attribute to throw/rethrow to help improve compiler warnings.
Diffstat (limited to 'fitz')
-rw-r--r-- | fitz/base_error.c | 2 | ||||
-rw-r--r-- | fitz/fitz.h | 11 |
2 files changed, 11 insertions, 2 deletions
diff --git a/fitz/base_error.c b/fitz/base_error.c index de41c023..c3c14a1d 100644 --- a/fitz/base_error.c +++ b/fitz/base_error.c @@ -72,6 +72,8 @@ void fz_warn(fz_context *ctx, const char *fmt, ...) * catch region entered with code = 1. */ +static void throw(fz_error_context *ex) FZ_NORETURN; + static void throw(fz_error_context *ex) { if (ex->top >= 0) { diff --git a/fitz/fitz.h b/fitz/fitz.h index f915d308..294ab958 100644 --- a/fitz/fitz.h +++ b/fitz/fitz.h @@ -113,6 +113,13 @@ FILE *fopen_utf8(const char *name, const char *mode); #define restrict #endif +/* noreturn is a GCC extension */ +#ifdef __GNUC__ +#define FZ_NORETURN __attribute__((noreturn)) +#else +#define FZ_NORETURN +#endif + /* GCC can do type checking of printf strings */ @@ -265,8 +272,8 @@ void fz_var_imp(void *); if (ctx->error->stack[ctx->error->top--].code > 1) int fz_push_try(fz_error_context *ex); -void fz_throw(fz_context *, const char *, ...) __printflike(2, 3); -void fz_rethrow(fz_context *); +void fz_throw(fz_context *, const char *, ...) __printflike(2, 3) FZ_NORETURN; +void fz_rethrow(fz_context *) FZ_NORETURN; void fz_warn(fz_context *ctx, const char *fmt, ...) __printflike(2, 3); const char *fz_caught(fz_context *ctx); |