mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Mosberger <davidm@napali.hpl.hp.com>
To: Stephen Hemminger <shemminger@osdl.org>
Cc: David Mosberger-Tang <davidm@hpl.hp.com>,
	linux-ia64@linuxia64.org, linux-kernel@vger.kernel.org
Subject: Re: GCC nested functions?
Date: Wed, 12 May 2004 11:13:50 -0700	[thread overview]
Message-ID: <16546.26974.678560.553686@napali.hpl.hp.com> (raw)
In-Reply-To: <20040512105924.54a8211b@dell_ss3.pdx.osdl.net>

>>>>> On Wed, 12 May 2004 10:59:24 -0700, Stephen Hemminger <shemminger@osdl.org> said:

  Stephen> I used GCC nested functions in the (not released) bridge
  Stephen> sysfs interface for 2.6.6.  It seemed like a nice way to
  Stephen> express the sysfs related interface without doing lots of
  Stephen> code copying (or worse lots of macros).

Oh, man!  Nested C functions are evil.  Just don't do it.

  Stephen> This works fine for GCC 2.95 and 3.X for i386 and x86_64
  Stephen> architectures, but the ia64 (cross compiler) pukes with:

  Stephen> In function `store_forward_delay':
  Stephen> : undefined reference to `__ia64_trampoline'

  Stephen> Redoing it as separate functions is easy enough, but the
  Stephen> questions are:

  Stephen> - Are gcc nested functions allowed in the kernel?  If not
  Stephen> where should this restriction be put in Documentation?
  Stephen> CodingStyles?

Nested C functions shouldn't be allowed _anywhere_.  It's the worst
extension that has made it into GNU C.

  Stephen> - Or is gcc on ia64 just too stupid? or do some more
  Stephen> support routines need to exist in arch/ia64?

It has nothing to do with stupidity.  The kernel doesn't support all
the routines provided by libgcc.a.  __ia64_trampoline() is one of
them.

  Stephen> - Do other architectures (sparc, ppc) have similar problems?

It's not a problem.  It's a feature.  It's likely that other
architectures which require a helper-routine from libgcc would behave
the same.

	--david

  parent reply	other threads:[~2004-05-12 18:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-12 17:59 Stephen Hemminger
2004-05-12 18:04 ` Christoph Hellwig
2004-05-13  0:07   ` Mitchell Blank Jr
2004-05-12 18:11 ` William Lee Irwin III
2004-05-12 18:13 ` David Mosberger [this message]
2004-05-12 19:30 ` viro
2004-05-12 19:34 ` Gabriel Paubert

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=16546.26974.678560.553686@napali.hpl.hp.com \
    --to=davidm@napali.hpl.hp.com \
    --cc=davidm@hpl.hp.com \
    --cc=linux-ia64@linuxia64.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=shemminger@osdl.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®