1 /* Missing functions and other misc stuff to support
2 * the horrible MS C compiler
4 * TODO could be improved by version-checking for C99 support
10 // disable warning about unsafe strncpy vs strncpy_s usage
11 #pragma warning(disable : 4996)
12 // disable warning about constant conditional expressions
13 #pragma warning(disable : 4127)
14 // disable warning about non-constant aggregate initializer
15 #pragma warning(disable : 4204)
17 // disable warning about global shadowing
18 #pragma warning(disable : 4459)
19 // disable warning about parameter shadowing
20 #pragma warning(disable : 4457)
22 // Suppress warning about unused parameters. The macro definition
23 // _should_ work, but it doesn't on VS2012 (cl 17), may be a version thing
24 #define UNUSED(x) x __pragma(warning(suppress: 4100))
25 // TODO FIXME remove full-blown warning removal where not needed
26 #pragma warning(disable: 4100)
29 #define inline __inline
31 // No snprintf in MS C, copy over implementation taken from
37 inline int c99_vsnprintf(char* str, size_t size, const char* format, va_list ap)
42 count = _vsnprintf_s(str, size, _TRUNCATE, format, ap);
44 count = _vscprintf(format, ap);
49 inline int c99_snprintf(char* str, size_t size, const char* format, ...)
55 count = c99_vsnprintf(str, size, format, ap);
61 #define snprintf c99_snprintf
63 // And no __func__ either
65 #define __func__ __FUNCTION__