The mingw32 gcc compiler doesn't treat __inline as Visual C++ does. Use `static inline` instead of `__inline` for c99_vsnprintf. Don't use `__inline` for ts_utf8_sequence_length.
Unified · Split
| @@ -101,7 +101,13 @@ int cst_sprintf(char *s, const char *fmt, ...); · 100 unmodified lines | ||
| 101 | 101 | #ifdef _WIN32 |
| 102 | 102 | #define snprintf c99_snprintf |
| 103 | 103 | |
| 104 | −__inline int c99_vsnprintf(char* str, size_t size, const char* format, | |
| 104 | +#ifdef __GNUC__ | |
| 105 | +#define INLINE static inline | |
| 106 | +#else | |
| 107 | +#define INLINE __inline | |
| 108 | +#endif | |
| 109 | + | |
| 110 | +INLINE int c99_vsnprintf(char* str, size_t size, const char* format, | |
| 105 | 111 | va_list ap) { |
| 106 | 112 | int count = -1; |
| 107 | 113 | if (size != 0) |
| @@ -110,7 +116,7 @@ va_list ap) { · 2 unmodified lines | ||
| 110 | 116 | count = _vscprintf(format, ap); |
| 111 | 117 | return count; |
| 112 | 118 | } |
| 113 | −__inline int c99_snprintf(char* str, size_t size, const char* format, ...) | |
| 119 | +INLINE int c99_snprintf(char* str, size_t size, const char* format, ...) | |
| 114 | 120 | { |
| 115 | 121 | int count; |
| 116 | 122 | va_list ap; |
| @@ -130,7 +130,7 @@ cst_tokenstream *ts_open_generic(const char *filename, · 129 unmodified lines | ||
| 130 | 130 | int (*getc)(cst_tokenstream *ts)); |
| 131 | 131 | void ts_close(cst_tokenstream *ts); |
| 132 | 132 | |
| 133 | −#ifdef _WIN32 | |
| 133 | +#if defined(_WIN32) && !defined(__GNUC__) | |
| 134 | 134 | __inline int ts_utf8_sequence_length(char c0); |
| 135 | 135 | #else |
| 136 | 136 | int ts_utf8_sequence_length(char c0); |
| @@ -266,7 +266,7 @@ static void get_token_sub_part(cst_tokenstream *ts, · 265 unmodified lines | ||
| 266 | 266 | (*buffer)[p] = '\0'; |
| 267 | 267 | } |
| 268 | 268 | |
| 269 | − #ifdef _WIN32 | |
| 269 | + #if defined _WIN32 && !defined(__GNUC__) | |
| 270 | 270 | __inline int ts_utf8_sequence_length(char c0) |
| 271 | 271 | #else |
| 272 | 272 | int ts_utf8_sequence_length(char c0) |