diff --git a/src/header/bits_pthread/cbindgen.toml b/src/header/bits_pthread/cbindgen.toml index 34956c001217eb3c5da4b818a367d2f244d386b4..4843655919835842230c8276ae1c05848fb299d7 100644 --- a/src/header/bits_pthread/cbindgen.toml +++ b/src/header/bits_pthread/cbindgen.toml @@ -17,8 +17,8 @@ after_includes = """ void *arg; \ void *prev; \ } __relibc_internal_pthread_ll_entry = { \ - .routine = (routine), \ - .arg = (arg), \ + .routine = (void (*)(void *))(routine), \ + .arg = (void *)(arg), \ }; \ __relibc_internal_pthread_cleanup_push(&__relibc_internal_pthread_ll_entry); diff --git a/src/header/signal/mod.rs b/src/header/signal/mod.rs index a071ad7dafceee3e61d7d82bafd2f2237fddd26c..e56e67afb58cc486892c22489c7960a437b9b075 100644 --- a/src/header/signal/mod.rs +++ b/src/header/signal/mod.rs @@ -22,10 +22,10 @@ pub mod sys; type SigSet = BitSet<[c_ulong; 1]>; -pub const SIG_DFL: usize = 0; -pub const SIG_IGN: usize = 1; -pub const SIG_ERR: isize = -1; -pub const SIG_HOLD: isize = 2; +pub(crate) const SIG_DFL: usize = 0; +pub(crate) const SIG_IGN: usize = 1; +pub(crate) const SIG_ERR: isize = -1; +pub(crate) const SIG_HOLD: isize = 2; pub const SIG_BLOCK: c_int = 0; pub const SIG_UNBLOCK: c_int = 1; diff --git a/tests/Makefile b/tests/Makefile index b807168c14b25a352bd18539d22e773bc88d672a..efe462989d234c36110a3271702ece503d63d8fb 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -227,6 +227,7 @@ FLAGS=\ -fno-builtin \ -fno-stack-protector \ -Wall \ + -Werror \ -pedantic \ -g \ -I . diff --git a/tests/grp/getgrgid_r.c b/tests/grp/getgrgid_r.c index 5792848d72380c5dd6d27d21d79f5ade159d341d..ed2fea5dcc4ad7ffcd7b39185a562092f184cf9a 100644 --- a/tests/grp/getgrgid_r.c +++ b/tests/grp/getgrgid_r.c @@ -4,49 +4,39 @@ #include <string.h> #include <grp.h> -bool test_getgrgid(gid_t gid) { - struct group* out = getgrgid(gid); +void test_getgrgid(gid_t gid) { + struct group *out = getgrgid(gid); if (out == NULL) { - printf("Did not find a group %d", gid); - return false; + printf("Did not find a group %d\n", gid); + return; } printf("getgrgid\n"); - char* start = out->gr_name; - int len = strlen(out->gr_name); - printf(" %d = %s, GID: %d\n", gid, out->gr_name, out->gr_gid); - - return true; } -bool test_getgrgid_r(gid_t gid) { - char* buf[100]; +void test_getgrgid_r(gid_t gid) { + char buf[100]; struct group grp; - struct group* out = &grp; - struct group* tmp; + struct group *tmp; - int status = getgrgid_r(gid, out, buf, sizeof(buf), &tmp); + int status = getgrgid_r(gid, &grp, buf, sizeof(buf), &tmp); - if (out == NULL) { - printf("Did not find a group %d", gid); - return false; + if (tmp == NULL) { + const char *reason = status != 0 ? strerror(status) : "(not found)"; + printf("Did not find a group %d: %s\n", gid, reason); + return; } printf("getgrgid_r\n"); - char* start = grp.gr_name; - int len = strlen(grp.gr_name); - printf(" %d = %s, GID: %d\n", gid, grp.gr_name, grp.gr_gid); - - return true; } int main(void) { test_getgrgid(1050); test_getgrgid_r(1050); -} \ No newline at end of file +} diff --git a/tests/grp/getgrnam_r.c b/tests/grp/getgrnam_r.c index 2f0a3ac615d5514567542802c5300bd2b227d857..851b33461046570ce6dc408070a6c7bce84cf6c7 100644 --- a/tests/grp/getgrnam_r.c +++ b/tests/grp/getgrnam_r.c @@ -4,49 +4,39 @@ #include <string.h> #include <grp.h> -bool test_getgrnam(char* gr_name) { +void test_getgrnam(const char *gr_name) { struct group* out = getgrnam(gr_name); if (out == NULL) { printf("Did not find a group '%s'", gr_name); - return false; + return; } printf("getgrnam\n"); - char* start = out->gr_name; - int len = strlen(out->gr_name); - printf(" '%s' = %d\n", gr_name, out->gr_gid); - - return true; } -bool test_getgrnam_r(char* gr_name) { - char* buf[100]; +void test_getgrnam_r(const char *gr_name) { + char buf[100]; struct group grp; struct group* out = &grp; - struct group* tmp; - int status = getgrnam_r(gr_name, out, buf, sizeof(buf), &tmp); + int status = getgrnam_r(gr_name, &grp, buf, sizeof(buf), &out); if (out == NULL) { - printf("Did not find a group '%s'", gr_name); - return false; + const char *reason = (status != 0) ? strerror(status) : "(not found)"; + printf("Did not find a group %s: %s\n", gr_name, reason); + return; } printf("getgrnam_r\n"); - char* start = grp.gr_name; - int len = strlen(grp.gr_name); - printf(" '%s' = %d\n", gr_name, out->gr_gid); - - return true; } int main(void) { test_getgrnam("lcake"); test_getgrnam_r("lcake"); -} \ No newline at end of file +} diff --git a/tests/pthread/cleanup.c b/tests/pthread/cleanup.c index 446e946cf9605895d94c318e183074821d29aadb..87ef61aad04616cd5c1e7c5801fe92bc71a8d16d 100644 --- a/tests/pthread/cleanup.c +++ b/tests/pthread/cleanup.c @@ -34,6 +34,7 @@ void *routine(void *arg) { puts("6"); pthread_cleanup_pop(true); pthread_cleanup_pop(true); + return NULL; } int main(void) { diff --git a/tests/pwd.c b/tests/pwd.c index 13761aae923417251326c17b5804057021068a9f..7d3942d930534255d53c20e9cb49e11b0962db60 100644 --- a/tests/pwd.c +++ b/tests/pwd.c @@ -85,7 +85,7 @@ int main(void) { errno = 0; struct passwd *entry = NULL; - for (int i = 1; entry = getpwent(); ++i) { + for (int i = 1; (entry = getpwent()); ++i) { int backup = errno; printf("--- getpwent #%d ---\n", i); if (backup != 0) { diff --git a/tests/stdio/getline.c b/tests/stdio/getline.c index 299265fcf6f5b46fd2f267e3233dec3974ad3fcf..87a0fabca6d9d26ffe5cdb7684823d48b793ad24 100644 --- a/tests/stdio/getline.c +++ b/tests/stdio/getline.c @@ -66,6 +66,7 @@ void test_null_args() { free(lineptr); \ stream = NULL; \ errno = 0; \ + (void)n; \ } while (0); static size_t counter = 0;