mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Vegard Nossum" <vegard.nossum@gmail.com>
To: "Steve French" <smfrench@gmail.com>
Cc: "Sam Ravnborg" <sam@ravnborg.org>, lkml <linux-kernel@vger.kernel.org>
Subject: Re: optimizing out inline functions
Date: Mon, 2 Jun 2008 11:38:36 +0200	[thread overview]
Message-ID: <19f34abd0806020238h2eba8765la3764b15211a205@mail.gmail.com> (raw)
In-Reply-To: <524f69650805290939v65f9f5b8m65fd1ba23acd08d8@mail.gmail.com>

On Thu, May 29, 2008 at 6:39 PM, Steve French <smfrench@gmail.com> wrote:
> Ran into one loosely related question, printk takes a variable
> argument list, so the calling function in this case would also need to
> be able to handle thos variable arguments.  With macros, we are able
> to do things like with variable arguments easily
>
> #define function_to_print_some_warning(format, arg...)
> printk(KERN_WARNING ": " format "\n" , ## arg)
>
> Are there style rules (or nicely written examples) for doing this
> (variable argument lists) with (inline) functions
>

Hm, are you referring to making a proxy inline function that takes a
variable number of arguments and calls another function with the same
(also variable number of) variables?

I don't think this is possible unless you want to use va_lists. And
that might not be desirable in an inline function, I don't know how
well gcc can optimize this away.

The canonical example, although not an inline function, is printk()
itself from kernel/printk.c, which simply calls vprintk().


Vegard

-- 
"The animistic metaphor of the bug that maliciously sneaked in while
the programmer was not looking is intellectually dishonest as it
disguises that the error is the programmer's own creation."
	-- E. W. Dijkstra, EWD1036

  parent reply	other threads:[~2008-06-02  9:38 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-28 19:51 Steve French
2008-05-28 19:54 ` Pekka Enberg
2008-05-29  8:40   ` Andrew Morton
2008-05-28 20:00 ` Sam Ravnborg
2008-05-29 16:39   ` Steve French
2008-05-29 17:20     ` Sam Ravnborg
2008-06-02  9:38     ` Vegard Nossum [this message]
     [not found] <ayzYV-7mv-5@gated-at.bofh.it>
     [not found] ` <ayA8E-89e-29@gated-at.bofh.it>
2008-05-28 20:37   ` James Kosin
2008-05-29  3:27     ` Johannes Weiner
2008-05-29  3:04       ` Joe Perches
2008-05-29 13:11       ` James Kosin
2008-05-29 13:13       ` James Kosin

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=19f34abd0806020238h2eba8765la3764b15211a205@mail.gmail.com \
    --to=vegard.nossum@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sam@ravnborg.org \
    --cc=smfrench@gmail.com \
    /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®