[PATCH 3/3] cli: fix clang build warnings

Jani Nikula jani at nikula.org
Mon Feb 23 08:56:16 PST 2015


Fix the following warning produced by clang 3.5.0:

notmuch-search.c:730:25: warning: initializing 'void *' with an
expression of type 'const notmuch_opt_desc_t (*)[4]' discards
qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
        { NOTMUCH_OPT_INHERIT, &common_options, NULL, 0, 0 },
                               ^~~~~~~~~~~~~~~
1 warning generated.

---

I'm not really happy with this one. An alternative would be to drop
const from common_options, but I'm not happy with that either. And I'm
not happy with the warning. :(
---
 notmuch-search.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/notmuch-search.c b/notmuch-search.c
index 14b9f01c5ad1..a591d45b4c39 100644
--- a/notmuch-search.c
+++ b/notmuch-search.c
@@ -671,7 +671,7 @@ notmuch_search_command (notmuch_config_t *config, int argc, char *argv[])
 	{ NOTMUCH_OPT_INT, &ctx->offset, "offset", 'O', 0 },
 	{ NOTMUCH_OPT_INT, &ctx->limit, "limit", 'L', 0  },
 	{ NOTMUCH_OPT_INT, &ctx->dupe, "duplicate", 'D', 0  },
-	{ NOTMUCH_OPT_INHERIT, &common_options, NULL, 0, 0 },
+	{ NOTMUCH_OPT_INHERIT, (void *) &common_options, NULL, 0, 0 },
 	{ 0, 0, 0, 0, 0 }
     };
 
@@ -727,7 +727,7 @@ notmuch_address_command (notmuch_config_t *config, int argc, char *argv[])
 	  (notmuch_keyword_t []){ { "true", NOTMUCH_EXCLUDE_TRUE },
 				  { "false", NOTMUCH_EXCLUDE_FALSE },
 				  { 0, 0 } } },
-	{ NOTMUCH_OPT_INHERIT, &common_options, NULL, 0, 0 },
+	{ NOTMUCH_OPT_INHERIT, (void *) &common_options, NULL, 0, 0 },
 	{ 0, 0, 0, 0, 0 }
     };
 
-- 
2.1.4



More information about the notmuch mailing list