diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2015-10-14 12:55:48 +0200 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2015-10-14 13:40:24 +0200 |
commit | 4f3c3738a12308b64599277beb955daf82b2d46d (patch) | |
tree | 8b819627a4c1bcd9de0c487e31ad55fdf4b9465b | |
parent | a26dd040c7bd704d3dbee7e47aa8a1a17dbfe0b8 (diff) | |
download | mupdf-4f3c3738a12308b64599277beb955daf82b2d46d.tar.xz |
Add FZ_UNUSED macro for use with public static inline functions.
We should allow client code to build without warnings even
with the -Wunused-parameters flag.
Thanks to Simon Reinhardt for the patch.
-rw-r--r-- | include/mupdf/fitz/stream.h | 4 | ||||
-rw-r--r-- | include/mupdf/fitz/system.h | 22 |
2 files changed, 11 insertions, 15 deletions
diff --git a/include/mupdf/fitz/stream.h b/include/mupdf/fitz/stream.h index 53d5a256..8e9ee638 100644 --- a/include/mupdf/fitz/stream.h +++ b/include/mupdf/fitz/stream.h @@ -310,7 +310,7 @@ static inline int fz_peek_byte(fz_context *ctx, fz_stream *stm) return c; } -static inline void fz_unread_byte(fz_context *ctx, fz_stream *stm) +static inline void fz_unread_byte(fz_context *ctx FZ_UNUSED, fz_stream *stm) { stm->rp--; } @@ -398,7 +398,7 @@ static inline unsigned int fz_read_rbits(fz_context *ctx, fz_stream *stm, int n) return x; } -static inline void fz_sync_bits(fz_context *ctx, fz_stream *stm) +static inline void fz_sync_bits(fz_context *ctx FZ_UNUSED, fz_stream *stm) { stm->avail = 0; } diff --git a/include/mupdf/fitz/system.h b/include/mupdf/fitz/system.h index f4967ebe..ca7c8dc0 100644 --- a/include/mupdf/fitz/system.h +++ b/include/mupdf/fitz/system.h @@ -166,12 +166,7 @@ typedef int fz_off_t; #define LOGE(...) do {} while(0) #endif -/* - Variadic macros, inline and restrict keywords - - inline is standard in C++, so don't touch the definition in this case. - For some compilers we can enable it within C too. -*/ +/* inline is standard in C++. For some compilers we can enable it within C too. */ #ifndef __cplusplus #if __STDC_VERSION__ == 199901L /* C99 */ @@ -184,10 +179,7 @@ typedef int fz_off_t; #endif #endif -/* - restrict is standard in C99, but not in all C++ compilers. Enable - where possible, disable if in doubt. - */ +/* restrict is standard in C99, but not in all C++ compilers. */ #if __STDC_VERSION__ == 199901L /* C99 */ #elif _MSC_VER >= 1500 /* MSVC 9 or newer */ #define restrict __restrict @@ -208,10 +200,14 @@ typedef int fz_off_t; #endif #endif -/* - GCC can do type checking of printf strings -*/ +/* Flag unused parameters, for use with 'static inline' functions in headers. */ +#if __GNUC__ > 2 || __GNUC__ == 2 && __GNUC_MINOR__ >= 7 +#define FZ_UNUSED __attribute__((__unused__)) +#else +#define FZ_UNUSED +#endif +/* GCC can do type checking of printf strings */ #ifndef __printflike #if __GNUC__ > 2 || __GNUC__ == 2 && __GNUC_MINOR__ >= 7 #define __printflike(fmtarg, firstvararg) \ |