[Mesa-dev] [PATCH 1/5] meta: silence uninitialized variable warnings for MinGW

Brian Paul brianp at vmware.com
Fri Feb 27 17:08:07 PST 2015


On 02/27/2015 06:00 PM, Matt Turner wrote:
> On Fri, Feb 27, 2015 at 12:07 PM, Brian Paul <brianp at vmware.com> wrote:
>> ---
>>   src/mesa/drivers/common/meta_blit.c | 2 ++
>>   1 file changed, 2 insertions(+)
>>
>> diff --git a/src/mesa/drivers/common/meta_blit.c b/src/mesa/drivers/common/meta_blit.c
>> index 971a2ff..bb21642 100644
>> --- a/src/mesa/drivers/common/meta_blit.c
>> +++ b/src/mesa/drivers/common/meta_blit.c
>> @@ -133,6 +133,8 @@ setup_glsl_msaa_blit_scaled_shader(struct gl_context *ctx,
>>         sample_map = ctx->Const.SampleMap8x;
>>         break;
>>      default:
>> +      sample_number = NULL;
>> +      sample_map = NULL;
>>         _mesa_problem(ctx, "Unsupported sample count %d\n", samples);
>>         unreachable("Unsupported sample count");
>>      }
>> --
>> 1.9.1
>
> For this to be a warning, you have to be using gcc from before 4.5
> (support for __builtin_unreachable). How much do we want to, IMO,
> clutter the code to avoid warnings on gcc that old?

It's MinGW 4.6.3.  We're kind of stuck with the older version since 
newer versions have a wacky dependency on a thread library.  I don't 
recall the details right now but it was a big mess.


> If we really want to do better, I think we can implement unreachable()
> on gcc < 4.5 with a small static inline function marked with the
> noreturn attribute.

Yeah, that might be good.  There's quite a few other warnings where 
unreachable() is at the end of a non-void function and we're not 
returning a value.

-Brian



More information about the mesa-dev mailing list