Skip to content

Conversation

Lzeyuan
Copy link

@Lzeyuan Lzeyuan commented Aug 24, 2025

I encountered an error when compiling a project using make on Fedora 42, as follows:

multithreading.c:85:29: error: passing argument 2 of ‘signal’ from incompatible pointer type [-Wincompatible-pointer-types]
   85 |         if (signal(SIGALRM, timer_fired) == SIG_ERR) {
      |                             ^~~~~~~~~~~
      |                             |
      |                             void (*)(void)

The prototype of the signal function is sighandler_t signal(int signum, sighandler_t handler);
And typedef typeof(void (int)) *sighandler_t;

Compiling normally under Ubuntu 24. I think the reason under Ubuntu may be due to the loose warning policy - but this does not mean the behavior is correct, so I added an int parameter.

Copy link

@kalvdans kalvdans left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could mark it static as well since it is internal to this file.

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