aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPedro Alves <pedro@palves.net>2024-02-20 16:31:39 +0000
committerPedro Alves <pedro@palves.net>2024-02-23 17:24:17 +0000
commit593318f69b481f32f2a06093d2b9660b4fb77f24 (patch)
tree8a081055b1e379a7625271231aca0887bd6967df
parentbd659b80301bc394f6b42d88e5fc10f944552f23 (diff)
downloadgdb-593318f69b481f32f2a06093d2b9660b4fb77f24.zip
gdb-593318f69b481f32f2a06093d2b9660b4fb77f24.tar.gz
gdb-593318f69b481f32f2a06093d2b9660b4fb77f24.tar.bz2
Fix throw_winerror_with_name build error on x86-64 Cygwin
The GDB build currently fails on x86-64 Cygwin, with: src/gdbsupport/errors.cc: In function ‘void throw_winerror_with_name(const char*, ULONGEST)’: src/gdbsupport/errors.cc:152:12: error: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘ULONGEST’ {aka ‘long unsigned int’} [-Werror=format=] 152 | error (_("%s (error %d): %s"), string, err, strwinerror (err)); | ^ 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: sprintf (buf, "unknown win32 error (%u)", (unsigned) error); 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. Approved-By: Tom Tromey <tom@tromey.com> Change-Id: I3f5faa779765fd8021abf58bb5f68d556b309d17
-rw-r--r--gdbsupport/errors.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/gdbsupport/errors.cc b/gdbsupport/errors.cc
index 8ac3ed0..cccdc5c 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));
}
#endif /* USE_WIN32API */