[Piglit] [PATCH] arb_program_interface_query: Silence uninitialized variable warning.

Brian Paul brianp at vmware.com
Tue Dec 1 07:22:07 PST 2015


On 11/30/2015 10:50 PM, Vinson Lee wrote:
> Fixes Coverity "uninitialized scalar variable" defect.
>
> Signed-off-by: Vinson Lee <vlee at freedesktop.org>
> ---
>   tests/spec/arb_program_interface_query/getprogramresourceiv.c | 6 ++++++
>   1 file changed, 6 insertions(+)
>
> diff --git a/tests/spec/arb_program_interface_query/getprogramresourceiv.c b/tests/spec/arb_program_interface_query/getprogramresourceiv.c
> index 769e29f..7ef72cc 100755
> --- a/tests/spec/arb_program_interface_query/getprogramresourceiv.c
> +++ b/tests/spec/arb_program_interface_query/getprogramresourceiv.c
> @@ -668,6 +668,9 @@ check_prop(GLuint prog, GLenum programInterface, int index, const char *name,
>   		case GL_BUFFER_VARIABLE:
>   			pif = GL_SHADER_STORAGE_BLOCK;
>   			break;
> +		default:
> +			assert(0);
> +			pif = GL_NONE;

In mesa we have an unreachable() macro, but I don't think we have that 
in piglit yet, AFAIK.

In any case, I try to avoid generic assert(0) and use something with a 
bit more info such as:

assert(!"unexpected programInterface value");

-Brian


>   		}
>
>   		parent_idx = glGetProgramResourceIndex(prog, pif,
> @@ -739,6 +742,9 @@ check_prop(GLuint prog, GLenum programInterface, int index, const char *name,
>   		case GL_COMPUTE_SUBROUTINE_UNIFORM:
>   			pif = GL_COMPUTE_SUBROUTINE;
>   			break;
> +		default:
> +			assert(0);
> +			pif = GL_NONE;
>   		}
>
>   		/* check that the return count is as expected */
>



More information about the Piglit mailing list