[lkml]   [2004]   [May]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: GCC nested functions?
>>>>> On Wed, 12 May 2004 10:59:24 -0700, Stephen Hemminger <> 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

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.

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 14:03    [W:0.050 / U:1.120 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site