[Mesa-dev] replace __FUNCTION__ with __func__ task

Jose Fonseca jfonseca at vmware.com
Tue Mar 3 14:06:22 PST 2015


On 03/03/15 20:56, Jan Vesely wrote:
> On Tue, 2015-03-03 at 10:07 -0700, Brian Paul wrote:
>> On 03/03/2015 09:56 AM, Jose Fonseca wrote:
>>> On 03/03/15 15:57, Brian Paul wrote:
>>>> We're using both of these in Mesa/gallium.  It would be nice to
>>>> consistently just use C99's __func__ everywhere.  This would be any easy
>>>> task for someone looking for something simple to do.
>>>>
>>>> We could then get rid of this (broken) chunk seen in both compiler.h and
>>>> p_compiler.h:
>>>>
>>>> #ifndef __FUNCTION__
>>>> #  define __FUNCTION__ __func__
>>>> #endif
>>>
>>> Sounds good to me.  Note that MSVC doesn't support __func__, only
>>> __FUNCTION__, so we need to ensure that c99_compat.h gets included
>>> everywhere.
>>
>> Right.  That should already be the case since it's included by
>> src/mesa/main/compiler.h which gets included almost everywhere already.
>
> would it make sense to add -imacros/-include cmdline options for these
> headers?
> I have no idea whether these are supported by other compilers (at least
> -include is supported by clang)
>
> jan

Yes, that's a thought.

MSVC has the /FIxxxxxxxx.h option.  We could  indeed pass it universally 
to ensure __func__/inline and friends are always there.  But if 
c99_compat.h is already included everywhere, that's fine too.


BTW, looking at MSVC 14..2015 notes [1], it will:

- support __func__.
- support snprintf (instead of _snprintf)

Unfortunately, not much more C99/C11 support.

Jose

[1] http://support.microsoft.com/kb/2967191




More information about the mesa-dev mailing list