From: Manfred Spraul <manfred@colorfullife.com>
To: Jakub Jelinek <jakub@redhat.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: Why is get_current() not const function?
Date: Mon, 17 Mar 2003 20:11:06 +0100 [thread overview]
Message-ID: <3E761DCA.9080005@colorfullife.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 319 bytes --]
Is it possible to use __attribute__((const) with inline functions?
I tried that, but it seems that gcc ignores __attribute__((const) and
looks at the contents of the function instead.
I've tried the attached test app: With gcc-3.2.1 (gcc -O3), and
"inlconst" was called 10 times, constfnc only once.
--
Manfred
[-- Attachment #2: consttest.c --]
[-- Type: text/plain, Size: 460 bytes --]
#include <stdio.h>
#include <stdlib.h>
static int constfnc(int x) __attribute__((const));
static inline int inlconst(int x) __attribute__((const));
static void dummy(int i);
static inline int inlconst(int x)
{
printf("in inlconst.\n");
return 2;
}
int main(void)
{
int i;
for(i=0;i<10;i++) {
dummy(constfnc(0));
}
for (i=0;i<10;i++) {
dummy(inlconst(0));
}
}
int constfnc(int x)
{
printf("in const.\n");
return 1;
}
void dummy(int i)
{
}
next reply other threads:[~2003-03-17 19:00 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-03-17 19:11 Manfred Spraul [this message]
[not found] <20030313061926.S3910@devserv.devel.redhat.com.suse.lists.linux.kernel>
2003-03-13 13:31 ` Why is get_current() not const function? Andi Kleen
[not found] ` <b53pqi$ud9$1@penguin.transmeta.com.suse.lists.linux.kernel>
2003-03-17 17:26 ` Andi Kleen
2003-03-17 17:39 ` Jakub Jelinek
-- strict thread matches above, loose matches on Subject: below --
2003-03-13 11:19 Jakub Jelinek
2003-03-17 6:26 ` Linus Torvalds
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=3E761DCA.9080005@colorfullife.com \
--to=manfred@colorfullife.com \
--cc=jakub@redhat.com \
--cc=linux-kernel@vger.kernel.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