mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Willy Tarreau <willy@w.ods.org>
To: Mikael Pettersson <mikpe@csd.uu.se>
Cc: marcelo.tosatti@cyclades.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2.4.31 7/9] gcc4: fix const function warnings
Date: Sun, 12 Jun 2005 13:50:20 +0200	[thread overview]
Message-ID: <20050612115019.GJ28759@alpha.home.local> (raw)
In-Reply-To: <200506121121.j5CBLGd4019750@harpo.it.uu.se>

Hi Mikael,

Just out of curiosity, I understand why we can have a const on an inline
function to help the compiler optimize the code at compile time in cases
such as below :

> -static inline const unsigned char dehex(char c) {
> +static inline __attribute_const__ unsigned char dehex(char c) {
>  	if ((c>='0')&&(c<='9')) {
>  		return c-'0';
>  	}

But I don't see how it can be useful in asm code like below, since the
compiler cannot evaluate it at compile time :

> -static __inline__ __const__ __u32 ___arch__swab32(__u32 x)
> +static __inline__ __attribute_const__ __u32 ___arch__swab32(__u32 x)
>  {
>  #ifdef CONFIG_X86_BSWAP
>  	__asm__("bswap %0" : "=r" (x) : "0" (x));

Am I missing something, or could we simply remove the __const__ every
time the function only uses asm ?

Regards,
Willy


  reply	other threads:[~2005-06-12 11:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-12 11:21 Mikael Pettersson
2005-06-12 11:50 ` Willy Tarreau [this message]
2005-06-12 12:14   ` Nick Piggin
2005-06-12 12:35     ` Willy Tarreau

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=20050612115019.GJ28759@alpha.home.local \
    --to=willy@w.ods.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcelo.tosatti@cyclades.com \
    --cc=mikpe@csd.uu.se \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®