Skip to content

Commit 7c25591

Browse files
committed
Fix errors: passing argument 2 of ‘signal’ from incompatible pointer 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]>
1 parent 2c29fe3 commit 7c25591

File tree

9 files changed

+9
-9
lines changed

9 files changed

+9
-9
lines changed

UnixBench/src/arith.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ int dumb_stuff(int);
3838
volatile unsigned long iter;
3939

4040
/* this function is called when the alarm expires */
41-
void report()
41+
void report(int sig)
4242
{
4343
fprintf(stderr,"COUNT|%ld|1|lps\n", iter);
4444
exit(0);

UnixBench/src/context1.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ char SCCSid[] = "@(#) @(#)context1.c:3.3 -- 5/15/91 19:30:18";
3131

3232
unsigned long iter;
3333

34-
void report()
34+
void report(int sig)
3535
{
3636
fprintf(stderr, "COUNT|%lu|1|lps\n", iter);
3737
exit(0);

UnixBench/src/dhry_1.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ char SCCSid[] = "@(#) @(#)dhry_1.c:3.4 -- 5/15/91 19:30:21";
4242

4343
unsigned long Run_Index;
4444

45-
void report()
45+
void report(int sig)
4646
{
4747
fprintf(stderr,"COUNT|%ld|1|lps\n", Run_Index);
4848
exit(0);

UnixBench/src/hanoi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ unsigned long iter = 0;
3030
int num[4];
3131
long cnt;
3232

33-
void report()
33+
void report(int sig)
3434
{
3535
fprintf(stderr,"COUNT|%ld|1|lps\n", iter);
3636
exit(0);

UnixBench/src/looper.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ unsigned long iter;
3131
char *cmd_argv[28];
3232
int cmd_argc;
3333

34-
void report(void)
34+
void report(int sig)
3535
{
3636
fprintf(stderr,"COUNT|%lu|60|lpm\n", iter);
3737
exit(0);

UnixBench/src/pipe.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ char SCCSid[] = "@(#) @(#)pipe.c:3.3 -- 5/15/91 19:30:20";
2929

3030
unsigned long iter;
3131

32-
void report()
32+
void report(int sig)
3333
{
3434
fprintf(stderr,"COUNT|%ld|1|lps\n", iter);
3535
exit(0);

UnixBench/src/spawn.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ char SCCSid[] = "@(#) @(#)spawn.c:3.3 -- 5/15/91 19:30:20";
2929

3030
unsigned long iter;
3131

32-
void report()
32+
void report(int sig)
3333
{
3434
fprintf(stderr,"COUNT|%lu|1|lps\n", iter);
3535
exit(0);

UnixBench/src/syscall.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ char SCCSid[] = "@(#) @(#)syscall.c:3.3 -- 5/15/91 19:30:21";
3434

3535
unsigned long iter;
3636

37-
void report()
37+
void report(int sig)
3838
{
3939
fprintf(stderr,"COUNT|%ld|1|lps\n", iter);
4040
exit(0);

UnixBench/src/timeit.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
void wake_me(seconds, func)
3333
int seconds;
34-
void (*func)();
34+
void (*func)(int);
3535
{
3636
/* set up the signal handler */
3737
signal(SIGALRM, func);

0 commit comments

Comments
 (0)