Re: [patch] __func__ -> __FUNCTION__

Muli Ben-Yehuda (mulix@actcom.co.il)
Tue, 13 Aug 2002 11:10:28 +0300


--OJWLbGElk4npXSe3
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Tue, Aug 13, 2002 at 01:09:39AM -0700, H. Peter Anvin wrote:
> Muli Ben-Yehuda wrote:
> >
> >How about:=20
> >
> >/* early gcc compilers lose on __func__ */=20
> >#ifndef __func__=20
> >#define __func__ __FUNCTION__
> >#endif /* !defined __func__ */=20
>=20
> __func__ isn't a macro; it's a compiler token.

Works for me(TM).=20

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

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

int main()
{
printf("%s\n", __func__);=20
return 0;=20
}
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=3D0 -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=3D1 -o foo
mulix@alhambra:~/tmp$ ./foo

ObCompleteyUnrelatedQuestions: where can I find klibc?=20
--=20
"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

--OJWLbGElk4npXSe3
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQE9WL70KRs727/VN8sRAg3OAJwIioAMqVkt28m6NGbXrDuZvSXYjwCgjdMQ
ozYAsPw+10OVSFw5/qlpZHw=
=apkC
-----END PGP SIGNATURE-----

--OJWLbGElk4npXSe3--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/