All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Tokarev <mjt@tls.msk.ru>
To: Peter Maydell <peter.maydell@linaro.org>, qemu-devel@nongnu.org
Cc: qemu-trivial@nongnu.org, patches@linaro.org,
	Richard Henderson <rth@twiddle.net>
Subject: Re: [Qemu-trivial] [PATCH] tcg: mark tcg_out* and tcg_patch* with attribute 'unused'
Date: Sun, 08 Jun 2014 16:11:30 +0400	[thread overview]
Message-ID: <539452F2.8070509@msgid.tls.msk.ru> (raw)
In-Reply-To: <1402160924-14152-1-git-send-email-peter.maydell@linaro.org>

07.06.2014 21:08, Peter Maydell wrote:
> The tcg_out* and tcg_patch* functions are utility routines that may or
> may not be used by a particular backend; mark them with the 'unused'
> attribute to suppress spurious warnings if they aren't used.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
> Do we want to define a QEMU_UNUSED macro in compiler.h? We don't
> seem to have done for the existing uses of this attribute in tree.
> 
>  tcg/tcg.c | 20 ++++++++++++--------
>  1 file changed, 12 insertions(+), 8 deletions(-)
> 
> diff --git a/tcg/tcg.c b/tcg/tcg.c
> index 2c5732d..fe55d05 100644
> --- a/tcg/tcg.c
> +++ b/tcg/tcg.c
> @@ -125,19 +125,20 @@ static TCGRegSet tcg_target_available_regs[2];
>  static TCGRegSet tcg_target_call_clobber_regs;
>  
>  #if TCG_TARGET_INSN_UNIT_SIZE == 1
> -static inline void tcg_out8(TCGContext *s, uint8_t v)

Hm. Those are already #ifdef'ed, is it not enough?  Which architectures
do not use functions which _are_ declared/defined?

But I wonder, why to bother at all?  This "static inline foo() {..}" idiom
is very common in header files, to define a function which may or may not
be used, and no compiler warns about these.

Thanks,

/mjt


WARNING: multiple messages have this Message-ID (diff)
From: Michael Tokarev <mjt@tls.msk.ru>
To: Peter Maydell <peter.maydell@linaro.org>, qemu-devel@nongnu.org
Cc: qemu-trivial@nongnu.org, patches@linaro.org,
	Richard Henderson <rth@twiddle.net>
Subject: Re: [Qemu-devel] [Qemu-trivial] [PATCH] tcg: mark tcg_out* and tcg_patch* with attribute 'unused'
Date: Sun, 08 Jun 2014 16:11:30 +0400	[thread overview]
Message-ID: <539452F2.8070509@msgid.tls.msk.ru> (raw)
In-Reply-To: <1402160924-14152-1-git-send-email-peter.maydell@linaro.org>

07.06.2014 21:08, Peter Maydell wrote:
> The tcg_out* and tcg_patch* functions are utility routines that may or
> may not be used by a particular backend; mark them with the 'unused'
> attribute to suppress spurious warnings if they aren't used.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
> Do we want to define a QEMU_UNUSED macro in compiler.h? We don't
> seem to have done for the existing uses of this attribute in tree.
> 
>  tcg/tcg.c | 20 ++++++++++++--------
>  1 file changed, 12 insertions(+), 8 deletions(-)
> 
> diff --git a/tcg/tcg.c b/tcg/tcg.c
> index 2c5732d..fe55d05 100644
> --- a/tcg/tcg.c
> +++ b/tcg/tcg.c
> @@ -125,19 +125,20 @@ static TCGRegSet tcg_target_available_regs[2];
>  static TCGRegSet tcg_target_call_clobber_regs;
>  
>  #if TCG_TARGET_INSN_UNIT_SIZE == 1
> -static inline void tcg_out8(TCGContext *s, uint8_t v)

Hm. Those are already #ifdef'ed, is it not enough?  Which architectures
do not use functions which _are_ declared/defined?

But I wonder, why to bother at all?  This "static inline foo() {..}" idiom
is very common in header files, to define a function which may or may not
be used, and no compiler warns about these.

Thanks,

/mjt

  reply	other threads:[~2014-06-08 12:11 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-07 17:08 [Qemu-trivial] [PATCH] tcg: mark tcg_out* and tcg_patch* with attribute 'unused' Peter Maydell
2014-06-07 17:08 ` [Qemu-devel] " Peter Maydell
2014-06-08 12:11 ` Michael Tokarev [this message]
2014-06-08 12:11   ` [Qemu-devel] [Qemu-trivial] " Michael Tokarev
2014-06-08 12:33   ` Peter Maydell
2014-06-08 12:33     ` [Qemu-devel] " Peter Maydell
2014-06-08 19:04   ` Peter Maydell
2014-06-08 19:04     ` [Qemu-devel] " Peter Maydell
2014-06-08 19:34     ` Richard Henderson
2014-06-08 19:34       ` [Qemu-devel] " Richard Henderson
2014-06-21 15:11 ` Michael Tokarev
2014-06-21 15:11   ` [Qemu-devel] " Michael Tokarev

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=539452F2.8070509@msgid.tls.msk.ru \
    --to=mjt@tls.msk.ru \
    --cc=patches@linaro.org \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    --cc=rth@twiddle.net \
    /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.