Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 23 Apr 2000 17:41:53 GMT
From:      attila! <attila@hun.org>
To:        freebsd-current@FreeBSD.ORG
Cc:        Bruce Evans <bde@zeta.org.au>
Subject:   on the road to stomping out __func__
Message-ID:  <200004231741.RAA00425@hun.org>

next in thread | raw e-mail | index | archive | help
    you're correct (see reply from Bruce Evans below) __func__ is
    in /usr/src/contrib/gcc/c-common.c 

ChangeLog:9854: `__func__'.
c-common.c:164:/* Make bindings for __FUNCTION__, __PRETTY_FUNCTION__, and __func__.  */
c-common.c:190:  declare_hidden_char_array ("__func__", name);

    which, if as indicated in ChangeLog:9854
    
Tue Dec  1 20:49:49 1998  Ulrich Drepper  <drepper@cygnus.com>
			  Stephen L Moshier  <moshier@world.std.com>
			  Richard Henderson  <rth@cygnus.com>

* c-common.c (declare_function_name): Declare predefined variable
	`__func__'.

    makes me question why the gcc compiler which I believe was
    in use for 4.0-CURRENT prior to 21 Jul 99, does not include
    the declaration, particularly since the compiler used for
    the compile was based on a CURRENT cvsup of 29 Jun 99....

    However, that still leaves me between a rock and a hard
    spot! 
    
    Kernel usage appears limited solely to two error statements
    in /usr/src/sys/i386/i386/cksum.c

in_cksum.c:

238	if (len)
239		printf("%s: out of data by %d\n", __func__, len);

426	if (len)
427		printf("%s: out of data by %d\n", __func__, len);

    Which is easily enough circumvented (kludged):
   
238	if (len)
243             printf("%s: out of data by %d\n", "in_cksum", len);

431	if (len)
435             printf("%s: out of data by %d\n", "in_cksum_skip", len);
    
    Which is an abomination... and like Bruce, I question the
    need for __func__ at this point...

    But, beggars can not be choosers, and, it does compile,
    without errors, both GENERIC and the target 'hun'.

    And, even better, it appears to execute X from 4.0-CURRENT
    along with Xemacs, pine, xshisen (great during long
    compiles) etc. --what more could I ask for?  Easy, a good
    'make world' and update of /etc files. since my cvsup is
    from 000422.1619 UCT, maybe JKH's 'BOTD' in netstat.c had
    not crept in...

On Sun, 23 Apr 2000, Bruce Evans <bde@zeta.org.au> wrote:

+ On Sat, 22 Apr 2000, attila! wrote:
+ 
+ >     '__func__ is not found for either the 'GENERIC' or 'hun' target.
+ 
+ __func__ is a new feature in C99.  It is an alias for the gcc feature
+ __FUNCTION_NAME.  Both give the name of the current function as a string.
+ 
+ This feature should not be used until C99 becomes Normal, if ever.
+ Using it breaks portability.  It apparently even breaks compiling
+ current kernels with the version of gcc in FreeBSD-3.4.  I think
+ __func__ was added in egcs (the Changelog entry for adding it in gcc
+ is dated Dec 1 1998).
+ 


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200004231741.RAA00425>