[illumos-Developer] __FUNCTION__ in illumos

Albert Lee trisk at opensolaris.org
Sat Dec 11 14:35:05 PST 2010


n Fri, Dec 10, 2010 at 7:36 PM, Garrett D'Amore <garrett at damore.org> wrote:
> Is __func__ available in non-C99 mode?

Empirical testing shows that it is always available. It's used all
over the place in ON:
http://src.illumos.org/source/search?q=__func__&project=illumos-opengrok

In releases of gcc and Studio that implement __FUNCTION__ (and
__func__ of course), it is not visible to the preprocessor; the
substitution happens later in the pipeline (it is also not a
first-class variable as the documentation suggests).

>
> I'd rather have this macro located in system headers somewhere (common),
> than have delivered via cw.  This would also allow for feature tests for
> different compilers and different *modes* of the compilers.  (E.g. don't
> expose it except in C99 mode.)

Did you have  sys/feature_tests.h in mind?

-Albert



More information about the Developer mailing list