mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Nick Piggin <nickpiggin@yahoo.com.au>
To: Willy Tarreau <willy@w.ods.org>
Cc: Mikael Pettersson <mikpe@csd.uu.se>,
	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 22:14:51 +1000	[thread overview]
Message-ID: <42AC273B.60808@yahoo.com.au> (raw)
In-Reply-To: <20050612115019.GJ28759@alpha.home.local>

Willy Tarreau wrote:
> Hi Mikael,
> 
> 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 ?
> 

const functions are those that don't have side effects and depend
only on their argument list. So such functions can be CSE'ed or
reordered.

If it makes sense to use on any inline function, then I think it
makes sense if they're only using asm. Actually I would have thought
it would *only* help inline functions using asm, because gcc may
not know that such asm is 'const'.

But that's not to say they should be removed just because they
can't help gcc - it may be instructive to the programmer, or more
robust when making modifications to the code (eg. uninlining).

Send instant messages to your online friends http://au.messenger.yahoo.com 

  reply	other threads:[~2005-06-12 12:15 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
2005-06-12 12:14   ` Nick Piggin [this message]
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=42AC273B.60808@yahoo.com.au \
    --to=nickpiggin@yahoo.com.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcelo.tosatti@cyclades.com \
    --cc=mikpe@csd.uu.se \
    --cc=willy@w.ods.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 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®