From 51a5926f6672bc2286d7cbf61d5bf579f1c00dcd Mon Sep 17 00:00:00 2001 From: Antonio Ospite Date: Wed, 23 Jul 2025 09:47:14 +0200 Subject: [PATCH] crocus: fix returning _Bool instead of pointer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When building for C23 the compiler warns about returning a boolean when a different type is expected instead. Change the code to return NULL instead of false, fixing the following errors: ----------------------------------------------------------------------- ../src/gallium/drivers/crocus/crocus_program.c: In function ‘crocus_compile_vs’: ../src/gallium/drivers/crocus/crocus_program.c:1234:14: error: incompatible types when returning type ‘_Bool’ but ‘struct crocus_compiled_shader *’ was expected 1234 | return false; | ^~~~~ ../src/gallium/drivers/crocus/crocus_program.c: In function ‘crocus_compile_tcs’: ../src/gallium/drivers/crocus/crocus_program.c:1431:14: error: incompatible types when returning type ‘_Bool’ but ‘struct crocus_compiled_shader *’ was expected 1431 | return false; | ^~~~~ ../src/gallium/drivers/crocus/crocus_program.c: In function ‘crocus_compile_tes’: ../src/gallium/drivers/crocus/crocus_program.c:1576:14: error: incompatible types when returning type ‘_Bool’ but ‘struct crocus_compiled_shader *’ was expected 1576 | return false; | ^~~~~ ../src/gallium/drivers/crocus/crocus_program.c: In function ‘crocus_compile_gs’: ../src/gallium/drivers/crocus/crocus_program.c:1722:14: error: incompatible types when returning type ‘_Bool’ but ‘struct crocus_compiled_shader *’ was expected 1722 | return false; | ^~~~~ ../src/gallium/drivers/crocus/crocus_program.c: In function ‘crocus_compile_fs’: ../src/gallium/drivers/crocus/crocus_program.c:1862:14: error: incompatible types when returning type ‘_Bool’ but ‘struct crocus_compiled_shader *’ was expected 1862 | return false; | ^~~~~ ../src/gallium/drivers/crocus/crocus_program.c: In function ‘crocus_compile_clip’: ../src/gallium/drivers/crocus/crocus_program.c:2043:14: error: incompatible types when returning type ‘_Bool’ but ‘struct crocus_compiled_shader *’ was expected 2043 | return false; | ^~~~~ ../src/gallium/drivers/crocus/crocus_program.c: In function ‘crocus_compile_sf’: ../src/gallium/drivers/crocus/crocus_program.c:2197:14: error: incompatible types when returning type ‘_Bool’ but ‘struct crocus_compiled_shader *’ was expected 2197 | return false; | ^~~~~ ../src/gallium/drivers/crocus/crocus_program.c: In function ‘crocus_compile_ff_gs’: ../src/gallium/drivers/crocus/crocus_program.c:2290:14: error: incompatible types when returning type ‘_Bool’ but ‘struct crocus_compiled_shader *’ was expected 2290 | return false; | ^~~~~ ../src/gallium/drivers/crocus/crocus_program.c: In function ‘crocus_compile_cs’: ../src/gallium/drivers/crocus/crocus_program.c:2540:14: error: incompatible types when returning type ‘_Bool’ but ‘struct crocus_compiled_shader *’ was expected 2540 | return false; | ^~~~~ ----------------------------------------------------------------------- Reviewed-by: Faith Ekstrand Part-of: --- src/gallium/drivers/crocus/crocus_program.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/gallium/drivers/crocus/crocus_program.c b/src/gallium/drivers/crocus/crocus_program.c index 663296b2ef0..94eb5d61e07 100644 --- a/src/gallium/drivers/crocus/crocus_program.c +++ b/src/gallium/drivers/crocus/crocus_program.c @@ -1231,7 +1231,7 @@ crocus_compile_vs(struct crocus_context *ice, if (program == NULL) { dbg_printf("Failed to compile vertex shader: %s\n", params.base.error_str); ralloc_free(mem_ctx); - return false; + return NULL; } if (ish->compiled_once) { @@ -1428,7 +1428,7 @@ crocus_compile_tcs(struct crocus_context *ice, if (program == NULL) { dbg_printf("Failed to compile control shader: %s\n", params.base.error_str); ralloc_free(mem_ctx); - return false; + return NULL; } if (ish) { @@ -1573,7 +1573,7 @@ crocus_compile_tes(struct crocus_context *ice, if (program == NULL) { dbg_printf("Failed to compile evaluation shader: %s\n", params.base.error_str); ralloc_free(mem_ctx); - return false; + return NULL; } if (ish->compiled_once) { @@ -1719,7 +1719,7 @@ crocus_compile_gs(struct crocus_context *ice, if (program == NULL) { dbg_printf("Failed to compile geometry shader: %s\n", params.base.error_str); ralloc_free(mem_ctx); - return false; + return NULL; } if (ish->compiled_once) { @@ -1859,7 +1859,7 @@ crocus_compile_fs(struct crocus_context *ice, if (program == NULL) { dbg_printf("Failed to compile fragment shader: %s\n", params.base.error_str); ralloc_free(mem_ctx); - return false; + return NULL; } if (ish->compiled_once) { @@ -2040,7 +2040,7 @@ crocus_compile_clip(struct crocus_context *ice, struct elk_clip_prog_key *key) if (program == NULL) { dbg_printf("failed to compile clip shader\n"); ralloc_free(mem_ctx); - return false; + return NULL; } struct crocus_binding_table bt; memset(&bt, 0, sizeof(bt)); @@ -2194,7 +2194,7 @@ crocus_compile_sf(struct crocus_context *ice, struct elk_sf_prog_key *key) if (program == NULL) { dbg_printf("failed to compile sf shader\n"); ralloc_free(mem_ctx); - return false; + return NULL; } struct crocus_binding_table bt; @@ -2287,7 +2287,7 @@ crocus_compile_ff_gs(struct crocus_context *ice, struct elk_ff_gs_prog_key *key) if (program == NULL) { dbg_printf("failed to compile sf shader\n"); ralloc_free(mem_ctx); - return false; + return NULL; } struct crocus_binding_table bt; @@ -2537,7 +2537,7 @@ crocus_compile_cs(struct crocus_context *ice, if (program == NULL) { dbg_printf("Failed to compile compute shader: %s\n", params.base.error_str); ralloc_free(mem_ctx); - return false; + return NULL; } if (ish->compiled_once) {