This is the mail archive of the
gdb-cvs@sourceware.org
mailing list for the GDB project.
[binutils-gdb/gdb-8.3-branch] Fix MinGW build with source-highlight
- From: Eli Zaretskii <eliz at sourceware dot org>
- To: gdb-cvs at sourceware dot org
- Date: 12 Mar 2019 17:50:02 -0000
- Subject: [binutils-gdb/gdb-8.3-branch] Fix MinGW build with source-highlight
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=4a9e44628b32c26e91aa480ae93db4432ed8d957
commit 4a9e44628b32c26e91aa480ae93db4432ed8d957
Author: Eli Zaretskii <eliz@gnu.org>
Date: Tue Mar 12 19:47:23 2019 +0200
Fix MinGW build with source-highlight
gdb/ChangeLog
2019-03-12 Eli Zaretskii <eliz@gnu.org>
PR/24325
* source-cache.c: #undef open and close, to avoid unresolved
externals during linking.
(cherry picked from commit 3a3508220eecf27e1952a73cd3ea6d6314ce8e1d)
Diff:
---
gdb/ChangeLog | 6 ++++++
gdb/source-cache.c | 6 ++++++
2 files changed, 12 insertions(+)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index b6c78f0..a7cb89d 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,9 @@
+2019-03-12 Eli Zaretskii <eliz@gnu.org>
+
+ PR/24325
+ * source-cache.c: #undef open and close, to avoid unresolved
+ externals during linking.
+
2019-03-08 Eli Zaretskii <eliz@gnu.org>
Support styling on native MS-Windows console
diff --git a/gdb/source-cache.c b/gdb/source-cache.c
index 097c8a3..435de2a 100644
--- a/gdb/source-cache.c
+++ b/gdb/source-cache.c
@@ -23,6 +23,12 @@
#include "cli/cli-style.h"
#ifdef HAVE_SOURCE_HIGHLIGHT
+/* If Gnulib redirects 'open' and 'close' to its replacements
+ 'rpl_open' and 'rpl_close' via cpp macros, including <fstream>
+ below with those macros in effect will cause unresolved externals
+ when GDB is linked. Happens, e.g., in the MinGW build. */
+#undef open
+#undef close
#include <fstream>
#include <sstream>
#include <srchilite/sourcehighlight.h>