History

Fix undefined reference to c99_vsnprintf and ts_utf8_sequence_length when using mingw32 gcc.

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.

Kubo Takehiro committed 8 years ago

Commit de2bbb31 parent df846b03 files · +10 −4Browse files

Unified · Split

3 files
  1. include/cst_file.h +8 −2
  2. include/cst_tokenstream.h +1 −1
  3. src/utils/cst_tokenstream.c +1 −1
include/cst_file.h+8−2
@@ -101,7 +101,13 @@ int cst_sprintf(char *s, const char *fmt, ...); · 100 unmodified lines
101#ifdef _WIN32101#ifdef _WIN32
102#define snprintf c99_snprintf102#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
110INLINE int c99_vsnprintf(char* str, size_t size, const char* format,
105va_list ap) {111va_list ap) {
106 int count = -1;112 int count = -1;
107 if (size != 0)113 if (size != 0)
@@ -110,7 +116,7 @@ va_list ap) { · 2 unmodified lines
110 count = _vscprintf(format, ap);116 count = _vscprintf(format, ap);
111 return count;117 return count;
112 }118 }
113__inline int c99_snprintf(char* str, size_t size, const char* format, ...)119INLINE int c99_snprintf(char* str, size_t size, const char* format, ...)
114{120{
115 int count;121 int count;
116 va_list ap;122 va_list ap;
include/cst_tokenstream.h+1−1
@@ -130,7 +130,7 @@ cst_tokenstream *ts_open_generic(const char *filename, · 129 unmodified lines
130 int (*getc)(cst_tokenstream *ts));130 int (*getc)(cst_tokenstream *ts));
131void ts_close(cst_tokenstream *ts);131void ts_close(cst_tokenstream *ts);
132 132
133#ifdef _WIN32133#if defined(_WIN32) && !defined(__GNUC__)
134__inline int ts_utf8_sequence_length(char c0);134__inline int ts_utf8_sequence_length(char c0);
135#else135#else
136int ts_utf8_sequence_length(char c0);136int ts_utf8_sequence_length(char c0);
src/utils/cst_tokenstream.c+1−1
@@ -266,7 +266,7 @@ static void get_token_sub_part(cst_tokenstream *ts, · 265 unmodified lines
266 (*buffer)[p] = '\0';266 (*buffer)[p] = '\0';
267}267}
268 268
269 #ifdef _WIN32269 #if defined _WIN32 && !defined(__GNUC__)
270 __inline int ts_utf8_sequence_length(char c0)270 __inline int ts_utf8_sequence_length(char c0)
271 #else271 #else
272 int ts_utf8_sequence_length(char c0)272 int ts_utf8_sequence_length(char c0)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t