This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: GDB 7.99.91 MinGW compilation error in cli-script.c
> Date: Wed, 17 May 2017 19:01:23 +0300
> From: Eli Zaretskii <eliz@gnu.org>
> CC: simon.marchi@polymtl.ca, gdb-patches@sourceware.org
>
> I will probably post later a workaround patch for older versions,
> but that's for master. I see no reason to delay the release or to
> have the fix on the branch.
Is the below OK? It's a bit ugly, and a small fix is needed even for
the latest MinGW runtime.
Contrary to what I wrote, maybe it's also should be considered for the
branch. Let me know what you think.
diff --git a/gdb/cli/cli-script.c b/gdb/cli/cli-script.c
index e0e27ef..ec33a37 100644
--- a/gdb/cli/cli-script.c
+++ b/gdb/cli/cli-script.c
@@ -17,6 +17,23 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
+#if defined __MINGW32__
+# include <_mingw.h>
+# ifndef __MINGW64_VERSION_MAJOR
+// For versions of mingw.org's MinGW runtime before 5.0, make sure
+// libstdc++ headers don't omit portions that require C99.
+# if __MINGW32_MAJOR_VERSION < 5
+# ifndef _GLIBCXX_USE_C99
+# define _GLIBCXX_USE_C99 1
+# endif
+# else
+// This is required with mingwrt-5.0 to avoid linking errors due to
+// multiple definitions of vsnprintf.
+# undef __USE_MINGW_ANSI_STDIO
+# endif
+# endif
+#endif
+
#include "defs.h"
#include "value.h"
#include "language.h" /* For value_true */