[Mesa-dev] [PATCH 1/3] main: silence missing return value warning in array_index_of_resource()

Tapani tapani.palli at intel.com
Tue Apr 21 05:50:23 PDT 2015


On 04/21/2015 04:01 PM, Emil Velikov wrote:
> On 16/04/15 21:52, Brian Paul wrote:
>> ---
>>   src/mesa/main/shader_query.cpp | 1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/src/mesa/main/shader_query.cpp b/src/mesa/main/shader_query.cpp
>> index b5f1d08..ad936e5 100644
>> --- a/src/mesa/main/shader_query.cpp
>> +++ b/src/mesa/main/shader_query.cpp
>> @@ -537,6 +537,7 @@ array_index_of_resource(struct gl_program_resource *res,
>>         return get_matching_index(RESOURCE_VAR(res), name);
>>      default:
>>         assert(!"support for resource type not implemented");
>> +      return 0;
> Both callers assume that 0 is a valid value. Perhaps return -1 so that
> the error paths can kick in ?

Yes, -1 would be appropriate, 0 is a valid index.

> -Emil
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev



More information about the mesa-dev mailing list