Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jon Turney <jon.turney@dronecode.org.uk>
To: Tom Tromey <tromey@adacore.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH] Use strwinerror in gdb/windows-nat.c
Date: Fri, 4 Nov 2022 14:21:04 +0000	[thread overview]
Message-ID: <b9448dd9-330c-8603-97d7-6e425fe3f23d@dronecode.org.uk> (raw)
In-Reply-To: <877d38e1f7.fsf@tromey.com>

[-- Attachment #1: Type: text/plain, Size: 786 bytes --]

On 16/08/2022 14:57, Tom Tromey via Gdb-patches wrote:
>>>>>> "Tom" == Tom Tromey via Gdb-patches <gdb-patches@sourceware.org> writes:
> 
> Tom> When working on windows-nat.c, it's useful to see an error message in
> Tom> addition to the error number given by GetLastError.  This patch moves
> Tom> strwinerror from gdbserver to gdbsupport, and then updates
> Tom> windows-nat.c to use it.  A couple of minor changes to strwinerror
> Tom> (constify the return type and use the ARRAY_SIZE macro) are also
> Tom> included.
> 
> I'm checking this in now.

As is traditional by now, this breaks the Cygwin build.

I'd suggest the attached to fix this, but I don't think this qualifies 
as obvious, since it's not obvious what USE_WIN32API is supposed to 
mean, so a review would be useful.

[-- Attachment #2: 0001-Fix-Cygwin-build-after-02d04eac.patch --]
[-- Type: text/plain, Size: 1676 bytes --]

From 4e6b72a98f1f03c66801af4f368718784f809bb4 Mon Sep 17 00:00:00 2001
From: Jon Turney <jon.turney@dronecode.org.uk>
Date: Wed, 2 Nov 2022 13:16:16 +0000
Subject: [PATCH] Fix Cygwin build after 02d04eac

Commit 02d04eac "Use strwinerror in gdb/windows-nat.c" also moves
strwinerror() under the USE_WIN32API conditional, which is not defined
for Cygwin (and looks like it shouldn't be, as appears to imply
non-POSIX and MiNGW and WinSock...)

Also enable the declaration and definition of strwinerror() when
__CYGWIN__ is defined.
---
 gdbsupport/errors.cc | 4 ++--
 gdbsupport/errors.h  | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/gdbsupport/errors.cc b/gdbsupport/errors.cc
index 7464df3d067..93fc70ad296 100644
--- a/gdbsupport/errors.cc
+++ b/gdbsupport/errors.cc
@@ -19,7 +19,7 @@
 
 #include "common-defs.h"
 #include "errors.h"
-#ifdef USE_WIN32API
+#if defined (USE_WIN32API) || defined(__CYGWIN__)
 #include <windows.h>
 #endif /* USE_WIN32API */
 
@@ -71,7 +71,7 @@ internal_warning_loc (const char *file, int line, const char *fmt, ...)
   va_end (ap);
 }
 
-#ifdef USE_WIN32API
+#if defined (USE_WIN32API) || defined(__CYGWIN__)
 
 /* See errors.h.  */
 
diff --git a/gdbsupport/errors.h b/gdbsupport/errors.h
index 5a925789893..d67d692e4cb 100644
--- a/gdbsupport/errors.h
+++ b/gdbsupport/errors.h
@@ -99,7 +99,7 @@ extern void malloc_failure (long size) ATTRIBUTE_NORETURN;
 
 extern void flush_streams ();
 
-#ifdef USE_WIN32API
+#if defined(USE_WIN32API) || defined(__CYGWIN__)
 
 /* Map the Windows error number in ERROR to a locale-dependent error
    message string and return a pointer to it.  Typically, the values
-- 
2.38.1


  reply	other threads:[~2022-11-04 14:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-28 17:05 Tom Tromey via Gdb-patches
2022-08-16 13:57 ` Tom Tromey via Gdb-patches
2022-11-04 14:21   ` Jon Turney [this message]
2022-11-08 18:24     ` Tom Tromey via Gdb-patches
2022-11-13 15:14       ` Jon Turney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b9448dd9-330c-8603-97d7-6e425fe3f23d@dronecode.org.uk \
    --to=jon.turney@dronecode.org.uk \
    --cc=gdb-patches@sourceware.org \
    --cc=tromey@adacore.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox