Skip to content

Commit

Permalink
PORT: Make cmake test for signal handler compatible with c23
Browse files Browse the repository at this point in the history
  • Loading branch information
JanWielemaker committed Dec 3, 2024
1 parent a3601d6 commit 6de08cb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cmake/TestSignalType.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
# undef signal
#endif
#ifdef __cplusplus
extern "C" void (*signal (int, void (*)(int)))(int);
extern "C"
#else

This comment has been minimized.

Copy link
@dgelessus

dgelessus Dec 3, 2024

Contributor

This line should be #endif instead of #else (and the #endif 2 lines below should be removed), right? The way this is written now, in C++ mode, the code ends up becoming extern "C" int main(...) ... with no declaration of signal at all. I assume that's not the intended meaning.

This comment has been minimized.

Copy link
@JanWielemaker

JanWielemaker Dec 3, 2024

Author Member

Oops. It does not really matter as the test is executed in C, but still ... Thanks for spotting. Fixed with b63acef (fingers crossed)

void (*signal ()) ();
void ( *signal(int signum, void (*handler)(int)) ) (int);
#endif

int
main ()
main(int argc, char **argv)
{
return 0;
}
10 changes: 10 additions & 0 deletions scripts/configure
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,16 @@ case $config in
;;
esac

# c23
#
# Enable C23 mode

case $config in
*c23*)
CFLAGS+=" -std=gnu23"
;;
esac

# test
#
# Install the tests along with the executable. Allows running the
Expand Down

0 comments on commit 6de08cb

Please sign in to comment.