Hi, patch attached

Removes some defines to select printf() implementations:
either C99 either Microsoft ones.

#define conflicts with some cases like __attribute__ ((format (printf, 2, 0)))
(although __printf__ should be preferred here)

#define conflicts with C++ functions having the same name than standard 
functions but different prototype.

-- 
Rafaël Carré
Index: mingw-w64-headers/crt/_mingw_print_push.h
===================================================================
--- mingw-w64-headers/crt/_mingw_print_push.h	(révision 4562)
+++ mingw-w64-headers/crt/_mingw_print_push.h	(copie de travail)
@@ -6,15 +6,6 @@
 
 /* Undefine __mingw_<printf> macros.  */
 #if defined(__USE_MINGW_ANSI_STDIO) && ((__USE_MINGW_ANSI_STDIO + 0) != 0)
-#undef fprintf
-#undef printf
-#undef sprintf
-#undef snprintf
-#undef vfprintf
-#undef vprintf
-#undef vsprintf
-#undef vsnprintf
-
 #undef fwprintf
 #undef wprintf
 #undef vfwprintf
@@ -38,9 +29,6 @@
 #undef fwscanf
 #undef vfwscanf
 
-#undef asprintf
-#undef vasprintf
-
 /* Redefine to MS specific PRI... and SCN... macros.  */
 #if defined(_INTTYPES_H_) && defined(PRId64)
 #undef PRId64
Index: mingw-w64-headers/crt/_mingw_print_pop.h
===================================================================
--- mingw-w64-headers/crt/_mingw_print_pop.h	(révision 4562)
+++ mingw-w64-headers/crt/_mingw_print_pop.h	(copie de travail)
@@ -7,15 +7,6 @@
 /* Define __mingw_<printf> macros.  */
 #if defined(__USE_MINGW_ANSI_STDIO) && (defined(_INC_STDIO) || defined(_WSTDIO_DEFINED)) && ((__USE_MINGW_ANSI_STDIO + 0) != 0)
 #ifdef _INC_STDIO
-#define fprintf		__mingw_fprintf
-#define printf		__mingw_printf
-#define sprintf		__mingw_sprintf
-#define snprintf	__mingw_snprintf
-#define vfprintf	__mingw_vfprintf
-#define vprintf		__mingw_vprintf
-#define vsprintf	__mingw_vsprintf
-#define vsnprintf	__mingw_vsnprintf
-
 #define sscanf __mingw_sscanf
 #define vsscanf __mingw_vsscanf
 #define scanf __mingw_scanf
@@ -23,9 +14,6 @@
 #define fscanf __mingw_fscanf
 #define vfscanf __mingw_vfscanf
 
-#define asprintf __mingw_asprintf
-#define vasprintf __mingw_vasprintf
-
 #endif
 
 #ifdef _WSTDIO_DEFINED
Index: mingw-w64-headers/crt/stdio.h
===================================================================
--- mingw-w64-headers/crt/stdio.h	(révision 4562)
+++ mingw-w64-headers/crt/stdio.h	(copie de travail)
@@ -136,7 +136,162 @@
 #define _TWO_DIGIT_EXPONENT 0x1
 
 #ifndef _STDIO_DEFINED
+extern
+  __attribute__((__format__ (gnu_printf, 3, 0))) __MINGW_ATTRIB_NONNULL(3)
+  int __cdecl __mingw_vsnprintf(char * __restrict__ _DstBuf,size_t _MaxCount,const char * __restrict__ _Format,
+                               va_list _ArgList);
+extern
+  __attribute__((__format__ (gnu_printf, 3, 4))) __MINGW_ATTRIB_NONNULL(3)
+  int __cdecl __mingw_snprintf(char * __restrict__ s, size_t n, const char * __restrict__  format, ...);
+extern
+  __attribute__((__format__ (gnu_printf, 1, 2))) __MINGW_ATTRIB_NONNULL(1)
+  int __cdecl __mingw_printf(const char * __restrict__ , ... ) __MINGW_NOTHROW;
+extern
+  __attribute__((__format__ (gnu_printf, 1, 0))) __MINGW_ATTRIB_NONNULL(1)
+  int __cdecl __mingw_vprintf (const char * __restrict__ , va_list) __MINGW_NOTHROW;
+extern
+  __attribute__((__format__ (gnu_printf, 2, 3))) __MINGW_ATTRIB_NONNULL(2)
+  int __cdecl __mingw_fprintf (FILE * __restrict__ , const char * __restrict__ , ...) __MINGW_NOTHROW;
+extern
+  __attribute__((__format__ (gnu_printf, 2, 0))) __MINGW_ATTRIB_NONNULL(2)
+  int __cdecl __mingw_vfprintf (FILE * __restrict__ , const char * __restrict__ , va_list) __MINGW_NOTHROW;
+extern
+  __attribute__((__format__ (gnu_printf, 2, 3))) __MINGW_ATTRIB_NONNULL(2)
+  int __cdecl __mingw_sprintf (char * __restrict__ , const char * __restrict__ , ...) __MINGW_NOTHROW;
+extern
+  __attribute__((__format__ (gnu_printf, 2, 0))) __MINGW_ATTRIB_NONNULL(2)
+  int __cdecl __mingw_vsprintf (char * __restrict__ , const char * __restrict__ , va_list) __MINGW_NOTHROW;
+extern
+  __attribute__ ((format (gnu_printf, 2, 3))) __attribute__((nonnull (1,2))) __
+  int __cdecl mingw_asprintf(char **ret, const char *format, ...);
+extern
+  __attribute__ ((format (gnu_printf, 2, 0))) __attribute__((nonnull (1,2))) __
+  int __cdecl mingw_vasprintf(char **ret, const char *format, va_list ap);
 
+#if __USE_MINGW_ANSI_STDIO
+/*
+ * User has expressed a preference for C99 conformance...
+ */
+__forceinline
+__attribute__((__format__ (gnu_printf, 2, 3))) __MINGW_ATTRIB_NONNULL(2)
+int fprintf (FILE *__stream, const char *__format, ...)
+{
+  register int __retval;
+  __builtin_va_list __local_argv; __builtin_va_start( __local_argv, __format );
+  __retval = __mingw_vfprintf( __stream, __format, __local_argv );
+  __builtin_va_end( __local_argv );
+  return __retval;
+}
+
+__forceinline
+__attribute__((__format__ (gnu_printf, 1, 2))) __MINGW_ATTRIB_NONNULL(1)
+int printf (const char *__format, ...)
+{
+  register int __retval;
+  __builtin_va_list __local_argv; __builtin_va_start( __local_argv, __format );
+  __retval = __mingw_vprintf( __format, __local_argv );
+  __builtin_va_end( __local_argv );
+  return __retval;
+}
+
+__forceinline
+__attribute__((__format__ (gnu_printf, 2, 3))) __MINGW_ATTRIB_NONNULL(2)
+int sprintf (char *__stream, const char *__format, ...)
+{
+  register int __retval;
+  __builtin_va_list __local_argv; __builtin_va_start( __local_argv, __format );
+  __retval = __mingw_vsprintf( __stream, __format, __local_argv );
+  __builtin_va_end( __local_argv );
+  return __retval;
+}
+
+__forceinline
+__attribute__((__format__ (gnu_printf, 2, 0))) __MINGW_ATTRIB_NONNULL(2)
+int vfprintf (FILE *__stream, const char *__format, __builtin_va_list __local_argv)
+{
+  return __mingw_vfprintf( __stream, __format, __local_argv );
+}
+
+__forceinline
+__attribute__((__format__ (gnu_printf, 1, 0))) __MINGW_ATTRIB_NONNULL(1)
+int vprintf (const char *__format, __builtin_va_list __local_argv)
+{
+  return __mingw_vprintf( __format, __local_argv );
+}
+
+__forceinline
+__attribute__((__format__ (gnu_printf, 2, 0))) __MINGW_ATTRIB_NONNULL(2)
+int vsprintf (char *__stream, const char *__format, __builtin_va_list __local_argv)
+{
+  return __mingw_vsprintf( __stream, __format, __local_argv );
+}
+
+__forceinline
+__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_asprintf( __ret, __format, __local_argv );
+  __builtin_va_end( __local_argv );
+  return __retval;
+}
+
+__forceinline
+__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 );
+}
+#ifndef __NO_ISOCEXT  /* externs in libmingwex.a */
+__forceinline
+__attribute__((__format__ (gnu_printf, 3, 4))) __MINGW_ATTRIB_NONNULL(3)
+int snprintf (char *__stream, size_t __n, const char *__format, ...)
+{
+  register int __retval;
+  __builtin_va_list __local_argv; __builtin_va_start( __local_argv, __format );
+  __retval = __mingw_vsnprintf( __stream, __n, __format, __local_argv );
+  __builtin_va_end( __local_argv );
+  return __retval;
+}
+
+__forceinline
+__attribute__((__format__ (gnu_printf, 3, 0))) __MINGW_ATTRIB_NONNULL(3)
+int vsnprintf (char *__stream, size_t __n, const char *__format, __builtin_va_list __local_argv)
+{
+  return __mingw_vsnprintf( __stream, __n, __format, __local_argv );
+}
+#endif /* __NO_ISOCEXT */
+
+#else /* !__USE_MINGW_ANSI_STDIO */
+/*
+ * Default configuration: simply direct all calls to MSVCRT...
+ */
+  int __cdecl fprintf(FILE * __restrict__ _File,const char * __restrict__ _Format,...);
+  int __cdecl printf(const char * __restrict__ _Format,...);
+  int __cdecl sprintf(char * __restrict__ _Dest,const char * __restrict__ _Format,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
+
+  int __cdecl vfprintf(FILE * __restrict__ _File,const char * __restrict__ _Format,va_list _ArgList);
+  int __cdecl vprintf(const char * __restrict__ _Format,va_list _ArgList);
+  int __cdecl vsprintf(char * __restrict__ _Dest,const char * __restrict__ _Format,va_list _Args) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
+
+#ifndef __NO_ISOCEXT  /* externs in libmingwex.a */
+/* this is here to deal with software defining
+ * vsnprintf as _vsnprintf, eg. libxml2.  */
+#pragma push_macro("snprintf")
+#pragma push_macro("vsnprintf")
+# undef snprintf
+# undef vsnprintf
+  int __cdecl snprintf(char * __restrict__ s, size_t n, const char * __restrict__  format, ...);
+#ifndef __CRT__NO_INLINE
+  __CRT__INLINE int __cdecl vsnprintf(char * __restrict__ _DstBuf,size_t _MaxCount,const char * __restrict__ _Format,va_list _ArgList) __MINGW_ATTRIB_DEPRECATED_MSVC2005 __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
+#endif /* __CRT__NO_INLINE */
+#pragma pop_macro ("vsnprintf")
+#pragma pop_macro ("snprintf")
+#endif /* __NO_ISOCEXT */
+
+#endif /* __USE_MINGW_ANSI_STDIO */
+
   _CRTIMP int __cdecl _filbuf(FILE *_File);
   _CRTIMP int __cdecl _flsbuf(int _Ch,FILE *_File);
 #ifdef _POSIX_
@@ -168,7 +323,6 @@
   _CRTIMP int __cdecl _flushall(void);
   FILE *__cdecl fopen(const char * __restrict__ _Filename,const char * __restrict__ _Mode) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
   FILE *fopen64(const char * __restrict__ filename,const char * __restrict__  mode);
-  int __cdecl fprintf(FILE * __restrict__ _File,const char * __restrict__ _Format,...);
   int __cdecl fputc(int _Ch,FILE *_File);
   _CRTIMP int __cdecl _fputchar(int _Ch);
   int __cdecl fputs(const char * __restrict__ _Str,FILE * __restrict__ _File);
@@ -226,7 +380,6 @@
 #define popen	_popen
 #define pclose	_pclose
 #endif
-  int __cdecl printf(const char * __restrict__ _Format,...);
   int __cdecl putc(int _Ch,FILE *_File);
   int __cdecl putchar(int _Ch);
   int __cdecl puts(const char *_Str);
@@ -263,61 +416,13 @@
   FILE *__cdecl tmpfile(void) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
   char *__cdecl tmpnam(char *_Buffer);
   int __cdecl ungetc(int _Ch,FILE *_File);
-  int __cdecl vfprintf(FILE * __restrict__ _File,const char * __restrict__ _Format,va_list _ArgList);
-  int __cdecl vprintf(const char * __restrict__ _Format,va_list _ArgList);
 
-  /* Make sure macros are not defined.  */
-  extern
-    __attribute__((__format__ (gnu_printf, 3, 0))) __MINGW_ATTRIB_NONNULL(3)
-    int __cdecl __mingw_vsnprintf(char * __restrict__ _DstBuf,size_t _MaxCount,const char * __restrict__ _Format,
-				  va_list _ArgList);
-  extern
-    __attribute__((__format__ (gnu_printf, 3, 4))) __MINGW_ATTRIB_NONNULL(3)
-    int __cdecl __mingw_snprintf(char * __restrict__ s, size_t n, const char * __restrict__  format, ...);
-  extern
-    __attribute__((__format__ (gnu_printf, 1, 2))) __MINGW_ATTRIB_NONNULL(1)
-    int __cdecl __mingw_printf(const char * __restrict__ , ... ) __MINGW_NOTHROW;
-  extern
-    __attribute__((__format__ (gnu_printf, 1, 0))) __MINGW_ATTRIB_NONNULL(1)
-    int __cdecl __mingw_vprintf (const char * __restrict__ , va_list) __MINGW_NOTHROW;
-  extern
-    __attribute__((__format__ (gnu_printf, 2, 3))) __MINGW_ATTRIB_NONNULL(2)
-    int __cdecl __mingw_fprintf (FILE * __restrict__ , const char * __restrict__ , ...) __MINGW_NOTHROW;
-  extern
-    __attribute__((__format__ (gnu_printf, 2, 0))) __MINGW_ATTRIB_NONNULL(2)
-    int __cdecl __mingw_vfprintf (FILE * __restrict__ , const char * __restrict__ , va_list) __MINGW_NOTHROW;
-  extern
-    __attribute__((__format__ (gnu_printf, 2, 3))) __MINGW_ATTRIB_NONNULL(2)
-    int __cdecl __mingw_sprintf (char * __restrict__ , const char * __restrict__ , ...) __MINGW_NOTHROW;
-  extern
-    __attribute__((__format__ (gnu_printf, 2, 0))) __MINGW_ATTRIB_NONNULL(2)
-    int __cdecl __mingw_vsprintf (char * __restrict__ , const char * __restrict__ , va_list) __MINGW_NOTHROW;
-
   _CRTIMP int __cdecl _snprintf(char * __restrict__ _Dest,size_t _Count,const char * __restrict__ _Format,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
   _CRTIMP int __cdecl _snprintf_l(char * __restrict__ buffer,size_t count,const char * __restrict__ format,_locale_t locale,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
   _CRTIMP int __cdecl _vsnprintf(char * __restrict__ _Dest,size_t _Count,const char * __restrict__ _Format,va_list _Args) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
   _CRTIMP int __cdecl _vsnprintf_l(char * __restrict__ buffer,size_t count,const char * __restrict__ format,_locale_t locale,va_list argptr) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
-  int __cdecl sprintf(char * __restrict__ _Dest,const char * __restrict__ _Format,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
   int __cdecl _sprintf_l(char * __restrict__ buffer,const char * __restrict__ format,_locale_t locale,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
-  int __cdecl vsprintf(char * __restrict__ _Dest,const char * __restrict__ _Format,va_list _Args) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
 
-/* this is here to deal with software defining
- * vsnprintf as _vsnprintf, eg. libxml2.  */
-#pragma push_macro("snprintf")
-#pragma push_macro("vsnprintf")
-# undef snprintf
-# undef vsnprintf
-  int __cdecl vsnprintf(char * __restrict__ _DstBuf,size_t _MaxCount,const char * __restrict__ _Format,va_list _ArgList) __MINGW_ATTRIB_DEPRECATED_MSVC2005 __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
-#ifndef __NO_ISOCEXT  /* externs in libmingwex.a */
-  int __cdecl snprintf(char * __restrict__ s, size_t n, const char * __restrict__  format, ...);
-#ifndef __CRT__NO_INLINE
-  __CRT_INLINE int __cdecl vsnprintf (char * __restrict__ s, size_t n, const char * __restrict__  format,va_list arg) {
-    return _vsnprintf (s, n, format, arg);
-  }
-#endif /* !__CRT__NO_INLINE */
-#endif /* ! __NO_ISOCEXT*/
-#pragma pop_macro ("vsnprintf")
-#pragma pop_macro ("snprintf")
 
 #ifndef __NO_ISOCEXT  /* externs in libmingwex.a */
   int __cdecl vscanf(const char * __restrict__ Format, va_list argp);
@@ -578,9 +683,6 @@
 
 #endif /* __MINGW_MBWC_CONVERT_DEFINED */
 
-int __cdecl __attribute__ ((format (gnu_printf, 2, 3))) __attribute__((nonnull (1,2))) __mingw_asprintf(char **ret, const char *format, ...);
-int __cdecl __attribute__ ((format (gnu_printf, 2, 0))) __attribute__((nonnull (1,2))) __mingw_vasprintf(char **ret, const char *format, va_list ap);
-
 #ifdef __cplusplus
 }
 #endif
------------------------------------------------------------------------------
Get your Android app more play: Bring it to the BlackBerry PlayBook 
in minutes. BlackBerry App World&#153; now supports Android&#153; Apps 
for the BlackBerry&reg; PlayBook&#153;. Discover just how easy and simple 
it is! http://p.sf.net/sfu/android-dev2dev
_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to