Skip to content

Build failure with GCC 15 (incompatible pointer types) #5857

Open
@orlitzky

Description

Original report: https://bugs.gentoo.org/944036

GCC 15 has -Werror=incompatible-pointer-types and std=gnu23 by default, and this is causing some issues with the function pointers that GAP passes around. For example,

src/bool.c: In function 'InitKernel':
src/bool.c:332:22: error: passing argument 1 of 'InitHandlerFunc' from incompatible pointer type [-Wincompatible-pointer-types]
  332 |     InitHandlerFunc( ReturnTrue1, "src/bool.c:ReturnTrue1" );
      |                      ^~~~~~~~~~~
      |                      |
      |                      struct OpaqueBag * (*)(struct OpaqueBag *, struct OpaqueBag *)
In file included from src/bool.c:20:
src/calls.h:416:30: note: expected 'ObjFunc' {aka 'struct OpaqueBag * (*)(void)'} but argument is of type 'struct OpaqueBag * (*)(struct OpaqueBag *, struct OpaqueBag *)'
  416 | void InitHandlerFunc(ObjFunc hdlr, const Char * cookie);

(and many others like it).

After investigating the same issue in cvec, it looks like the issue can be traced back to the ObjFunc typedef. In C23, foo() means that foo takes zero arguments, so a cast is needed if you want to pass in a function that takes arguments in place of such a foo().

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