Message ID | 20180301202005.11563-1-sergiodj@redhat.com |
---|---|
State | New, archived |
Headers |
Received: (qmail 117605 invoked by alias); 1 Mar 2018 20:20:14 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: <gdb-patches.sourceware.org> List-Unsubscribe: <mailto:gdb-patches-unsubscribe-##L=##H@sourceware.org> List-Subscribe: <mailto:gdb-patches-subscribe@sourceware.org> List-Archive: <http://sourceware.org/ml/gdb-patches/> List-Post: <mailto:gdb-patches@sourceware.org> List-Help: <mailto:gdb-patches-help@sourceware.org>, <http://sourceware.org/ml/#faqs> Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 117596 invoked by uid 89); 1 Mar 2018 20:20:13 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.7 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy= X-HELO: mx1.redhat.com Received: from mx3-rdu2.redhat.com (HELO mx1.redhat.com) (66.187.233.73) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 01 Mar 2018 20:20:12 +0000 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 034DF40744C6; Thu, 1 Mar 2018 20:20:11 +0000 (UTC) Received: from psique.yyz.redhat.com (unused-10-15-17-196.yyz.redhat.com [10.15.17.196]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8F01E9C06F; Thu, 1 Mar 2018 20:20:08 +0000 (UTC) From: Sergio Durigan Junior <sergiodj@redhat.com> To: GDB Patches <gdb-patches@sourceware.org> Cc: Simon Marchi <simon.marchi@ericsson.com>, Pedro Alves <palves@redhat.com>, Joel Brobecker <brobecker@adacore.com>, Christophe Lyon <christophe.lyon@linaro.org>, Sergio Durigan Junior <sergiodj@redhat.com> Subject: [PATCH] Conditionally include "<windows.h>" on common/pathstuff.c (and unbreak build on mingw*) Date: Thu, 1 Mar 2018 15:20:05 -0500 Message-Id: <20180301202005.11563-1-sergiodj@redhat.com> In-Reply-To: <CAKdteOYtFqn-4Bvd2Tekjpf+h5D-8dTSLKSPXcC7YAMRrJ1TCw@mail.gmail.com> References: <CAKdteOYtFqn-4Bvd2Tekjpf+h5D-8dTSLKSPXcC7YAMRrJ1TCw@mail.gmail.com> X-IsSubscribed: yes |
Commit Message
Sergio Durigan Junior
March 1, 2018, 8:20 p.m. UTC
commit b4987c956dfa44ca9fd8552f63e15f5fa094b2a4 Author: Sergio Durigan Junior <sergiodj@redhat.com> Date: Fri Feb 9 18:44:59 2018 -0500 Create new common/pathstuff.[ch] Introduced a regression when compiling for mingw*: /gdb/common/pathstuff.c: In function 'gdb::unique_xmalloc_ptr<char> gdb_realpath(const char*)': /gdb/common/pathstuff.c:56:14: error: 'MAX_PATH' was not declared in this scope char buf[MAX_PATH]; ^ /gdb/common/pathstuff.c:57:5: error: 'DWORD' was not declared in this scope DWORD len = GetFullPathName (filename, MAX_PATH, buf, NULL); ^ /gdb/common/pathstuff.c:57:11: error: expected ';' before 'len' DWORD len = GetFullPathName (filename, MAX_PATH, buf, NULL); ^ /gdb/common/pathstuff.c:63:9: error: 'len' was not declared in this scope if (len > 0 && len < MAX_PATH) ^ /gdb/common/pathstuff.c:64:54: error: 'buf' was not declared in this scope return gdb::unique_xmalloc_ptr<char> (xstrdup (buf)); ^ make[2]: *** [pathstuff.o] Error 1 The proper fix is to conditionally include "<windows.h>". This commit does that, without introducing any regressions as per tests made by our BuildBot. gdb/ChangeLog: 2018-03-01 Sergio Durigan Junior <sergiodj@redhat.com> PR gdb/22907 * common/pathstuff.c: Conditionally include "<windows.h>". --- gdb/common/pathstuff.c | 4 ++++ 1 file changed, 4 insertions(+)
Comments
On 2018-03-01 15:20, Sergio Durigan Junior wrote: > commit b4987c956dfa44ca9fd8552f63e15f5fa094b2a4 > Author: Sergio Durigan Junior <sergiodj@redhat.com> > Date: Fri Feb 9 18:44:59 2018 -0500 > > Create new common/pathstuff.[ch] > > Introduced a regression when compiling for mingw*: > > /gdb/common/pathstuff.c: In function 'gdb::unique_xmalloc_ptr<char> > gdb_realpath(const char*)': > /gdb/common/pathstuff.c:56:14: error: 'MAX_PATH' was not declared in > this scope > char buf[MAX_PATH]; > ^ > /gdb/common/pathstuff.c:57:5: error: 'DWORD' was not declared in this > scope > DWORD len = GetFullPathName (filename, MAX_PATH, buf, NULL); > ^ > /gdb/common/pathstuff.c:57:11: error: expected ';' before 'len' > DWORD len = GetFullPathName (filename, MAX_PATH, buf, NULL); > ^ > /gdb/common/pathstuff.c:63:9: error: 'len' was not declared in this > scope > if (len > 0 && len < MAX_PATH) > ^ > /gdb/common/pathstuff.c:64:54: error: 'buf' was not declared in this > scope > return gdb::unique_xmalloc_ptr<char> (xstrdup (buf)); > ^ > make[2]: *** [pathstuff.o] Error 1 > > The proper fix is to conditionally include "<windows.h>". This commit > does that, without introducing any regressions as per tests made by > our BuildBot. > > gdb/ChangeLog: > 2018-03-01 Sergio Durigan Junior <sergiodj@redhat.com> > > PR gdb/22907 > * common/pathstuff.c: Conditionally include "<windows.h>". > --- > gdb/common/pathstuff.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/gdb/common/pathstuff.c b/gdb/common/pathstuff.c > index fc574dc32e..8c4093fc38 100644 > --- a/gdb/common/pathstuff.c > +++ b/gdb/common/pathstuff.c > @@ -23,6 +23,10 @@ > #include "filenames.h" > #include "gdb_tilde_expand.h" > > +#ifdef USE_WIN32API > +#include <windows.h> > +#endif > + > /* See common/pathstuff.h. */ > > gdb::unique_xmalloc_ptr<char> Christopher, does that fix the issue for you? If so, the patch LGTM. Simon
Sergio Durigan Junior <sergiodj@redhat.com> writes: > Introduced a regression when compiling for mingw*: > > /gdb/common/pathstuff.c: In function 'gdb::unique_xmalloc_ptr<char> > gdb_realpath(const char*)': > /gdb/common/pathstuff.c:56:14: error: 'MAX_PATH' was not declared in this scope > char buf[MAX_PATH]; Fedora-x86_64-w64-mingw32 catches this build failure https://gdb-build.sergiodj.net/builders/Fedora-x86_64-w64-mingw32/builds/1113/steps/compile%20gdb/logs/stdio but it doesn't send notification on build failure. Could you change the buildbot config to send notification on build failure? The same as other builders do.
On 1 March 2018 at 21:46, Simon Marchi <simon.marchi@polymtl.ca> wrote: > On 2018-03-01 15:20, Sergio Durigan Junior wrote: >> >> commit b4987c956dfa44ca9fd8552f63e15f5fa094b2a4 >> Author: Sergio Durigan Junior <sergiodj@redhat.com> >> Date: Fri Feb 9 18:44:59 2018 -0500 >> >> Create new common/pathstuff.[ch] >> >> Introduced a regression when compiling for mingw*: >> >> /gdb/common/pathstuff.c: In function 'gdb::unique_xmalloc_ptr<char> >> gdb_realpath(const char*)': >> /gdb/common/pathstuff.c:56:14: error: 'MAX_PATH' was not declared in >> this scope >> char buf[MAX_PATH]; >> ^ >> /gdb/common/pathstuff.c:57:5: error: 'DWORD' was not declared in this >> scope >> DWORD len = GetFullPathName (filename, MAX_PATH, buf, NULL); >> ^ >> /gdb/common/pathstuff.c:57:11: error: expected ';' before 'len' >> DWORD len = GetFullPathName (filename, MAX_PATH, buf, NULL); >> ^ >> /gdb/common/pathstuff.c:63:9: error: 'len' was not declared in this >> scope >> if (len > 0 && len < MAX_PATH) >> ^ >> /gdb/common/pathstuff.c:64:54: error: 'buf' was not declared in this >> scope >> return gdb::unique_xmalloc_ptr<char> (xstrdup (buf)); >> ^ >> make[2]: *** [pathstuff.o] Error 1 >> >> The proper fix is to conditionally include "<windows.h>". This commit >> does that, without introducing any regressions as per tests made by >> our BuildBot. >> >> gdb/ChangeLog: >> 2018-03-01 Sergio Durigan Junior <sergiodj@redhat.com> >> >> PR gdb/22907 >> * common/pathstuff.c: Conditionally include "<windows.h>". >> --- >> gdb/common/pathstuff.c | 4 ++++ >> 1 file changed, 4 insertions(+) >> >> diff --git a/gdb/common/pathstuff.c b/gdb/common/pathstuff.c >> index fc574dc32e..8c4093fc38 100644 >> --- a/gdb/common/pathstuff.c >> +++ b/gdb/common/pathstuff.c >> @@ -23,6 +23,10 @@ >> #include "filenames.h" >> #include "gdb_tilde_expand.h" >> >> +#ifdef USE_WIN32API >> +#include <windows.h> >> +#endif >> + >> /* See common/pathstuff.h. */ >> >> gdb::unique_xmalloc_ptr<char> > > > Christopher, does that fix the issue for you? If so, the patch LGTM. > Yes, I applied it to my gdb-8.1-branch , and the build now succeeds. Thanks > Simon
On Friday, March 02 2018, Yao Qi wrote: > Sergio Durigan Junior <sergiodj@redhat.com> writes: > >> Introduced a regression when compiling for mingw*: >> >> /gdb/common/pathstuff.c: In function 'gdb::unique_xmalloc_ptr<char> >> gdb_realpath(const char*)': >> /gdb/common/pathstuff.c:56:14: error: 'MAX_PATH' was not declared in this scope >> char buf[MAX_PATH]; > > Fedora-x86_64-w64-mingw32 catches this build failure > https://gdb-build.sergiodj.net/builders/Fedora-x86_64-w64-mingw32/builds/1113/steps/compile%20gdb/logs/stdio > but it doesn't send notification on build failure. Could you change the > buildbot config to send notification on build failure? The same as > other builders do. Yeah, it's on my TODO list. I've also noticed this after Christophe reported the failure. Thanks, Yao.
On Friday, March 02 2018, Christophe Lyon wrote: > On 1 March 2018 at 21:46, Simon Marchi <simon.marchi@polymtl.ca> wrote: >> Christopher, does that fix the issue for you? If so, the patch LGTM. >> > > Yes, I applied it to my gdb-8.1-branch , and the build now succeeds. > Thanks Thanks, Christophe and Simon. Pushed to master: ab818ade016bcd794980438775e15c7a74f054f9 And to the 8.1 branch: a74e30b243dec8b38c8c769da04635210f9ef986
On Friday, March 02 2018, I wrote: > On Friday, March 02 2018, Yao Qi wrote: > >> Sergio Durigan Junior <sergiodj@redhat.com> writes: >> >>> Introduced a regression when compiling for mingw*: >>> >>> /gdb/common/pathstuff.c: In function 'gdb::unique_xmalloc_ptr<char> >>> gdb_realpath(const char*)': >>> /gdb/common/pathstuff.c:56:14: error: 'MAX_PATH' was not declared in this scope >>> char buf[MAX_PATH]; >> >> Fedora-x86_64-w64-mingw32 catches this build failure >> https://gdb-build.sergiodj.net/builders/Fedora-x86_64-w64-mingw32/builds/1113/steps/compile%20gdb/logs/stdio >> but it doesn't send notification on build failure. Could you change the >> buildbot config to send notification on build failure? The same as >> other builders do. > > Yeah, it's on my TODO list. I've also noticed this after Christophe > reported the failure. Thanks, Yao. E-mail notifications enabled for this builder. Thanks,
> From: Sergio Durigan Junior <sergiodj@redhat.com> > Cc: Simon Marchi <simon.marchi@ericsson.com>, Pedro Alves <palves@redhat.com>, Joel Brobecker <brobecker@adacore.com>, Christophe Lyon <christophe.lyon@linaro.org>, Sergio Durigan Junior <sergiodj@redhat.com> > Date: Thu, 1 Mar 2018 15:20:05 -0500 > > +#ifdef USE_WIN32API > +#include <windows.h> > +#endif Isn't USE_WIN32API specific to gdbserver? If so, perhaps it's better to use __MINGW32__ or _WIN32 instead?
On 2018-03-02 08:32, Eli Zaretskii wrote: >> From: Sergio Durigan Junior <sergiodj@redhat.com> >> Cc: Simon Marchi <simon.marchi@ericsson.com>, Pedro Alves >> <palves@redhat.com>, Joel Brobecker >> <brobecker@adacore.com>, Christophe Lyon >> <christophe.lyon@linaro.org>, Sergio Durigan Junior >> <sergiodj@redhat.com> >> Date: Thu, 1 Mar 2018 15:20:05 -0500 >> >> +#ifdef USE_WIN32API >> +#include <windows.h> >> +#endif > > Isn't USE_WIN32API specific to gdbserver? If so, perhaps it's better > to use __MINGW32__ or _WIN32 instead? I see it defined in both gdb and gdbserver: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=blob;f=gdb/configure.ac;h=698fc7b83456f8c5a63ae0050dc8ec65069290f7;hb=HEAD#l1908 https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=blob;f=gdb/gdbserver/configure.ac;h=99801681ff47ee8dcd9ad2e5ae282dcd113c83e4;hb=HEAD#l281 Simon
On Friday, March 02 2018, Simon Marchi wrote: > On 2018-03-02 08:32, Eli Zaretskii wrote: >>> From: Sergio Durigan Junior <sergiodj@redhat.com> >>> Cc: Simon Marchi <simon.marchi@ericsson.com>, Pedro Alves >>> <palves@redhat.com>, Joel Brobecker <brobecker@adacore.com>, >>> Christophe Lyon <christophe.lyon@linaro.org>, Sergio Durigan >>> Junior <sergiodj@redhat.com> >>> Date: Thu, 1 Mar 2018 15:20:05 -0500 >>> >>> +#ifdef USE_WIN32API >>> +#include <windows.h> >>> +#endif >> >> Isn't USE_WIN32API specific to gdbserver? If so, perhaps it's better >> to use __MINGW32__ or _WIN32 instead? > > I see it defined in both gdb and gdbserver: > > https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=blob;f=gdb/configure.ac;h=698fc7b83456f8c5a63ae0050dc8ec65069290f7;hb=HEAD#l1908 > https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=blob;f=gdb/gdbserver/configure.ac;h=99801681ff47ee8dcd9ad2e5ae282dcd113c83e4;hb=HEAD#l281 It's also present on common/filestuff.c, which is shared. That's actually where I took the idea from.
> From: Sergio Durigan Junior <sergiodj@redhat.com> > Cc: Eli Zaretskii <eliz@gnu.org>, gdb-patches@sourceware.org, simon.marchi@ericsson.com, palves@redhat.com, brobecker@adacore.com, christophe.lyon@linaro.org > Date: Fri, 02 Mar 2018 13:20:38 -0500 > > >>> +#ifdef USE_WIN32API > >>> +#include <windows.h> > >>> +#endif > >> > >> Isn't USE_WIN32API specific to gdbserver? If so, perhaps it's better > >> to use __MINGW32__ or _WIN32 instead? > > > > I see it defined in both gdb and gdbserver: > > > > https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=blob;f=gdb/configure.ac;h=698fc7b83456f8c5a63ae0050dc8ec65069290f7;hb=HEAD#l1908 > > https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=blob;f=gdb/gdbserver/configure.ac;h=99801681ff47ee8dcd9ad2e5ae282dcd113c83e4;hb=HEAD#l281 > > It's also present on common/filestuff.c, which is shared. That's > actually where I took the idea from. Those could be mistakes due to moving stuff into common/. So I think we should decide what that symbol means and how to use it, and then see if the practice somehow deviates from those rules. I asked my question because AFAIR this symbol used to be only in gdbserver sources. If nowadays we can use it anywhere, then I'd suggest to replace it with something common with GDB, because the meaning of USE_WIN32API in the context of GDB is unclear to me.
Sergio Durigan Junior <sergiodj@redhat.com> writes:
> E-mail notifications enabled for this builder.
Thank you, Sergio.
diff --git a/gdb/common/pathstuff.c b/gdb/common/pathstuff.c index fc574dc32e..8c4093fc38 100644 --- a/gdb/common/pathstuff.c +++ b/gdb/common/pathstuff.c @@ -23,6 +23,10 @@ #include "filenames.h" #include "gdb_tilde_expand.h" +#ifdef USE_WIN32API +#include <windows.h> +#endif + /* See common/pathstuff.h. */ gdb::unique_xmalloc_ptr<char>