crocus: fix returning _Bool instead of pointer

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🔢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 <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36323>
This commit is contained in:
Antonio Ospite 2025-07-23 09:47:14 +02:00 committed by Marge Bot
parent 8825bf9b48
commit 51a5926f66

View file

@ -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) {