Skip to content

build: error: passing argument 2 of ‘signal’ from incompatible pointer type #118

@ektor5

Description

@ektor5

Description

Build error when running ./Run

Environment

Tested on Debian Sid and Arch Linux

% gcc --version
gcc (GCC) 15.2.1 20250813

Log

% ./Run 
cc -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);
      |                ^~~~~~~~~~~~~~
src/arith.c: In function ‘main’:
src/arith.c:47:5: warning: old-style function definition [-Wold-style-definition]
   47 | int main(argc, argv)
      |     ^~~~
src/arith.c: In function ‘dumb_stuff’:
src/arith.c:84:5: warning: old-style function definition [-Wold-style-definition]
   84 | int dumb_stuff(i)
      |     ^~~~~~~~~~
make: *** [Makefile:235: pgms/arithoh] Error 1
make distr
make[1]: Entering directory '/home/ektor5/byte-unixbench/UnixBench'
Checking distribution of files
./pgms  exists
./src  exists
./testdir  exists
./tmp  exists
./results  exists
make[1]: Leaving directory '/home/ektor5/byte-unixbench/UnixBench'
make programs
make[1]: Entering directory '/home/ektor5/byte-unixbench/UnixBench'
cc -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);
      |                ^~~~~~~~~~~~~~
src/arith.c: In function ‘main’:
src/arith.c:47:5: warning: old-style function definition [-Wold-style-definition]
   47 | int main(argc, argv)
      |     ^~~~
src/arith.c: In function ‘dumb_stuff’:
src/arith.c:84:5: warning: old-style function definition [-Wold-style-definition]
   84 | int dumb_stuff(i)
      |     ^~~~~~~~~~
make[1]: *** [Makefile:235: pgms/arithoh] Error 1
make[1]: Leaving directory '/home/ektor5/byte-unixbench/UnixBench'
make: *** [Makefile:176: all] Error 2

**********************************************
Run: "make all" failed; aborting

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions