Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.

__builtin_LINE(), __builtin_FUNCTION(), __builtin_FILE() GCC builtins

Václav_Z_
Beginner
5,442 Views

Log4cplus, the library I maintain, uses __builtin_LINE(), __builtin_FUNCTION(), __builtin_FILE() builtins ([1]) when they are available. The availability is detected by version check against GCC 4.8 and later. The Intel C++ compiler version 15.0.1 claims GCC version 4.9.0 compatibilty, yet the builtins are not recognized. Are these hidden behind some switch that I do not notice or are they actually not implemented?

[1]: https://gcc.gnu.org/onlinedocs/gcc-4.8.0/gcc/Other-Builtins.html#index-g_t_005f_005fbuiltin_005fFILE-3359

 

0 Kudos
3 Replies
Shenghong_G_Intel
5,442 Views

Hi Vaclav,

I have checked it in our problem tracking system, and I can confirm this is in fact not implemented. You may still use the old macros instead of builtins for Intel compiler.

Thanks,

Shenghong

0 Kudos
Václav_Z_
Beginner
5,442 Views

shenghong-geng (Intel) wrote:

You may still use the old macros instead of builtins for Intel compiler.

Those are not equivalent. It is not immediately visible from the linked documentation but the builtins are not just equivalent of __FUNCTION__, etc. They return their respective values from the point of view of their caller. This allows me to do interesting things, like using them as default function parameter values:

class TraceLogger
{
public:
    TraceLogger(Logger l, log4cplus::tstring _msg,
        const char* _file = __builtin_FILE(),
        int _line = __builtin_LINE(),
        char const * _function = __builtin_FUNCTION())
    { 
    //...
    }
    //...
};

 

0 Kudos
Shenghong_G_Intel
5,442 Views

Hi Vaclav,

Thank you for the clarification. Hope it will be implemented in future release, I'll add you as the affected customer of this issue in our problem tracking system.

Thanks,

Shenghong

0 Kudos
Reply