[Mesa-dev] [PATCH] glsl: add default switch case to silence uninitialized variable warning

Chad Versace chad.versace at linux.intel.com
Fri Aug 23 17:14:48 PDT 2013


On 08/23/2013 02:05 PM, Paul Berry wrote:
> On 23 August 2013 13:55, Brian Paul <brianp at vmware.com> wrote:
>
>> On 08/23/2013 02:39 PM, Matt Turner wrote:
>>
>>> On Fri, Aug 23, 2013 at 1:24 PM, Brian Paul <brianp at vmware.com> wrote:

> In that case, let's fix it by initializing limit to 0 at its declaration.
> That way we will get a (helpful) compiler warning in the inevitable future
> event that we add new values to _mesa_glsl_parser_targets.

I second Paul's advice here.

Let's not add default cases to switch statements that suppose to handle all
possible enum values. Otherwise, we may silence helpful compiler warnings
in the future.



More information about the mesa-dev mailing list