diff mbox series

wired: fix -std=c23 build failure

Message ID 20241119222846.784719-1-slyich@gmail.com (mailing list archive)
State Accepted, archived
Headers show
Series wired: fix -std=c23 build failure | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
prestwoj/iwd-alpine-ci-fetch success Fetch PR
prestwoj/iwd-ci-gitlint fail wired: fix -std=c23 build failure 5: B1 Line exceeds max length (94>80): " https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=55e3bd376b2214e200fa76d12b67ff259b06c212" 22: B1 Line exceeds max length (88>80): " 33 | void *user_data, l_io_destroy_cb_t destroy);" 23: B1 Line exceeds max length (86>80): " | ~~~~~~~~~~~~~~~~~~^~~~~~~"
prestwoj/iwd-ci-fetch success Fetch PR
prestwoj/iwd-alpine-ci-setupell success Prep - Setup ELL
prestwoj/iwd-ci-setupell success Prep - Setup ELL
prestwoj/iwd-ci-makedistcheck success Make Distcheck
prestwoj/iwd-ci-incremental_build success Incremental build not run PASS
prestwoj/iwd-alpine-ci-makedistcheck success Make Distcheck
prestwoj/iwd-alpine-ci-incremental_build success Incremental build not run PASS
prestwoj/iwd-ci-build success Build - Configure
prestwoj/iwd-alpine-ci-build success Build - Configure
prestwoj/iwd-ci-makecheckvalgrind success Make Check w/Valgrind
prestwoj/iwd-ci-clang success clang PASS
prestwoj/iwd-ci-makecheck success Make Check
prestwoj/iwd-alpine-ci-makecheckvalgrind success Make Check w/Valgrind
prestwoj/iwd-alpine-ci-makecheck success Make Check
prestwoj/iwd-ci-testrunner success test-runner PASS

Commit Message

Sergei Trofimovich Nov. 19, 2024, 10:28 p.m. UTC
gcc-15 switched to -std=c23 by default:

    https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=55e3bd376b2214e200fa76d12b67ff259b06c212

As a result `iwd` fails the build as:

    wired/ethdev.c: In function 'pae_open':
    wired/ethdev.c:340:55:
      error: passing argument 4 of 'l_io_set_read_handler'
        from incompatible pointer type [-Wincompatible-pointer-types]
      340 |         l_io_set_read_handler(pae_io, pae_read, NULL, pae_destroy);
          |                                                       ^~~~~~~~~~~
          |                                                       |
          |                                                       void (*)(void)
    In file included from ...-ell-0.70-dev/include/ell/ell.h:19,
                     from wired/ethdev.c:38:
    ...-ell-0.70-dev/include/ell/io.h:33:68:
      note: expected 'l_io_destroy_cb_t' {aka 'void (*)(void *)'}
        but argument is of type 'void (*)(void)'
       33 |                                 void *user_data, l_io_destroy_cb_t destroy);
          |                                                  ~~~~~~~~~~~~~~~~~~^~~~~~~

C23 changed the meaning of `void (*)()` from partially defined prototype
to `void (*)(void)`.
---
 wired/ethdev.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Denis Kenzior Nov. 20, 2024, 5:36 p.m. UTC | #1
Hi Sergei,

On 11/19/24 4:28 PM, Sergei Trofimovich wrote:
> gcc-15 switched to -std=c23 by default:
> 
>      https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=55e3bd376b2214e200fa76d12b67ff259b06c212
> 
> As a result `iwd` fails the build as:
> 
>      wired/ethdev.c: In function 'pae_open':
>      wired/ethdev.c:340:55:
>        error: passing argument 4 of 'l_io_set_read_handler'
>          from incompatible pointer type [-Wincompatible-pointer-types]
>        340 |         l_io_set_read_handler(pae_io, pae_read, NULL, pae_destroy);
>            |                                                       ^~~~~~~~~~~
>            |                                                       |
>            |                                                       void (*)(void)
>      In file included from ...-ell-0.70-dev/include/ell/ell.h:19,
>                       from wired/ethdev.c:38:
>      ...-ell-0.70-dev/include/ell/io.h:33:68:
>        note: expected 'l_io_destroy_cb_t' {aka 'void (*)(void *)'}
>          but argument is of type 'void (*)(void)'
>         33 |                                 void *user_data, l_io_destroy_cb_t destroy);
>            |                                                  ~~~~~~~~~~~~~~~~~~^~~~~~~
> 
> C23 changed the meaning of `void (*)()` from partially defined prototype
> to `void (*)(void)`.
> ---
>   wired/ethdev.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 

Applied, thanks.

Regards,
-Denis
diff mbox series

Patch

diff --git a/wired/ethdev.c b/wired/ethdev.c
index a933cc18..ed128006 100644
--- a/wired/ethdev.c
+++ b/wired/ethdev.c
@@ -312,8 +312,9 @@  static bool pae_read(struct l_io *io, void *user_data)
 	return true;
 }
 
-static void pae_destroy()
+static void pae_destroy(void * user_data)
 {
+	(void)user_data;
 	pae_io = NULL;
 }