public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] gdbserver: fix format string warning in win32-low.cc
@ 2020-04-16  1:09 Simon Marchi
  0 siblings, 0 replies; only message in thread
From: Simon Marchi @ 2020-04-16  1:09 UTC (permalink / raw)
  To: gdb-cvs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="us-ascii", Size: 2975 bytes --]

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=e2275c6ee8caa98d6526422743a97d5dd5ac040d

commit e2275c6ee8caa98d6526422743a97d5dd5ac040d
Author: Simon Marchi <simon.marchi@polymtl.ca>
Date:   Wed Apr 15 21:09:17 2020 -0400

    gdbserver: fix format string warning in win32-low.cc
    
    When compiling on Cygwin, we get:
    
          CXX    win32-low.o
        /home/smarchi/src/binutils-gdb/gdbserver/win32-low.cc: In function ‘int get_child_debug_event(DWORD*, target_waitstatus*)’:
        /home/smarchi/src/binutils-gdb/gdbserver/win32-low.cc:1459:17: error: format ‘%x’ expects argument of type ‘unsigned int’, but argument 2 has type ‘long int’ [-Werror=format=]
         1459 |       OUTMSG2 (("get_windows_debug_event - "
              |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
         1460 |   "unexpected stop in 0x%x (expecting 0x%x)\n",
              |   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         1461 |   ptid.lwp (), desired_stop_thread_id));
              |   ~~~~~~~~~~~
              |            |
              |            long int
        /home/smarchi/src/binutils-gdb/gdbserver/win32-low.cc:52:11: note: in definition of macro ‘OUTMSG2’
           52 |    printf X;    \
              |           ^
        /home/smarchi/src/binutils-gdb/gdbserver/win32-low.cc:1460:26: note: format string is defined here
         1460 |   "unexpected stop in 0x%x (expecting 0x%x)\n",
              |                         ~^
              |                          |
              |                          unsigned int
              |                         %lx
    
    `ptid.lwp ()` is a `long` value, so it indeed needs the `l` size modifier.
    
    gdbserver/ChangeLog:
    
            * win32-low.cc (get_child_debug_event): Fix format string warning.

Diff:
---
 gdbserver/ChangeLog    | 4 ++++
 gdbserver/win32-low.cc | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/gdbserver/ChangeLog b/gdbserver/ChangeLog
index 2b381455ed7..2abe0f1268c 100644
--- a/gdbserver/ChangeLog
+++ b/gdbserver/ChangeLog
@@ -1,3 +1,7 @@
+2020-04-15  Simon Marchi  <simon.marchi@polymtl.ca>
+
+	* win32-low.cc (get_child_debug_event): Fix format string warning.
+
 2020-04-13  Tom Tromey  <tom@tromey.com>
 
 	* server.h (gdb_fildes_t): Remove typedef.
diff --git a/gdbserver/win32-low.cc b/gdbserver/win32-low.cc
index e1226b4b0db..75305a4cfab 100644
--- a/gdbserver/win32-low.cc
+++ b/gdbserver/win32-low.cc
@@ -1457,7 +1457,7 @@ get_child_debug_event (DWORD *continue_status,
       /* Pending stop.  See the comment by the definition of
 	 "pending_stops" for details on why this is needed.  */
       OUTMSG2 (("get_windows_debug_event - "
-		"unexpected stop in 0x%x (expecting 0x%x)\n",
+		"unexpected stop in 0x%lx (expecting 0x%x)\n",
 		ptid.lwp (), desired_stop_thread_id));
       maybe_adjust_pc ();
       pending_stops.push_back ({(DWORD) ptid.lwp (), *ourstatus, current_event});


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-04-16  1:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-16  1:09 [binutils-gdb] gdbserver: fix format string warning in win32-low.cc Simon Marchi

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).