[Mesa-dev] [RFC PATCH 3/4] ff_fragment_shader: mark impossible switch values with unreachable

Brian Paul brianp at vmware.com
Mon Apr 24 15:06:20 UTC 2017


On 04/22/2017 03:46 PM, Giuseppe Bilotta wrote:
> On Sat, Apr 22, 2017 at 11:45 AM, Nicolai Hähnle <nhaehnle at gmail.com> wrote:
>>> @@ -495,8 +492,8 @@ static GLboolean args_match( const struct state_key
>>> *key, GLuint unit )
>>>              return GL_FALSE;
>>>           }
>>>           break;
>>> -      default:
>>> -        return GL_FALSE;       /* impossible */
>>> +      default:
>>> +        unreachable("Invalid TexEnv Combine operand");
>>
>> For this one, I think despite the comment it'd be best to change that to an
>> assert + return first, and re-visit it after some time.
>
> Makes sense. As Gustaw suggests, it _shouldn't_ happen, but there's
> nothing to lose in being cautious about it 8-). I'll respin this patch
> with the assert+return here.

I just want to second that.  It's really bad when our driver crashes in 
the hands of a customer.  I'd rather have a rendering glitch than a 
crash.  I'm kind of worried about the proliferation of unreachable() in 
Mesa.

-Brian



More information about the mesa-dev mailing list