From fb6b3bee251061980121144f36366a9aaf05afab Mon Sep 17 00:00:00 2001 From: Yonggang Luo Date: Fri, 4 Nov 2022 21:03:08 +0800 Subject: [PATCH] loader: fixes -Werror,-Wdeprecated-non-prototype for clang-15 in pipe-loader There are multiple error messages, show one of them: ../../src/gallium/auxiliary/pipe-loader/pipe_loader_sw.c:219:54: error: passing arguments to a function without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype] sdev->ws = sdev->dd->winsys[i].create_winsys(drisw_lf); ^ Signed-off-by: Yonggang Luo Reviewed-by: Jesse Natalie Part-of: --- .../auxiliary/pipe-loader/pipe_loader_sw.c | 20 +++++++++---------- src/gallium/include/frontend/sw_driver.h | 8 +++++++- src/gallium/targets/pipe-loader/pipe_swrast.c | 6 +++--- 3 files changed, 20 insertions(+), 14 deletions(-) diff --git a/src/gallium/auxiliary/pipe-loader/pipe_loader_sw.c b/src/gallium/auxiliary/pipe-loader/pipe_loader_sw.c index 12bc7930557..75a247d43d1 100644 --- a/src/gallium/auxiliary/pipe-loader/pipe_loader_sw.c +++ b/src/gallium/auxiliary/pipe-loader/pipe_loader_sw.c @@ -69,13 +69,13 @@ static const struct sw_driver_descriptor driver_descriptors = { #ifdef HAVE_DRI { .name = "dri", - .create_winsys = dri_create_sw_winsys, + .create_winsys_dri = dri_create_sw_winsys, }, #endif #ifdef HAVE_DRISW_KMS { .name = "kms_dri", - .create_winsys = kms_dri_create_winsys, + .create_winsys_kms_dri = kms_dri_create_winsys, }, #endif #ifndef __ANDROID__ @@ -85,7 +85,7 @@ static const struct sw_driver_descriptor driver_descriptors = { }, { .name = "wrapped", - .create_winsys = wrapper_sw_winsys_wrap_pipe_screen, + .create_winsys_wrapped = wrapper_sw_winsys_wrap_pipe_screen, }, #endif { 0 }, @@ -99,12 +99,12 @@ static const struct sw_driver_descriptor kopper_driver_descriptors = { .winsys = { { .name = "dri", - .create_winsys = dri_create_sw_winsys, + .create_winsys_dri = dri_create_sw_winsys, }, #ifdef HAVE_DRISW_KMS { .name = "kms_dri", - .create_winsys = kms_dri_create_winsys, + .create_winsys_kms_dri = kms_dri_create_winsys, }, #endif #ifndef __ANDROID__ @@ -114,7 +114,7 @@ static const struct sw_driver_descriptor kopper_driver_descriptors = { }, { .name = "wrapped", - .create_winsys = wrapper_sw_winsys_wrap_pipe_screen, + .create_winsys_wrapped = wrapper_sw_winsys_wrap_pipe_screen, }, #endif { 0 }, @@ -216,7 +216,7 @@ pipe_loader_sw_probe_dri(struct pipe_loader_device **devs, const struct drisw_lo for (i = 0; sdev->dd->winsys[i].name; i++) { if (strcmp(sdev->dd->winsys[i].name, "dri") == 0) { - sdev->ws = sdev->dd->winsys[i].create_winsys(drisw_lf); + sdev->ws = sdev->dd->winsys[i].create_winsys_dri(drisw_lf); break; } } @@ -246,7 +246,7 @@ pipe_loader_vk_probe_dri(struct pipe_loader_device **devs, const struct drisw_lo for (i = 0; sdev->dd->winsys[i].name; i++) { if (strcmp(sdev->dd->winsys[i].name, "dri") == 0) { - sdev->ws = sdev->dd->winsys[i].create_winsys(drisw_lf); + sdev->ws = sdev->dd->winsys[i].create_winsys_dri(drisw_lf); break; } } @@ -282,7 +282,7 @@ pipe_loader_sw_probe_kms(struct pipe_loader_device **devs, int fd) for (i = 0; sdev->dd->winsys[i].name; i++) { if (strcmp(sdev->dd->winsys[i].name, "kms_dri") == 0) { - sdev->ws = sdev->dd->winsys[i].create_winsys(sdev->fd); + sdev->ws = sdev->dd->winsys[i].create_winsys_kms_dri(sdev->fd); break; } } @@ -360,7 +360,7 @@ pipe_loader_sw_probe_wrapped(struct pipe_loader_device **dev, for (i = 0; sdev->dd->winsys[i].name; i++) { if (strcmp(sdev->dd->winsys[i].name, "wrapped") == 0) { - sdev->ws = sdev->dd->winsys[i].create_winsys(screen); + sdev->ws = sdev->dd->winsys[i].create_winsys_wrapped(screen); break; } } diff --git a/src/gallium/include/frontend/sw_driver.h b/src/gallium/include/frontend/sw_driver.h index d2cb33845f2..6223ff9f0ef 100644 --- a/src/gallium/include/frontend/sw_driver.h +++ b/src/gallium/include/frontend/sw_driver.h @@ -6,13 +6,19 @@ struct pipe_screen; struct sw_winsys; +struct drisw_loader_funcs; struct sw_driver_descriptor { struct pipe_screen *(*create_screen)(struct sw_winsys *ws, const struct pipe_screen_config *config, bool sw_vk); struct { const char * const name; - struct sw_winsys *(*create_winsys)(); + union { + struct sw_winsys *(*create_winsys)(); + struct sw_winsys *(*create_winsys_wrapped)(struct pipe_screen *screen); + struct sw_winsys *(*create_winsys_dri)(const struct drisw_loader_funcs *lf); + struct sw_winsys *(*create_winsys_kms_dri)(int fd); + }; } winsys[]; }; diff --git a/src/gallium/targets/pipe-loader/pipe_swrast.c b/src/gallium/targets/pipe-loader/pipe_swrast.c index bb353b1913a..583dc3ad705 100644 --- a/src/gallium/targets/pipe-loader/pipe_swrast.c +++ b/src/gallium/targets/pipe-loader/pipe_swrast.c @@ -29,13 +29,13 @@ const struct sw_driver_descriptor swrast_driver_descriptor = { #ifdef HAVE_DRI { .name = "dri", - .create_winsys = dri_create_sw_winsys, + .create_winsys_dri = dri_create_sw_winsys, }, #endif #ifdef HAVE_DRISW_KMS { .name = "kms_dri", - .create_winsys = kms_dri_create_winsys, + .create_winsys_kms_dri = kms_dri_create_winsys, }, #endif { @@ -44,7 +44,7 @@ const struct sw_driver_descriptor swrast_driver_descriptor = { }, { .name = "wrapped", - .create_winsys = wrapper_sw_winsys_wrap_pipe_screen, + .create_winsys_wrapped = wrapper_sw_winsys_wrap_pipe_screen, }, { 0 }, }