Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Václav_Z_
Beginner
412 Views

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

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...

 

0 Kudos
3 Replies
412 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

Václav_Z_
Beginner
412 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())
    { 
    //...
    }
    //...
};

 

412 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

Reply