gcc (at least as of version 4.6.0) is kind enough to point these out to us,
(when given -Wunused-but-set-variable explicitly or implicitly via -Wunused
or -Wall).
One of these cases was a legitimately unused variable. Two were simply
variables (named ignored) we were assigning only to squelch a warning about
unused function return values. I don't seem to be getting those warnings
even without setting the ignored variable. And the gcc docs. say that the
correct way to squelch that warning is with a cast to (void) anyway.
{
notmuch_message_t *message;
Xapian::Document doc;
- Xapian::WritableDatabase *db;
unsigned int doc_id;
char *term;
if (notmuch->mode == NOTMUCH_DATABASE_MODE_READ_ONLY)
INTERNAL_ERROR ("Failure to ensure database is writable.");
- db = static_cast<Xapian::WritableDatabase *> (notmuch->xapian_db);
try {
doc.add_term (term, 0);
talloc_free (term);
static void
handle_sigint (unused (int sig))
{
- ssize_t ignored;
static char msg[] = "Stopping... \n";
- ignored = write(2, msg, sizeof(msg)-1);
+ write(2, msg, sizeof(msg)-1);
interrupted = 1;
}
static void
handle_sigint (unused (int sig))
{
- ssize_t ignored;
-
static char msg[] = "Stopping... \n";
- ignored = write(2, msg, sizeof(msg)-1);
+ write(2, msg, sizeof(msg)-1);
interrupted = 1;
}