[illumos-Developer] __FUNCTION__ in illumos

ken mays maybird1776 at yahoo.com
Fri Dec 17 05:00:12 PST 2010


Hi Alan,

Actually, that 'was' the preferred way of defining '__FUNCTION__' for
higher-level builds like KDE 3.x/4.x as well.

Nice to see a global fix at the kernel env level than having to patch for '__FUNCTION__' at the case-by-case app level.

~ Ken Mays


--- On Thu, 12/16/10, Alan Coopersmith <alan.coopersmith at oracle.com> wrote:

> From: Alan Coopersmith <alan.coopersmith at oracle.com>
> Subject: Re: [illumos-Developer] __FUNCTION__ in illumos
> To: "Albert Lee" <trisk at opensolaris.org>
> Cc: developer at lists.illumos.org
> Date: Thursday, December 16, 2010, 4:07 PM
> Albert Lee wrote:
> > 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).
> 
> The most complete definition I've seen (and contributed the
> Studio checks
> to), which is far more cross-platform than illumos needs,
> is from Mesa:
> 
> #ifndef __FUNCTION__
> # if defined(__VMS)
> #  define __FUNCTION__ "VMS$NL:"
> # elif !defined(__GNUC__) && !defined(__xlC__)
> &&       \
>       (!defined(_MSC_VER) || _MSC_VER <
> 1300)
> #  if (__STDC_VERSION__ >= 199901L) /* C99 */ || \
>     (defined(__SUNPRO_C) &&
> defined(__C99FEATURES__))
> #   define __FUNCTION__ __func__
> #  else
> #   define __FUNCTION__ "<unknown>"
> #  endif
> # endif
> #endif
> 
> For illumos, you could probably simplify to (quickly edited
> in
> e-mail, not even compile tested):
> 
> #if !defined(__FUNCTION__) && !defined(__GNUC__)
> # if (__STDC_VERSION__ >= 199901L) /* C99 */ || \
>     (defined(__SUNPRO_C) &&
> defined(__C99FEATURES__))
> #  define __FUNCTION__ __func__
> # else
> #  define __FUNCTION__ "<unknown>"
> # endif
> #endif
> 
> which should keep it from failing in any code built with
> -Xc -xc99=%none or similar flags to disable C99isms.
> 
> -- 
>     -Alan Coopersmith-     
>   alan.coopersmith at oracle.com
>      Oracle Solaris Platform
> Engineering: X Window System
> 
> 
> _______________________________________________
> Developer mailing list
> Developer at lists.illumos.org
> http://lists.illumos.org/m/listinfo/developer
> 


      



More information about the Developer mailing list