[Piglit] [PATCH] arb_cull_distance: Fix sometimes-uninitialized warnings.
Nicolai Hähnle
nhaehnle at gmail.com
Mon Apr 3 08:05:58 UTC 2017
Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com>
On 01.04.2017 01:27, Vinson Lee wrote:
> exceed-limits.c:75:6: warning: variable 'clip_distances' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
> if (strcmp(argv[1], "cull") == 0) {
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
> exceed-limits.c:90:14: note: uninitialized use occurs here
> use_clip, clip_distances,
> ^~~~~~~~~~~~~~
> exceed-limits.c:75:2: note: remove the 'if' if its condition is always false
> if (strcmp(argv[1], "cull") == 0) {
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> exceed-limits.c:61:22: note: initialize the variable 'clip_distances' to silence this warning
> GLint clip_distances;
> ^
> = 0
> exceed-limits.c:78:13: warning: variable 'cull_distances' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
> } else if (strcmp(argv[1], "clip") == 0) {
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
> exceed-limits.c:91:14: note: uninitialized use occurs here
> use_cull, cull_distances);
> ^~~~~~~~~~~~~~
> exceed-limits.c:78:9: note: remove the 'if' if its condition is always false
> } else if (strcmp(argv[1], "clip") == 0) {
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> exceed-limits.c:62:22: note: initialize the variable 'cull_distances' to silence this warning
> GLint cull_distances;
> ^
> = 0
>
> Fixes: 35469c1b05bb ("Add more ARB_cull_distance tests")
> Signed-off-by: Vinson Lee <vlee at freedesktop.org>
> ---
> tests/spec/arb_cull_distance/exceed-limits.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/tests/spec/arb_cull_distance/exceed-limits.c b/tests/spec/arb_cull_distance/exceed-limits.c
> index 10fecb969e5c..15304b752db9 100644
> --- a/tests/spec/arb_cull_distance/exceed-limits.c
> +++ b/tests/spec/arb_cull_distance/exceed-limits.c
> @@ -74,9 +74,11 @@ piglit_init(int argc, char **argv)
>
> if (strcmp(argv[1], "cull") == 0) {
> use_clip = "// ";
> + clip_distances = 0;
> cull_distances = max_cull_distances + 2;
> } else if (strcmp(argv[1], "clip") == 0) {
> clip_distances = max_clip_distances + 2;
> + cull_distances = 0;
> use_cull = "// ";
> } else if (strcmp(argv[1], "total") == 0) {
> clip_distances = max_combined_clip_and_cull_distances / 2 + 1;
>
--
Lerne, wie die Welt wirklich ist,
Aber vergiss niemals, wie sie sein sollte.
More information about the Piglit
mailing list