From patchwork Sun Apr 28 14:33:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eli Zaretskii X-Patchwork-Id: 32439 Received: (qmail 47624 invoked by alias); 28 Apr 2019 14:33:41 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 47616 invoked by uid 89); 28 Apr 2019 14:33:41 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-8.1 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, SPF_PASS autolearn=ham version=3.3.1 spammy=HTo:U*palves, stdio.h, UD:stdio.h, UD:stdlib.h X-HELO: eggs.gnu.org Received: from eggs.gnu.org (HELO eggs.gnu.org) (209.51.188.92) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 28 Apr 2019 14:33:40 +0000 Received: from fencepost.gnu.org ([2001:470:142:3::e]:36331) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hKks6-0001hh-Bo; Sun, 28 Apr 2019 10:33:38 -0400 Received: from [176.228.60.248] (port=1463 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1hKks4-0003AK-KH; Sun, 28 Apr 2019 10:33:37 -0400 Date: Sun, 28 Apr 2019 17:33:25 +0300 Message-Id: <831s1murm2.fsf@gnu.org> From: Eli Zaretskii To: Pedro Alves CC: gdb-patches@sourceware.org In-reply-to: <93ccb0fa-8a05-60ff-d1a8-85d5663b8d16@redhat.com> (message from Pedro Alves on Fri, 19 Apr 2019 12:33:37 +0100) Subject: Re: Fix compilation using mingw.org's MinGW References: <835zrbe36c.fsf@gnu.org> <250801eb-14f6-5a35-0556-cf5797dd8a7b@redhat.com> <83y347cfbu.fsf@gnu.org> <556cefd7-47ce-54ab-a228-2c727aab4179@redhat.com> <83d0lick7o.fsf@gnu.org> <93ccb0fa-8a05-60ff-d1a8-85d5663b8d16@redhat.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-IsSubscribed: yes > Cc: gdb-patches@sourceware.org > From: Pedro Alves > Date: Fri, 19 Apr 2019 12:33:37 +0100 > > > I will try doing this in common-defs.h, but for the branch, we could > > set _WIN32_WINNT only in windows-nat.c, as that's the only file that > > currently cares, which should be safer. WDYT? > > Sounds good to me. Below please find 2 patches: the first one for the 8.3 branch, the second one for master. OK to commit (after writing ChangeLog entries)? --- gdb/windows-nat.c~0 2019-03-27 00:52:05.000000000 +0200 +++ gdb/windows-nat.c 2019-04-28 11:00:38.415049400 +0300 @@ -34,6 +34,15 @@ #include #include #include +/* We need at least the level of XP for CONSOLE_FONT_INFO. */ +#ifdef _WIN32_WINNT +# if _WIN32_WINNT < 0x0501 +# undef _WIN32_WINNT +# define _WIN32_WINNT 0x0501 +# endif +#else +# define _WIN32_WINNT 0x0501 +#endif #include #include #include --- gdb/common/common-defs.h~0 2019-03-27 00:52:05.000000000 +0200 +++ gdb/common/common-defs.h 2019-04-28 11:26:11.785455800 +0300 @@ -72,6 +72,20 @@ #define _FORTIFY_SOURCE 2 #endif +/* We don't support Windows versions before XP, so we define + _WIN32_WINNT correspondingly to ensure the Windows API headers + expose the required symbols. */ +#ifdef __MINGW32__ +# ifdef _WIN32_WINNT +# if _WIN32_WINNT < 0x0501 +# undef _WIN32_WINNT +# define _WIN32_WINNT 0x0501 +# endif +# else +# define _WIN32_WINNT 0x0501 +# endif +#endif /* __MINGW32__ */ + #include #include #include