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

Giuseppe Bilotta giuseppe.bilotta at gmail.com
Sat Apr 22 21:46:02 UTC 2017


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.


-- 
Giuseppe "Oblomov" Bilotta


More information about the mesa-dev mailing list