Commit 860737c2 authored by Hib Eris's avatar Hib Eris Committed by Albert Astals Cid

Use ansi stdio extensions when using a mingw compiler

In the C runtime used by mingw compilers (msvcrt.dll) the printf
function does not support the C99 format-width specifier "%ll".

Defining __USE_MINGW_ANSI_STDIO enables mingw's ansi stdio extensions
that implement a C99 compliant printf function.

https://bugs.freedesktop.org/show_bug.cgi?id=65238
parent dd30ce39
......@@ -161,6 +161,10 @@ if(ENABLE_LIBCURL)
endif(ENABLE_LIBCURL)
add_definitions(-DHAVE_CONFIG_H=1)
if(MINGW)
# Use mingw's ansi stdio extensions
add_definitions(-D__USE_MINGW_ANSI_STDIO=1)
endif(MINGW)
if(FONTCONFIG_FOUND)
add_definitions(${FONTCONFIG_DEFINITIONS})
include_directories(${FONTCONFIG_INCLUDE_DIR})
......
......@@ -66,6 +66,9 @@ case "$host_os" in
win32_libs="-lgdi32"
create_shared_lib="-no-undefined"
auto_import_flags="-Wl,--enable-auto-import"
# Use mingw's ansi stdio extensions
CXXFLAGS="$CXXFLAGS -D__USE_MINGW_ANSI_STDIO=1"
;;
esac
......
......@@ -158,8 +158,13 @@ char * strtok_r (char *s, const char *delim, char **save_ptr);
//------------------------------------------------------------------------
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4)
#ifdef __USE_MINGW_ANSI_STDIO
#define GCC_PRINTF_FORMAT(fmt_index, va_index) \
__attribute__((__format__(__MINGW_PRINTF_FORMAT, fmt_index, va_index)))
#else
#define GCC_PRINTF_FORMAT(fmt_index, va_index) \
__attribute__((__format__(__printf__, fmt_index, va_index)))
#endif
#else
#define GCC_PRINTF_FORMAT(fmt_index, va_index)
#endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment