Now that sig2str and str2sig are a part of POSIX we should add signature checks so we can find out if they are incorrect on any platforms.
Done through the attached patch. Collin
>From bf6f7d8a81f231b14ab50194a46bbcbca21835b1 Mon Sep 17 00:00:00 2001 From: Collin Funk <collin.fu...@gmail.com> Date: Sun, 29 Dec 2024 11:30:59 -0800 Subject: [PATCH] sig2str tests: Add signature check. * modules/sig2str-tests (Files): Add tests/signature.h. * tests/test-sig2str.c: Include signal.h instead of sig2str.h. Check the function signature of sig2str and str2sig. --- ChangeLog | 7 +++++++ modules/sig2str-tests | 1 + tests/test-sig2str.c | 6 +++++- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 19c49c449b..8fcb0f9a46 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2024-12-29 Collin Funk <collin.fu...@gmail.com> + + sig2str tests: Add signature check. + * modules/sig2str-tests (Files): Add tests/signature.h. + * tests/test-sig2str.c: Include signal.h instead of sig2str.h. Check the + function signature of sig2str and str2sig. + 2024-12-29 Bruno Haible <br...@clisp.org> doc: Document the modules for containers. diff --git a/modules/sig2str-tests b/modules/sig2str-tests index c995f1474a..73d59eb6f7 100644 --- a/modules/sig2str-tests +++ b/modules/sig2str-tests @@ -1,5 +1,6 @@ Files: tests/test-sig2str.c +tests/signature.h tests/macros.h Depends-on: diff --git a/tests/test-sig2str.c b/tests/test-sig2str.c index 6093af0474..53edc63fbb 100644 --- a/tests/test-sig2str.c +++ b/tests/test-sig2str.c @@ -19,7 +19,11 @@ #include <config.h> /* Specification. */ -#include "sig2str.h" +#include <signal.h> + +#include "signature.h" +SIGNATURE_CHECK (sig2str, int, (int, char *)); +SIGNATURE_CHECK (str2sig, int, (char const *restrict, int *restrict)); #include <string.h> -- 2.47.1