[llvm-commits] [llvm] r172156 - /llvm/trunk/include/llvm/Support/Compiler.h

Joerg Sonnenberger joerg at britannica.bec.de
Thu Jan 10 18:59:57 PST 2013


On Fri, Jan 11, 2013 at 04:37:34AM +0200, Dmitri Gribenko wrote:
> On Fri, Jan 11, 2013 at 4:33 AM, Joerg Sonnenberger
> <joerg at britannica.bec.de> wrote:
> > On Fri, Jan 11, 2013 at 01:13:51AM -0000, Dmitri Gribenko wrote:
> >> Author: gribozavr
> >> Date: Thu Jan 10 19:13:51 2013
> >> New Revision: 172156
> >>
> >> URL: http://llvm.org/viewvc/llvm-project?rev=172156&view=rev
> >> Log:
> >> Add a new portability macro LLVM_FUNCTION_NAME, that expands to __func__, if
> >> supported.
> >>
> >> Modified:
> >>     llvm/trunk/include/llvm/Support/Compiler.h
> >
> > Why don't you add
> >
> > #if defined(_MSC_VER)
> > #define __func__ __FUNCTION__
> > #endif
> >
> > to config.h?
> 
> Because __func__ should be defined as:
> 
> static const char __func__[] = "function-name";
> 
> Replacements available in other compilers might behave in a different
> way, thus we need a different name to avoid confusion.

Eh, no. The main point is that you can't use __func__ in ways that
expect string merging, so "foo" __func__ "bar" doesn't work unlike e.g.
GCC's __FUNCTION__. __func__ can always be replaced by "" with minimal
lose of functionality.

Joerg



More information about the llvm-commits mailing list