[Mesa-dev] [PATCH] mesa: remove unnecessary uninitialized_var() macro
Brian Paul
brianp at vmware.com
Sat Feb 28 12:20:46 PST 2015
On 02/28/2015 11:11 AM, Matt Turner wrote:
> On Sat, Feb 28, 2015 at 7:43 AM, Brian Paul <brianp at vmware.com> wrote:
>> Only used in one place. Just use conventional initializers there.
>> ---
>> src/mesa/main/compiler.h | 8 --------
>> src/mesa/x86/common_x86.c | 3 +--
>> 2 files changed, 1 insertion(+), 10 deletions(-)
>>
>> diff --git a/src/mesa/main/compiler.h b/src/mesa/main/compiler.h
>> index 796870d..a0ef75a 100644
>> --- a/src/mesa/main/compiler.h
>> +++ b/src/mesa/main/compiler.h
>> @@ -163,14 +163,6 @@ static inline GLuint CPU_TO_LE32(GLuint x)
>> #endif
>>
>>
>> -
>> -/*
>> - * A trick to suppress uninitialized variable warning without generating any
>> - * code
>> - */
>> -#define uninitialized_var(x) x = x
>> -
>> -
>> /**
>> * LONGSTRING macro
>> * gcc -pedantic warns about long string literals, LONGSTRING silences that.
>> diff --git a/src/mesa/x86/common_x86.c b/src/mesa/x86/common_x86.c
>> index 25f5c40..61328b2 100644
>> --- a/src/mesa/x86/common_x86.c
>> +++ b/src/mesa/x86/common_x86.c
>> @@ -344,8 +344,7 @@ _mesa_get_x86_features(void)
>>
>> #elif defined(USE_X86_64_ASM)
>> {
>> - unsigned int uninitialized_var(eax), uninitialized_var(ebx),
>> - uninitialized_var(ecx), uninitialized_var(edx);
>> + unsigned int eax = 0, ebx = 0, ecx = 0, edx = 0;
>>
>> /* Always available on x86-64. */
>> _mesa_x86_cpu_features |= X86_FEATURE_XMM | X86_FEATURE_XMM2;
>> --
>> 1.9.1
>
> I've sent a patch that fixes a mistake I made in this code that
> removes the need for initializing these variables at all. With the
> patch I sent applied, this hunk can be dropped, and the hunk that
> removes the uninitialized_var macro is
>
> Reviewed-by: Matt Turner <mattst88 at gmail.com>
>
OK, thanks.
-Brian
More information about the mesa-dev
mailing list