Skip to content

Build failure with -std=gnu23 (GCC 15 default) #420

@thesamesam

Description

@thesamesam

When building with GCC trunk which now defaults to -std=gnu23, I get the following:

/bin/sh ../../libtool  --mode=compile x86_64-pc-linux-gnu-gcc -c -I../../include -I../.. -I. -I. -DLIBDIR=\"/usr/lib64\" -DLOCALEDIR=\"/usr/share/locale\" -D_PATH_SUDOERS=\"/etc/sudoers\" -D_PATH_CVTSUDOERS_CONF=\"/etc/cvtsudoers.conf\" -DSUDOERS_UID=0 -DSUDOERS_GID=0 -DSUDOERS_MODE=0440 -DZLIB_CONST -march=native -O3 -pipe  -flto=jobserver -Warray-bounds -fdiagnostics-details -Wstringop-overread -Wstringop-overflow -Wstringop-truncation -fvisibility=hidden  -fPIE  ./policy.c
./policy.c:1361:44: error: initialization of 'int (*)(void)' from incompatible pointer type 'int (*)(const char *, const char *, int,  void *)' [-Wincompatible-pointer-types]
 1361 |     { SUDO_HOOK_VERSION, SUDO_HOOK_SETENV, sudoers_hook_setenv, NULL },
      |                                            ^~~~~~~~~~~~~~~~~~~
./policy.c:1361:44: note: (near initialization for 'sudoers_hooks[0].hook_fn')
./policy.c:1362:46: error: initialization of 'int (*)(void)' from incompatible pointer type 'int (*)(const char *, void *)' [-Wincompatible-pointer-types]
 1362 |     { SUDO_HOOK_VERSION, SUDO_HOOK_UNSETENV, sudoers_hook_unsetenv, NULL },
      |                                              ^~~~~~~~~~~~~~~~~~~~~
./policy.c:1362:46: note: (near initialization for 'sudoers_hooks[1].hook_fn')
./policy.c:1363:44: error: initialization of 'int (*)(void)' from incompatible pointer type 'int (*)(const char *, char **, void *)' [-Wincompatible-pointer-types]
 1363 |     { SUDO_HOOK_VERSION, SUDO_HOOK_GETENV, sudoers_hook_getenv, NULL },
      |                                            ^~~~~~~~~~~~~~~~~~~
./policy.c:1363:44: note: (near initialization for 'sudoers_hooks[2].hook_fn')
./policy.c:1364:44: error: initialization of 'int (*)(void)' from incompatible pointer type 'int (*)(char *, void *)' [-Wincompatible-pointer-types]
 1364 |     { SUDO_HOOK_VERSION, SUDO_HOOK_PUTENV, sudoers_hook_putenv, NULL },
      |                                            ^~~~~~~~~~~~~~~~~~~
./policy.c:1364:44: note: (near initialization for 'sudoers_hooks[3].hook_fn')

C23 removes unprototyped functions and foo() starts to mean foo(void).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions