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

Dmitri Gribenko gribozavr at gmail.com
Thu Jan 10 18:37:34 PST 2013


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.

Dmitri

-- 
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/



More information about the llvm-commits mailing list