Fix MinGW build with source-highlight
authorEli Zaretskii <eliz@gnu.org>
Tue, 12 Mar 2019 17:47:23 +0000 (19:47 +0200)
committerEli Zaretskii <eliz@gnu.org>
Tue, 12 Mar 2019 17:47:23 +0000 (19:47 +0200)
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.

gdb/ChangeLog
gdb/source-cache.c

index 8d72d38..4e592a3 100644 (file)
@@ -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-12  Tom Tromey  <tromey@adacore.com>
 
        * remote.c (magic_null_ptid, not_sent_ptid, any_thread_ptid): Now
index 097c8a3..435de2a 100644 (file)
 #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>