OSDN Git Service

Avoid -Wformat noise from snprintf() and vsnprintf()
authorKeith Marshall <keithmarshall@users.sourceforge.net>
Mon, 30 Jan 2017 13:33:51 +0000 (13:33 +0000)
committerKeith Marshall <keithmarshall@users.sourceforge.net>
Mon, 30 Jan 2017 13:33:51 +0000 (13:33 +0000)
mingwrt/ChangeLog
mingwrt/include/stdio.h

index a1ffb6e..8064858 100644 (file)
@@ -1,5 +1,13 @@
 2017-01-30  Keith Marshall  <keithmarshall@users.sourceforge.net>
 
+       Avoid -Wformat noise from snprintf() and vsnprintf()
+
+       * include/stdio.h (snprintf, vsnprintf): Add inline implementations;
+       they redirect to "__mingw_" prefixed alternatives, so suppressing the
+       effect of automatic format attribute recognition.
+
+2017-01-30  Keith Marshall  <keithmarshall@users.sourceforge.net>
+
        Remove duplicate libmingwex.a entries.
 
        * mingwex/jmpstub.sx (DLLENTRY): Interpret it.
index 9e2ccab..e17afa0 100644 (file)
@@ -394,6 +394,16 @@ int sprintf (char *__stream, const char *__format, ...)
 }
 
 __mingw_stdio_redirect__
+int snprintf (char *__stream, size_t __len, const char *__format, ...)
+{
+  register int __retval;
+  __builtin_va_list __local_argv; __builtin_va_start( __local_argv, __format );
+  __retval = __mingw_vsnprintf( __stream, __len, __format, __local_argv );
+  __builtin_va_end( __local_argv );
+  return __retval;
+}
+
+__mingw_stdio_redirect__
 int vfprintf (FILE *__stream, const char *__format, __VALIST __local_argv)
 {
   return __mingw_vfprintf( __stream, __format, __local_argv );
@@ -411,6 +421,12 @@ int vsprintf (char *__stream, const char *__format, __VALIST __local_argv)
   return __mingw_vsprintf( __stream, __format, __local_argv );
 }
 
+__mingw_stdio_redirect__
+int vsnprintf (char *__stream, size_t __len, const char *__format, __VALIST __local_argv)
+{
+  return __mingw_vsnprintf( __stream, __len, __format, __local_argv );
+}
+
 #else
 /* Default configuration: simply direct all calls to MSVCRT...
  */