[Mesa-dev] [PATCH] glsl: Fix 'control reaches end of non-void function' warning.

Chad Versace chad.versace at linux.intel.com
Tue Jan 17 16:16:12 PST 2012


On 01/16/2012 09:10 PM, Vinson Lee wrote:
> Fix this GCC warning on non-debug builds.
> glsl_types.cpp: In member function 'gl_texture_index
> glsl_type::sampler_index() const':
> glsl_types.cpp:157: warning: control reaches end of non-void function
> 
> Signed-off-by: Vinson Lee <vlee at freedesktop.org>
> ---
>  src/glsl/glsl_types.cpp |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/glsl/glsl_types.cpp b/src/glsl/glsl_types.cpp
> index d4385a6..1489aae 100644
> --- a/src/glsl/glsl_types.cpp
> +++ b/src/glsl/glsl_types.cpp
> @@ -147,12 +147,12 @@ glsl_type::sampler_index() const
>        return TEXTURE_RECT_INDEX;
>     case GLSL_SAMPLER_DIM_BUF:
>        assert(!"FINISHME: Implement ARB_texture_buffer_object");
> -      break;
> +      return TEXTURE_BUFFER_INDEX;
>     case GLSL_SAMPLER_DIM_EXTERNAL:
>        return TEXTURE_EXTERNAL_INDEX;
>     default:
>        assert(!"Should not get here.");
> -      break;
> +      return TEXTURE_BUFFER_INDEX;
>     }
>  }
>  

I wish C had an error value which could be returned in cases like this. But, since C isn't perfect,
TEXTURE_BUFFER_INDEX is sensible.

Reviewed-by: Chad Versace <chad.versace at linux.intel.com>


More information about the mesa-dev mailing list