summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fitz/fitz.h19
1 files changed, 17 insertions, 2 deletions
diff --git a/fitz/fitz.h b/fitz/fitz.h
index 61f80756..10dce6c9 100644
--- a/fitz/fitz.h
+++ b/fitz/fitz.h
@@ -92,17 +92,32 @@ int gettimeofday(struct timeval *tv, struct timezone *tz);
/*
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.
*/
+#ifndef __cplusplus
#if __STDC_VERSION__ == 199901L /* C99 */
#elif _MSC_VER >= 1500 /* MSVC 9 or newer */
#define inline __inline
-#define restrict __restrict
#elif __GNUC__ >= 3 /* GCC 3 or newer */
#define inline __inline
-#define restrict __restrict
#else /* Unknown or ancient */
#define inline
+#endif
+#endif
+
+/*
+ restrict is standard in C99, but not in all C++ compilers. Enable
+ where possible, disable if in doubt.
+ */
+#if __STDC_VERSION__ == 199901L /* C99 */
+#elif _MSC_VER >= 1500 /* MSVC 9 or newer */
+#define restrict __restrict
+#elif __GNUC__ >= 3 /* GCC 3 or newer */
+#define restrict __restrict
+#else /* Unknown or ancient */
#define restrict
#endif