unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Tomi Ollila <tomi.ollila@iki.fi>
To: notmuch@notmuchmail.org
Cc: tomi.ollila@iki.fi
Subject: [PATCH] append _unused to the expression defined using unused() macro
Date: Thu, 30 May 2019 22:56:14 +0300	[thread overview]
Message-ID: <20190530195614.7745-1-tomi.ollila@iki.fi> (raw)

This way if variables defined using unused() macro are actually
used then code will not compile...

- removed unused usage around one argc and one argv since those
  were used

- changed one unused (char *argv[]) to unused (char **argv) to
  work with modified unused() macro definition
---

Noticed this when looking some dkg's changes (not in his code, 
but in diff context).

I cannot think of a case where this would not work.

(and note to self: fix similar unused() definition on some
 of my own projects, forgot '##' there (a_unused does not
 expand macro variable a ;))

 notmuch-client.h | 2 +-
 notmuch-setup.c  | 2 +-
 notmuch.c        | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/notmuch-client.h b/notmuch-client.h
index 39e26f2e..b3a501a9 100644
--- a/notmuch-client.h
+++ b/notmuch-client.h
@@ -53,7 +53,7 @@
 #include "talloc-extra.h"
 #include "crypto.h"
 
-#define unused(x) x __attribute__ ((unused))
+#define unused(x) x ## _unused __attribute__ ((unused))
 
 #define STRINGIFY(s) STRINGIFY_(s)
 #define STRINGIFY_(s) #s
diff --git a/notmuch-setup.c b/notmuch-setup.c
index 53048005..81419ccf 100644
--- a/notmuch-setup.c
+++ b/notmuch-setup.c
@@ -121,7 +121,7 @@ parse_tag_list (void *ctx, char *response)
 
 int
 notmuch_setup_command (notmuch_config_t *config,
-		       unused (int argc), unused (char *argv[]))
+		       int argc, char *argv[])
 {
     char *response = NULL;
     size_t response_size = 0;
diff --git a/notmuch.c b/notmuch.c
index eeb794e8..2ddc8fbc 100644
--- a/notmuch.c
+++ b/notmuch.c
@@ -358,7 +358,7 @@ notmuch_help_command (unused (notmuch_config_t * config), int argc, char *argv[]
  */
 static int
 notmuch_command (notmuch_config_t *config,
-		 unused(int argc), unused(char *argv[]))
+		 unused(int argc), unused(char **argv))
 {
     char *db_path;
     struct stat st;
-- 
2.21.0

             reply	other threads:[~2019-05-30 19:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-30 19:56 Tomi Ollila [this message]
2019-06-09 20:18 ` [PATCH] append _unused to the expression defined using unused() macro Daniel Kahn Gillmor
2019-06-11 10:34 ` David Bremner

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

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190530195614.7745-1-tomi.ollila@iki.fi \
    --to=tomi.ollila@iki.fi \
    --cc=notmuch@notmuchmail.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.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

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