lkml.org 
[lkml]   [2002]   [Aug]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [patch] __func__ -> __FUNCTION__
On Tue, Aug 13, 2002 at 01:09:39AM -0700, H. Peter Anvin wrote:
> Muli Ben-Yehuda wrote:
> >
> >How about:
> >
> >/* early gcc compilers lose on __func__ */
> >#ifndef __func__
> >#define __func__ __FUNCTION__
> >#endif /* !defined __func__ */
>
> __func__ isn't a macro; it's a compiler token.

Works for me(TM).

mulix@alhambra:~/tmp$ cat foo.c
#include <stdio.h>

#if DEF_FUNC
#ifndef __func__
#define __func__ __FUNCTION__
#endif /* !defined __func__ */
#endif /* DEF_FUNC */

int main()
{
printf("%s\n", __func__);
return 0;
}
mulix@alhambra:~/tmp$ /usr/bin/gcc -v
Reading specs from
/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/specs
gcc version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)
mulix@alhambra:~/tmp$ /usr/bin/gcc foo.c -DDEF_FUNC=0 -o foo
foo.c: In function `main':
foo.c:11: `__func__' undeclared (first use in this function)
foo.c:11: (Each undeclared identifier is reported only once
foo.c:11: for each function it appears in.)
mulix@alhambra:~/tmp$ /usr/bin/gcc foo.c -DDEF_FUNC=1 -o foo
mulix@alhambra:~/tmp$ ./foo

ObCompleteyUnrelatedQuestions: where can I find klibc?
--
"Hmm.. Cache shrink failed - time to kill something?
Mhwahahhaha! This is the part I really like. Giggle."
-- linux/mm/vmscan.c
http://vipe.technion.ac.il/~mulix/ http://syscalltrack.sf.net
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2005-03-22 13:28    [W:0.075 / U:0.072 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site