Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Joel Brobecker <brobecker@adacore.com>
To: gdb-patches@sourceware.org
Subject: [commit] Fix -Wunused warning in dec-thread.c.
Date: Tue, 12 Jan 2010 07:56:00 -0000	[thread overview]
Message-ID: <1263282971-16934-1-git-send-email-brobecker@adacore.com> (raw)

From: brobecke <brobecke@f8352e7e-cb20-0410-8ce7-b5d9e71c585c>

Hello,

The compiler complains that the result of a couple of *PTR++ is never
used.  This is because the compiler is tricked by the way the pointer
was defined.  For instance:

  | dec_thread_count_gdb_threads (struct thread_info *ignored, void *context)
  | {
  |   int *count = (int *) context;

The compiler complains that the result is never used for the following
line:

  |   *count++;

The result is stored for the caller to use, so it is in fact potentially
used, but elsewhere...

gdb/ChangeLog:

        * dec-thread.c (dec_thread_count_gdb_threads)
        (dec_thread_add_gdb_thread): Prevent -Wunused warning.

Checked in.

---
 gdb/dec-thread.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/gdb/dec-thread.c b/gdb/dec-thread.c
index 5083221..be6db4c 100644
--- a/gdb/dec-thread.c
+++ b/gdb/dec-thread.c
@@ -352,7 +352,7 @@ dec_thread_count_gdb_threads (struct thread_info *ignored, void *context)
 {
   int *count = (int *) context;
 
-  *count++;
+  (void) *count++; /* The cast to void is to prevent a -Wunused warning.  */
   return 0;
 }
 
@@ -366,7 +366,7 @@ dec_thread_add_gdb_thread (struct thread_info *info, void *context)
   struct thread_info ***listp = (struct thread_info ***) context;
   
   **listp = info;
-  *listp++;
+  (void) *listp++; /* The cast to void is to prevent a -Wunused warning.  */
   return 0;
 }
 
-- 
1.6.3.3


             reply	other threads:[~2010-01-12  7:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-12  7:56 Joel Brobecker [this message]
2010-01-12 12:23 ` Pedro Alves

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=1263282971-16934-1-git-send-email-brobecker@adacore.com \
    --to=brobecker@adacore.com \
    --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