From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1551) id 7C9503858CD1; Fri, 23 Feb 2024 17:25:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7C9503858CD1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1708709152; bh=nUY1WRrR31ybMukK4N06AndFhwiPo0VggoWT1rfjP5w=; h=From:To:Subject:Date:From; b=yhBQyMwHZyhxCqEqM9MN+fgyHQNX3vH0Y574C3G/yEHY8vH2dE2tUC6BY5tyB6OaD E6D9vy5ZVG5j7T8ydyGdFwzC8c4eSFw4Ck7oGkCJCglvpD9/Fr+HT1DCYhRGQZPOsg eHv3k/YMkxo0Fe6sB3AqABvhI+MOQV/fwWlQe4kE= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Pedro Alves To: gdb-cvs@sourceware.org Subject: [binutils-gdb] Fix throw_winerror_with_name build error on x86-64 Cygwin X-Act-Checkin: binutils-gdb X-Git-Author: Pedro Alves X-Git-Refname: refs/heads/master X-Git-Oldrev: bd659b80301bc394f6b42d88e5fc10f944552f23 X-Git-Newrev: 593318f69b481f32f2a06093d2b9660b4fb77f24 Message-Id: <20240223172552.7C9503858CD1@sourceware.org> Date: Fri, 23 Feb 2024 17:25:51 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D593318f69b48= 1f32f2a06093d2b9660b4fb77f24 commit 593318f69b481f32f2a06093d2b9660b4fb77f24 Author: Pedro Alves Date: Tue Feb 20 16:31:39 2024 +0000 Fix throw_winerror_with_name build error on x86-64 Cygwin =20 The GDB build currently fails on x86-64 Cygwin, with: =20 src/gdbsupport/errors.cc: In function =E2=80=98void throw_winerror_wit= h_name(const char*, ULONGEST)=E2=80=99: src/gdbsupport/errors.cc:152:12: error: format =E2=80=98%d=E2=80=99 ex= pects argument of type =E2=80=98int=E2=80=99, but argument 3 has type =E2= =80=98ULONGEST=E2=80=99 {aka =E2=80=98long unsigned int=E2=80=99} [-Werror= =3Dformat=3D] 152 | error (_("%s (error %d): %s"), string, err, strwinerror (err= )); | ^ =20 Fix this by adding a cast. While at it, the error codes are really a DWORD that results from a GetLastError() call, so I think unsigned is more appropriate. That is also what strwinerror already does: =20 sprintf (buf, "unknown win32 error (%u)", (unsigned) error); =20 The cast is necessary on MinGW GDB as well, where ULONGEST is unsigned long long, but for some reason, I don't get a warning there. =20 Approved-By: Tom Tromey Change-Id: I3f5faa779765fd8021abf58bb5f68d556b309d17 Diff: --- gdbsupport/errors.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gdbsupport/errors.cc b/gdbsupport/errors.cc index 8ac3ed0da79..cccdc5cafb2 100644 --- a/gdbsupport/errors.cc +++ b/gdbsupport/errors.cc @@ -149,7 +149,7 @@ strwinerror (ULONGEST error) void throw_winerror_with_name (const char *string, ULONGEST err) { - error (_("%s (error %d): %s"), string, err, strwinerror (err)); + error (_("%s (error %u): %s"), string, (unsigned) err, strwinerror (err)= ); } =20 #endif /* USE_WIN32API */