Skip to content

Build fails when compiling with -Wincompatible-pointer-types (GCC 15) #6

@heijligen

Description

@heijligen

when compiling why3 as part of spark2014 the build fails when compiling with -Wincompatible-pointer-types.

spark2014 branch: fsf-15
gcc/gnat: 15.1.0
OS: Linux / NixOS unstable

gnatprove> src/server/cpulimit-unix.c: In function 'main':
gnatprove> src/server/cpulimit-unix.c:95:23: error: assignment to '__sighandler_t' {aka 'void (*)(int)'} from incompatible pointer type 'void (*)(void)' [-Wincompatible-pointer-types]
gnatprove>    95 |         sa.sa_handler = &wallclock_timelimit_reached;
gnatprove>       |                       ^
gnatprove> src/server/cpulimit-unix.c:45:6: note: 'wallclock_timelimit_reached' declared here
gnatprove>    45 | void wallclock_timelimit_reached() {
gnatprove>       |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~
gnatprove> In file included from src/server/cpulimit-unix.c:22:
gnatprove> /nix/store/r25srliigrrv5q3n7y8ms6z10spvjcd9-glibc-2.40-66-dev/include/signal.h:72:16: note: '__sighandler_t' declared here
gnatprove>    72 | typedef void (*__sighandler_t) (int);
gnatprove>       |                ^~~~~~~~~~~~~~
gnatprove> Ocamlopt src/util/cmdline.ml
gnatprove> make[1]: *** [Makefile:810: src/server/cpulimit-unix.o] Error 1

This could be fixed with:

diff --git a/src/server/cpulimit-unix.c b/src/server/cpulimit-unix.c
index 1cf8880ee..079bb4efd 100644
--- a/src/server/cpulimit-unix.c
+++ b/src/server/cpulimit-unix.c
@@ -42,7 +42,7 @@ void show_time() {
   }
 }
 
-void wallclock_timelimit_reached() {
+void wallclock_timelimit_reached(int unused) {
   fprintf(stderr,
           "Why3cpulimit: wallclock timelimit %d reached, killing command\n",
           wallclock_timelimit);

Sorry for only creating an issue not not directly a pull request. Building or testing spark2014 master is not possible for me

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