Skip to content

Conversation

@Rtoax
Copy link
Contributor

@Rtoax Rtoax commented Jun 20, 2025

Fix compile errors on Fedora 42

For example:

$ ./Run -c 1 dhry2reg whetstone-double
gcc -o pgms/arithoh -Wall -pedantic -O3 -ffast-math -march=native -mtune=native -I ./src -DTIME -Darithoh src/arith.c
In file included from src/arith.c:34:
src/timeit.c: In function ‘wake_me’:
src/timeit.c:32:6: warning: old-style function definition [-Wold-style-definition]
   32 | void wake_me(seconds, func)
      |      ^~~~~~~
src/timeit.c:37:25: error: passing argument 2 of ‘signal’ from incompatible pointer type [-Wincompatible-pointer-types]
   37 |         signal(SIGALRM, func);
      |                         ^~~~
      |                         |
      |                         void (*)(void)
In file included from src/timeit.c:29:
/usr/include/signal.h:88:57: note: expected ‘__sighandler_t’ {aka ‘void (*)(int)’} but argument is of type ‘void (*)(void)’
   88 | extern __sighandler_t signal (int __sig, __sighandler_t __handler)
      |                                          ~~~~~~~~~~~~~~~^~~~~~~~~
/usr/include/signal.h:72:16: note: ‘__sighandler_t’ declared here
   72 | typedef void (*__sighandler_t) (int);
      |                ^~~~~~~~~~~~~~

…type

For example:

    $ ./Run -c 1 dhry2reg whetstone-double
    gcc -o pgms/arithoh -Wall -pedantic -O3 -ffast-math -march=native -mtune=native -I ./src -DTIME -Darithoh src/arith.c
    In file included from src/arith.c:34:
    src/timeit.c: In function ‘wake_me’:
    src/timeit.c:32:6: warning: old-style function definition [-Wold-style-definition]
       32 | void wake_me(seconds, func)
          |      ^~~~~~~
    src/timeit.c:37:25: error: passing argument 2 of ‘signal’ from incompatible pointer type [-Wincompatible-pointer-types]
       37 |         signal(SIGALRM, func);
          |                         ^~~~
          |                         |
          |                         void (*)(void)
    In file included from src/timeit.c:29:
    /usr/include/signal.h:88:57: note: expected ‘__sighandler_t’ {aka ‘void (*)(int)’} but argument is of type ‘void (*)(void)’
       88 | extern __sighandler_t signal (int __sig, __sighandler_t __handler)
          |                                          ~~~~~~~~~~~~~~~^~~~~~~~~
    /usr/include/signal.h:72:16: note: ‘__sighandler_t’ declared here
       72 | typedef void (*__sighandler_t) (int);
          |                ^~~~~~~~~~~~~~

Signed-off-by: Rong Tao <[email protected]>
@loreb
Copy link

loreb commented Oct 11, 2025

It's not just fedora, it's anything with gcc >= 15 (I think); make CC='gcc -std=gnu99' or similar is a quick&dirty workaround

@Rtoax Rtoax closed this Oct 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants