Patchwork MinGW build failure for GDB 8.2.90 with source-highlight

login
register
mail settings
Submitter Eli Zaretskii
Date March 12, 2019, 3:49 p.m.
Message ID <83ef7c3xft.fsf@gnu.org>
Download mbox | patch
Permalink /patch/31823/
State New
Headers show

Comments

Eli Zaretskii - March 12, 2019, 3:49 p.m.
> X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_50,RCVD_IN_DNSWL_MED,
> 	URIBL_BLOCKED autolearn=disabled version=3.3.2
> Date: Mon, 11 Mar 2019 22:31:17 -0400
> From: Simon Marchi <simon.marchi@polymtl.ca>
> Cc: gdb-patches@sourceware.org, Pedro Alves <palves@redhat.com>
> 
> >> Perhaps we should simply #undef these two symbols before including
> >> <fstream>?
> > 
> > TIA
> 
> If the change is localized in one or a handful of files, I think it 
> would be acceptable for the 8.3 release, since the alternative solution 
> would be (1) a lot of work and (2) risky.
> 
> Can you post a patch that fixes the build for you?

Sure, here it is:
Simon Marchi - March 12, 2019, 4:29 p.m.
On 2019-03-12 11:49, Eli Zaretskii wrote:
>> X-Spam-Status: No, score=-1.5 required=5.0 
>> tests=BAYES_50,RCVD_IN_DNSWL_MED,
>> 	URIBL_BLOCKED autolearn=disabled version=3.3.2
>> Date: Mon, 11 Mar 2019 22:31:17 -0400
>> From: Simon Marchi <simon.marchi@polymtl.ca>
>> Cc: gdb-patches@sourceware.org, Pedro Alves <palves@redhat.com>
>> 
>> >> Perhaps we should simply #undef these two symbols before including
>> >> <fstream>?
>> >
>> > TIA
>> 
>> If the change is localized in one or a handful of files, I think it
>> would be acceptable for the 8.3 release, since the alternative 
>> solution
>> would be (1) a lot of work and (2) risky.
>> 
>> Can you post a patch that fixes the build for you?
> 
> Sure, here it is:
> 
> diff --git a/gdb/source-cache.c b/gdb/source-cache.c
> index 097c8a3..b98272c 100644
> --- a/gdb/source-cache.c
> +++ b/gdb/source-cache.c
> @@ -23,6 +23,8 @@
>  #include "cli/cli-style.h"
> 
>  #ifdef HAVE_SOURCE_HIGHLIGHT
> +#undef open
> +#undef close
>  #include <fstream>
>  #include <sstream>
>  #include <srchilite/sourcehighlight.h>

Thanks, this is fine with me, maybe with a comment explaining why it's 
needed.  I also think you could push it to the master branch, so that it 
builds for mingw users.  We will try to get the proper solution merged 
in the next release cycle, at which point we can remove this "hack".

Simon
Eli Zaretskii - March 12, 2019, 5:53 p.m.
> Date: Tue, 12 Mar 2019 12:29:48 -0400
> From: Simon Marchi <simon.marchi@polymtl.ca>
> Cc: gdb-patches@sourceware.org, palves@redhat.com
> 
> > diff --git a/gdb/source-cache.c b/gdb/source-cache.c
> > index 097c8a3..b98272c 100644
> > --- a/gdb/source-cache.c
> > +++ b/gdb/source-cache.c
> > @@ -23,6 +23,8 @@
> >  #include "cli/cli-style.h"
> > 
> >  #ifdef HAVE_SOURCE_HIGHLIGHT
> > +#undef open
> > +#undef close
> >  #include <fstream>
> >  #include <sstream>
> >  #include <srchilite/sourcehighlight.h>
> 
> Thanks, this is fine with me, maybe with a comment explaining why it's 
> needed.  I also think you could push it to the master branch, so that it 
> builds for mingw users.

Done, on both counts.

Thanks for the review.

Patch

diff --git a/gdb/source-cache.c b/gdb/source-cache.c
index 097c8a3..b98272c 100644
--- a/gdb/source-cache.c
+++ b/gdb/source-cache.c
@@ -23,6 +23,8 @@ 
 #include "cli/cli-style.h"
 
 #ifdef HAVE_SOURCE_HIGHLIGHT
+#undef open
+#undef close
 #include <fstream>
 #include <sstream>
 #include <srchilite/sourcehighlight.h>