[illumos-Developer] __FUNCTION__ in illumos

Albert Lee trisk at opensolaris.org
Thu Dec 16 12:57:18 PST 2010


This would work assuming every compilation unit with __FUNCTION__
includes a system header, but I'm not sure about the impact outside of
ON where we have no control over which compilers are used. As it's not
a true preprocessor macro in the two common compilers that support it,
we can't test for feature presence (although we could restrict the
macro definition to __SUNPRO_C of course).

-Albert

On Sat, Dec 11, 2010 at 10:57 PM, Garrett D'Amore <garrett at nexenta.com> wrote:
>
> Yes, somewhere like sys/feature_tests.h is exactly what I had in mind.
>
>  - Garrett
>
> -----Original Message-----
> From: Albert Lee [mailto:trisk at opensolaris.org]
> Sent: Sat 12/11/2010 2:35 PM
> To: Garrett D'Amore
> Cc: developer at lists.illumos.org
> Subject: Re: [illumos-Developer] __FUNCTION__ in illumos
>
> 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
>
> _______________________________________________
> Developer mailing list
> Developer at lists.illumos.org
> http://lists.illumos.org/m/listinfo/developer
>
>



More information about the Developer mailing list