From f00621c645ca24f8d228bac7b1dbb5763d1f4db3 Mon Sep 17 00:00:00 2001
From: Liu Hao <lh_mouse@126.com>
Date: Wed, 6 May 2020 21:49:18 +0800
Subject: [PATCH 12/16] libgomp: Don't hard-code MS printf attributes

---
 libgomp/libgomp.h | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/libgomp/libgomp.h b/libgomp/libgomp.h
index 75192749dc7..add858d2cd3 100644
--- a/libgomp/libgomp.h
+++ b/libgomp/libgomp.h
@@ -69,6 +69,13 @@
 # endif
 #endif
 
+#include <stdio.h>
+#ifdef __MINGW_PRINTF_FORMAT
+#define PRINTF_FORMAT __MINGW_PRINTF_FORMAT
+#else
+#define PRINTF_FORMAT printf
+#endif
+
 #ifdef HAVE_ATTRIBUTE_VISIBILITY
 # pragma GCC visibility push(hidden)
 #endif
@@ -176,7 +183,7 @@ team_free (void *ptr)
 
 extern void gomp_vdebug (int, const char *, va_list);
 extern void gomp_debug (int, const char *, ...)
-	__attribute__ ((format (printf, 2, 3)));
+	__attribute__ ((format (PRINTF_FORMAT, 2, 3)));
 #define gomp_vdebug(KIND, FMT, VALIST) \
   do { \
     if (__builtin_expect (gomp_debug_var, 0)) \
@@ -189,11 +196,11 @@ extern void gomp_debug (int, const char *, ...)
   } while (0)
 extern void gomp_verror (const char *, va_list);
 extern void gomp_error (const char *, ...)
-	__attribute__ ((format (printf, 1, 2)));
+	__attribute__ ((format (PRINTF_FORMAT, 1, 2)));
 extern void gomp_vfatal (const char *, va_list)
 	__attribute__ ((noreturn));
 extern void gomp_fatal (const char *, ...)
-	__attribute__ ((noreturn, format (printf, 1, 2)));
+	__attribute__ ((noreturn, format (PRINTF_FORMAT, 1, 2)));
 
 struct gomp_task;
 struct gomp_taskgroup;
-- 
2.38.1

