public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Jon Turney <jon.turney@dronecode.org.uk>
To: gdb-patches@sourceware.org
Cc: Jon Turney <jon.turney@dronecode.org.uk>
Subject: [PATCH 2/2] Simplify __USEWIDE
Date: Thu,  2 Jun 2022 15:12:58 +0100	[thread overview]
Message-ID: <20220602141258.18968-3-jon.turney@dronecode.org.uk> (raw)
In-Reply-To: <20220602141258.18968-1-jon.turney@dronecode.org.uk>

Prior to c6ca3dab dropping support for Cygwin 1.5, __USEWIDE not defined
for Cygwin 1.5.  After that, it's always defined if __CYGWIN__ is, so
remove __USEWIDE conditionals inside __CYGWIN__ conditionals.
---
 gdb/windows-nat.c | 26 --------------------------
 1 file changed, 26 deletions(-)

diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index ab438750186..78db4e99d40 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -89,7 +89,6 @@ static windows_process_info windows_process;
 /* The starting and ending address of the cygwin1.dll text segment.  */
   static CORE_ADDR cygwin_load_start;
   static CORE_ADDR cygwin_load_end;
-#   define __USEWIDE
 #   define STARTUPINFO STARTUPINFOW
 #   define CreateProcess CreateProcessW
 #endif
@@ -688,17 +687,10 @@ windows_make_so (const char *name, LPVOID load_addr)
   if (access (name, F_OK) != 0)
     {
       if (strcasecmp (name, "ntdll.dll") == 0)
-#ifdef __USEWIDE
 	{
 	  GetSystemDirectoryW (buf, sizeof (buf) / sizeof (wchar_t));
 	  wcscat (buf, L"\\ntdll.dll");
 	}
-#else
-	{
-	  GetSystemDirectoryA (buf, sizeof (buf) / sizeof (wchar_t));
-	  strcat (buf, "\\ntdll.dll");
-	}
-#endif
     }
 #endif
   solibs.emplace_back ();
@@ -2405,32 +2397,21 @@ windows_nat_target::create_inferior (const char *exec_file,
 			    __PMAX * sizeof (wchar_t)) < 0)
 	error (_("Error starting executable: %d"), errno);
       toexec = real_path;
-#ifdef __USEWIDE
       len = mbstowcs (NULL, allargs, 0) + 1;
       if (len == (size_t) -1)
 	error (_("Error starting executable: %d"), errno);
       cygallargs = (wchar_t *) alloca (len * sizeof (wchar_t));
       mbstowcs (cygallargs, allargs, len);
-#else  /* !__USEWIDE */
-      cygallargs = allargs;
-#endif
     }
   else
     {
       sh = get_shell ();
       if (cygwin_conv_path (CCP_POSIX_TO_WIN_W, sh, shell, __PMAX) < 0)
 	error (_("Error starting executable via shell: %d"), errno);
-#ifdef __USEWIDE
       len = sizeof (L" -c 'exec  '") + mbstowcs (NULL, exec_file, 0)
 	    + mbstowcs (NULL, allargs, 0) + 2;
       cygallargs = (wchar_t *) alloca (len * sizeof (wchar_t));
       swprintf (cygallargs, len, L" -c 'exec %s %s'", exec_file, allargs);
-#else  /* !__USEWIDE */
-      len = (sizeof (" -c 'exec  '") + strlen (exec_file)
-	     + strlen (allargs) + 2);
-      cygallargs = (char *) alloca (len);
-      xsnprintf (cygallargs, len, " -c 'exec %s %s'", exec_file, allargs);
-#endif	/* __USEWIDE */
       toexec = shell;
       flags |= DEBUG_PROCESS;
     }
@@ -2440,18 +2421,11 @@ windows_nat_target::create_inferior (const char *exec_file,
 			   infcwd, strlen (inferior_cwd)) < 0)
     error (_("Error converting inferior cwd: %d"), errno);
 
-#ifdef __USEWIDE
   args = (wchar_t *) alloca ((wcslen (toexec) + wcslen (cygallargs) + 2)
 				  * sizeof (wchar_t));
   wcscpy (args, toexec);
   wcscat (args, L" ");
   wcscat (args, cygallargs);
-#else  /* !__USEWIDE */
-  args = (char *) alloca (strlen (toexec) + strlen (cygallargs) + 2);
-  strcpy (args, toexec);
-  strcat (args, " ");
-  strcat (args, cygallargs);
-#endif	/* !__USEWIDE */
 
 #ifdef CW_CVT_ENV_TO_WINENV
   /* First try to create a direct Win32 copy of the POSIX environment. */
-- 
2.36.1


  parent reply	other threads:[~2022-06-02 14:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-02 14:12 [PATCH 0/2] Clean up some Cygwin 1.5 !__USEWIDE cruft Jon Turney
2022-06-02 14:12 ` [PATCH 1/2] Simplify cygwin_buf_t Jon Turney
2022-06-02 14:12 ` Jon Turney [this message]
2022-06-02 14:43 ` [PATCH 0/2] Clean up some Cygwin 1.5 !__USEWIDE cruft Tom Tromey

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=20220602141258.18968-3-jon.turney@dronecode.org.uk \
    --to=jon.turney@dronecode.org.uk \
    --cc=gdb-patches@sourceware.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).