On 4/27/2013 22:40, Dongsheng Song wrote: > Here is the root cause. > > gettext use C linkage at gettext-runtime/libasprintf/vasprintf.h: > > #ifdef __cplusplus > extern "C" { > #endif > > /* Write formatted output to a string dynamically allocated with malloc(). > If the memory allocation succeeds, store the address of the string in > *RESULT and return the number of resulting bytes, excluding the trailing > NUL. Upon memory allocation error, or some other error, return -1. */ > extern int asprintf (char **result, const char *format, ...) > __attribute__ ((__format__ (__printf__, 2, 3))); > extern int vasprintf (char **result, const char *format, va_list args) > __attribute__ ((__format__ (__printf__, 2, 0))); >
__printf__ is not the same as gnu_printf, it is a mess on the gettext side. > > On stdio.h, mingw-w64 use C++ linkage: > > /* There seems to be a bug about builtins and static overrides of them > in g++. So we need to do here some trickery. */ There aren't any asprintf builtins, so probably a good idea to move it. > #ifdef __cplusplus > extern "C++" { > #endif > ... > #ifdef _GNU_SOURCE > __mingw_ovr > __attribute__ ((__format__ (gnu_printf, 2, 3))) __attribute__((nonnull (1,2))) > int asprintf(char **__ret, const char *__format, ...) > { > register int __retval; > __builtin_va_list __local_argv; __builtin_va_start( __local_argv, __format > ); > __retval = __mingw_vasprintf( __ret, __format, __local_argv ); > __builtin_va_end( __local_argv ); > return __retval; > } > > __mingw_ovr > __attribute__ ((__format__ (gnu_printf, 2, 0))) __attribute__((nonnull (1,2))) > int vasprintf(char **__ret, const char *__format, __builtin_va_list > __local_argv) > { > return __mingw_vasprintf( __ret, __format, __local_argv ); > } > #endif /* _GNU_SOURCE */ > ... > > I think mingw-w64 should not use C++ linkage for these C functions > when use C++ compiler. Alternatively, don't declare it in gettext.
signature.asc
Description: OpenPGP digital signature
_______________________________________________ mingw mailing list mingw@lists.fedoraproject.org https://admin.fedoraproject.org/mailman/listinfo/mingw