All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: Tim Deegan <tim@xen.org>, Ian Campbell <Ian.Campbell@citrix.com>,
	Xen-devel <xen-devel@lists.xen.org>
Subject: Re: [PATCH 2/8] xen/misc: Remove or annotate possibly-unused functions
Date: Wed, 10 Feb 2016 13:15:40 +0000	[thread overview]
Message-ID: <56BB37FC.2020403@citrix.com> (raw)
In-Reply-To: <56BB43FB02000078000D08DB@prv-mh.provo.novell.com>

On 10/02/16 13:06, Jan Beulich wrote:
>>>> On 09.02.16 at 21:01, <andrew.cooper3@citrix.com> wrote:
>> --- a/xen/common/rcupdate.c
>> +++ b/xen/common/rcupdate.c
>> @@ -141,12 +141,6 @@ static inline int rcu_batch_before(long a, long b)
>>      return (a - b) < 0;
>>  }
>>  
>> -/* Is batch a after batch b ? */
>> -static inline int rcu_batch_after(long a, long b)
>> -{
>> -    return (a - b) > 0;
>> -}
> To me it is the nature of inline functions that they may or may not be
> used, regardless of whether they live in a header file (where I would
> have supposed Clang won't warn about, but the change below makes
> me assume I'm wrong) or in a source file.
>
>> --- a/xen/include/xen/compat.h
>> +++ b/xen/include/xen/compat.h
>> @@ -134,14 +134,16 @@
>>  #define CHECK_NAME_(k, n, tag) __check ## tag ## k ## _ ## n
>>  
>>  #define CHECK_TYPE(name) \
>> -static inline int CHECK_NAME(name, T)(xen_ ## name ## _t *x, \
>> -                                      compat_ ## name ## _t *c) \
>> +static inline int __maybe_unused \
>> +CHECK_NAME(name, T)(xen_ ## name ## _t *x, \
>> +                    compat_ ## name ## _t *c) \
>>  { \
>>      return x == c; \
>>  }
>>  #define CHECK_TYPE_(k, n) \
>> -static inline int CHECK_NAME_(k, n, T)(k xen_ ## n *x, \
>> -                                       k compat_ ## n *c) \
>> +static inline int __maybe_unused \
>> +CHECK_NAME_(k, n, T)(k xen_ ## n *x, \
>> +                     k compat_ ## n *c) \
>>  { \
>>      return x == c; \
>>  }
>> @@ -154,14 +156,14 @@ static inline int CHECK_NAME_(k, n, T)(k xen_ ## n *x, \
>>                                            sizeof(k compat_ ## n)) * 2]
>>  
>>  #define CHECK_FIELD_COMMON(name, t, f) \
>> -static inline int name(xen_ ## t ## _t *x, compat_ ## t ## _t *c) \
>> +static inline int __maybe_unused name(xen_ ## t ## _t *x, compat_ ## t ## _t *c) \
>>  { \
>>      BUILD_BUG_ON(offsetof(xen_ ## t ## _t, f) != \
>>                   offsetof(compat_ ## t ## _t, f)); \
>>      return &x->f == &c->f; \
>>  }
>>  #define CHECK_FIELD_COMMON_(k, name, n, f) \
>> -static inline int name(k xen_ ## n *x, k compat_ ## n *c) \
>> +static inline int __maybe_unused name(k xen_ ## n *x, k compat_ ## n *c) \
>>  { \
>>      BUILD_BUG_ON(offsetof(k xen_ ## n, f) != \
>>                   offsetof(k compat_ ## n, f)); \
> So if these are all noticed to be unused, why would others in other
> header files not be?

Because they are instantiated in translation units, with no callers, by
code like common/trace.c:

#ifdef CONFIG_COMPAT
#include <compat/trace.h>
#define xen_t_buf t_buf
CHECK_t_buf;
#undef xen_t_buf
#else
#define compat_t_rec t_rec
#endif

This was the first example which blew up.

~Andrew

  reply	other threads:[~2016-02-10 13:15 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-09 20:01 [PATCH 0/8] xen/x86: Fix build with Clang 3.5 Andrew Cooper
2016-02-09 20:01 ` [PATCH 1/8] xen/lib: Fix ASSERT() to build with clang Andrew Cooper
2016-02-09 20:01 ` [PATCH 2/8] xen/misc: Remove or annotate possibly-unused functions Andrew Cooper
2016-02-10 10:42   ` Tim Deegan
2016-02-10 13:06   ` Jan Beulich
2016-02-10 13:15     ` Andrew Cooper [this message]
2016-02-09 20:01 ` [PATCH 3/8] xen/x86: Remove %z modifier from inline assembly Andrew Cooper
2016-02-10 13:10   ` Jan Beulich
2016-02-09 20:01 ` [PATCH 4/8] xen/x86: Fix section type mismatch in mm.c Andrew Cooper
2016-02-10 10:01   ` George Dunlap
2016-02-09 20:01 ` [PATCH 5/8] xen/x86: Improve annotation of autogen_entrypoints[] Andrew Cooper
2016-02-09 20:01 ` [PATCH 6/8] xen/x86: Avoid overriding initialisers in arrays Andrew Cooper
2016-02-10 10:11   ` George Dunlap
2016-02-10 13:22   ` Jan Beulich
2016-02-10 13:50     ` Andrew Cooper
2016-02-10 14:03       ` Jan Beulich
2016-02-10 14:13         ` George Dunlap
2016-02-16  7:06   ` Tian, Kevin
2016-02-09 20:01 ` [PATCH 7/8] xen/x86: Fix get_cpu_info() when built with clang Andrew Cooper
2016-02-09 20:01 ` [PATCH 8/8] x86/efi: Generate uefi_call_wrapper() when compiling " Andrew Cooper
2016-02-10 13:31   ` Jan Beulich
2016-02-10 13:41     ` Andrew Cooper
2016-02-10 19:11       ` Andrew Cooper
2016-02-11 10:45         ` Jan Beulich
2016-02-09 21:09 ` [PATCH 0/8] xen/x86: Fix build with Clang 3.5 Doug Goldstein
2016-02-10  9:28 ` Ian Campbell

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=56BB37FC.2020403@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=Ian.Campbell@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=tim@xen.org \
    --cc=xen-devel@lists.xen.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.