From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2201) id 830233858C2C; Sun, 12 Jun 2022 16:08:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 830233858C2C Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Jon TURNEY To: gdb-cvs@sourceware.org Subject: [binutils-gdb] Simplify __USEWIDE X-Act-Checkin: binutils-gdb X-Git-Author: Jon Turney X-Git-Refname: refs/heads/master X-Git-Oldrev: 7d941aa3aafca1c01547f88dae83522c8b9fc97f X-Git-Newrev: 09d5a3fffce3709b5b66e57cdac5ea2cfc9859ee Message-Id: <20220612160801.830233858C2C@sourceware.org> Date: Sun, 12 Jun 2022 16:08:01 +0000 (GMT) X-BeenThere: gdb-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Jun 2022 16:08:01 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D09d5a3fffce3= 709b5b66e57cdac5ea2cfc9859ee commit 09d5a3fffce3709b5b66e57cdac5ea2cfc9859ee Author: Jon Turney Date: Thu Jun 2 15:03:24 2022 +0100 Simplify __USEWIDE =20 Prior to c6ca3dab dropping support for Cygwin 1.5, __USEWIDE was not defined for Cygwin 1.5. After that, it's always defined if __CYGWIN__ is, so remove __USEWIDE conditionals inside __CYGWIN__ conditionals. Diff: --- gdb/windows-nat.c | 26 -------------------------- 1 file changed, 26 deletions(-) diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c index 611193cd94a..e156a867c05 100644 --- a/gdb/windows-nat.c +++ b/gdb/windows-nat.c @@ -156,7 +156,6 @@ static windows_per_inferior windows_process; # define STARTUPINFO STARTUPINFOA #else # define __PMAX PATH_MAX -# define __USEWIDE # define STARTUPINFO STARTUPINFOW #endif =20 @@ -694,17 +693,10 @@ windows_make_so (const char *name, LPVOID load_addr) if (access (name, F_OK) !=3D 0) { if (strcasecmp (name, "ntdll.dll") =3D=3D 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 windows_process.solibs.emplace_back (); @@ -2416,32 +2408,21 @@ windows_nat_target::create_inferior (const char *ex= ec_file, __PMAX * sizeof (wchar_t)) < 0) error (_("Error starting executable: %d"), errno); toexec =3D real_path; -#ifdef __USEWIDE len =3D mbstowcs (NULL, allargs, 0) + 1; if (len =3D=3D (size_t) -1) error (_("Error starting executable: %d"), errno); cygallargs =3D (wchar_t *) alloca (len * sizeof (wchar_t)); mbstowcs (cygallargs, allargs, len); -#else /* !__USEWIDE */ - cygallargs =3D allargs; -#endif } else { sh =3D 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 =3D sizeof (L" -c 'exec '") + mbstowcs (NULL, exec_file, 0) + mbstowcs (NULL, allargs, 0) + 2; cygallargs =3D (wchar_t *) alloca (len * sizeof (wchar_t)); swprintf (cygallargs, len, L" -c 'exec %s %s'", exec_file, allargs); -#else /* !__USEWIDE */ - len =3D (sizeof (" -c 'exec '") + strlen (exec_file) - + strlen (allargs) + 2); - cygallargs =3D (char *) alloca (len); - xsnprintf (cygallargs, len, " -c 'exec %s %s'", exec_file, allargs); -#endif /* __USEWIDE */ toexec =3D shell; flags |=3D DEBUG_PROCESS; } @@ -2451,18 +2432,11 @@ windows_nat_target::create_inferior (const char *ex= ec_file, infcwd, strlen (inferior_cwd)) < 0) error (_("Error converting inferior cwd: %d"), errno); =20 -#ifdef __USEWIDE args =3D (wchar_t *) alloca ((wcslen (toexec) + wcslen (cygallargs) + 2) * sizeof (wchar_t)); wcscpy (args, toexec); wcscat (args, L" "); wcscat (args, cygallargs); -#else /* !__USEWIDE */ - args =3D (char *) alloca (strlen (toexec) + strlen (cygallargs) + 2); - strcpy (args, toexec); - strcat (args, " "); - strcat (args, cygallargs); -#endif /* !__USEWIDE */ =20 #ifdef CW_CVT_ENV_TO_WINENV /* First try to create a direct Win32 copy of the POSIX environment. */