git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] khash: silence -Wunused-function

From
Duy Nguyen <pclouds@gmail.com>
Date
Oct 23, 2018, 15:44 UTC
Message-ID
<CACsJy8AXjhbY9WWjYtMk128TZHLBCf4Ye4fe-ryXhoP9j2jtdw@mail.gmail.com>
In-Reply-To
<20181023113416.90958-1-carenas@gmail.com>

On Tue, Oct 23, 2018 at 1:42 PM Carlo Marcelo Arenas Belón <carenas@gmail.com> wrote:

Show 20 quoted lines
>
> after 36da893114 ("config.mak.dev: enable -Wunused-function", 2018-10-18)
> macro generated code should use a similar solution than commit-slab to
> silence the compiler.
>
> Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
> ---
>  khash.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/khash.h b/khash.h
> index d10caa0c35..39c2833877 100644
> --- a/khash.h
> +++ b/khash.h
> @@ -234,7 +234,7 @@ static const double __ac_HASH_UPPER = 0.77;
>         __KHASH_IMPL(name, SCOPE, khkey_t, khval_t, kh_is_map, __hash_func, __hash_equal)
>
>  #define KHASH_INIT(name, khkey_t, khval_t, kh_is_map, __hash_func, __hash_equal) \
> -       KHASH_INIT2(name, static inline, khkey_t, khval_t, kh_is_map, __hash_func, __hash_equal)
> +       KHASH_INIT2(name, __attribute__((__unused__)) static inline, khkey_t, khval_t, kh_is_map, __hash_func, __hash_equal)

Maybe move MAYBE_UNUSED from commit-slab-impl.h to git-compat-util.h and use it here so we have an easier time if we have to use a different way to mark unused functions on some exotic platform.

Show 6 quoted lines
>
>  /* Other convenient macros... */
>
> --
> 2.19.1
>
-- 
Duy
Previous: Carlo Marcelo Arenas BelónNext: Carlo Marcelo Arenas Belón
Message 2 of 9 in “khash: silence -Wunused-function”
  1. khash: silence -Wunused-functionCarlo Marcelo Arenas Belón, Oct 23, 2018
  2. Duy NguyenOct 23, 2018
  3. 0/2 delta-islands: avoid unused function messagesCarlo Marcelo Arenas Belón, Oct 23, 2018
  4. 1/2 commit-slabs: move MAYBE_UNUSED outCarlo Marcelo Arenas Belón, Oct 23, 2018
  5. Jeff KingOct 23, 2018
  6. Carlo ArenasOct 23, 2018
  7. 2/2 khash: silence -Wunused-function for delta-islandsCarlo Marcelo Arenas Belón, Oct 23, 2018
  8. René ScharfeOct 23, 2018
  9. Carlo ArenasOct 23, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.