mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-28 00:02:28 +00:00
Fix warnings
This change fixes Cosmopolitan so it has fewer opinions about compiler warnings. The whole repository had to be cleaned up to be buildable in -Werror -Wall mode. This lets us benefit from things like strict const checking. Some actual bugs might have been caught too.
This commit is contained in:
parent
e2b3c3618e
commit
0d748ad58e
571 changed files with 1306 additions and 1888 deletions
|
@ -68,7 +68,6 @@ TEST(pthread_cancel, self_deferred_waitsForCancellationPoint) {
|
|||
}
|
||||
|
||||
void *Worker(void *arg) {
|
||||
int n;
|
||||
char buf[8];
|
||||
pthread_cleanup_push(OnCleanup, 0);
|
||||
read(pfds[0], buf, sizeof(buf));
|
||||
|
@ -224,8 +223,10 @@ void *CpuBoundWorker(void *arg) {
|
|||
CheckStackIsAligned();
|
||||
wouldleak = malloc(123);
|
||||
wontleak1 = malloc(123);
|
||||
(void)wontleak1;
|
||||
pthread_cleanup_push(free, wontleak1);
|
||||
wontleak2 = _gc(malloc(123));
|
||||
(void)wontleak2;
|
||||
ASSERT_EQ(0, pthread_setspecific(key, (void *)31337));
|
||||
ASSERT_EQ(0, pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, 0));
|
||||
#ifdef __x86_64__
|
||||
|
@ -262,7 +263,6 @@ TEST(pthread_cancel, async) {
|
|||
}
|
||||
|
||||
void *CancelSelfWorkerAsync(void *arg) {
|
||||
char buf[8];
|
||||
pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, 0);
|
||||
pthread_cleanup_push(OnCleanup, 0);
|
||||
pthread_cancel(pthread_self());
|
||||
|
|
|
@ -40,7 +40,6 @@
|
|||
#include "libc/thread/thread2.h"
|
||||
|
||||
void OnUsr1(int sig, struct siginfo *si, void *vctx) {
|
||||
struct ucontext *ctx = vctx;
|
||||
}
|
||||
|
||||
void SetUp(void) {
|
||||
|
@ -83,7 +82,7 @@ TEST(pthread_create, testCreateExitJoin) {
|
|||
}
|
||||
|
||||
static void *CheckSchedule(void *arg) {
|
||||
int rc, policy;
|
||||
int policy;
|
||||
struct sched_param prio;
|
||||
ASSERT_EQ(0, pthread_getschedparam(pthread_self(), &policy, &prio));
|
||||
ASSERT_EQ(SCHED_OTHER, policy);
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
#include "libc/thread/thread.h"
|
||||
|
||||
void OnUsr1(int sig, struct siginfo *si, void *vctx) {
|
||||
struct ucontext *ctx = vctx;
|
||||
}
|
||||
|
||||
void SetUp(void) {
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/calls/calls.h"
|
||||
#include "libc/calls/struct/sigaction.h"
|
||||
#include "libc/calls/struct/timespec.h"
|
||||
#include "libc/dce.h"
|
||||
#include "libc/errno.h"
|
||||
|
@ -44,54 +45,53 @@ TEST(sem_init, einval) {
|
|||
|
||||
TEST(sem_post, afterDestroyed_isUndefinedBehavior) {
|
||||
if (!IsModeDbg()) return;
|
||||
int val;
|
||||
sem_t sem;
|
||||
SPAWN(fork);
|
||||
signal(SIGABRT, SIG_DFL);
|
||||
ASSERT_SYS(0, 0, sem_init(&sem, 0, 0));
|
||||
ASSERT_SYS(0, 0, sem_destroy(&sem));
|
||||
IgnoreStderr();
|
||||
sem_post(&sem);
|
||||
EXITS(128 + SIGABRT); // see __assert_fail
|
||||
TERMS(SIGABRT);
|
||||
}
|
||||
|
||||
TEST(sem_trywait, afterDestroyed_isUndefinedBehavior) {
|
||||
if (!IsModeDbg()) return;
|
||||
int val;
|
||||
sem_t sem;
|
||||
SPAWN(fork);
|
||||
signal(SIGABRT, SIG_DFL);
|
||||
ASSERT_SYS(0, 0, sem_init(&sem, 0, 0));
|
||||
ASSERT_SYS(0, 0, sem_destroy(&sem));
|
||||
IgnoreStderr();
|
||||
sem_trywait(&sem);
|
||||
EXITS(128 + SIGABRT); // see __assert_fail
|
||||
TERMS(SIGABRT);
|
||||
}
|
||||
|
||||
TEST(sem_wait, afterDestroyed_isUndefinedBehavior) {
|
||||
if (!IsModeDbg()) return;
|
||||
int val;
|
||||
sem_t sem;
|
||||
SPAWN(fork);
|
||||
signal(SIGABRT, SIG_DFL);
|
||||
ASSERT_SYS(0, 0, sem_init(&sem, 0, 0));
|
||||
ASSERT_SYS(0, 0, sem_destroy(&sem));
|
||||
IgnoreStderr();
|
||||
sem_wait(&sem);
|
||||
EXITS(128 + SIGABRT); // see __assert_fail
|
||||
TERMS(SIGABRT);
|
||||
}
|
||||
|
||||
TEST(sem_timedwait, afterDestroyed_isUndefinedBehavior) {
|
||||
if (!IsModeDbg()) return;
|
||||
int val;
|
||||
sem_t sem;
|
||||
SPAWN(fork);
|
||||
signal(SIGABRT, SIG_DFL);
|
||||
ASSERT_SYS(0, 0, sem_init(&sem, 0, 0));
|
||||
ASSERT_SYS(0, 0, sem_destroy(&sem));
|
||||
IgnoreStderr();
|
||||
sem_timedwait(&sem, 0);
|
||||
EXITS(128 + SIGABRT); // see __assert_fail
|
||||
TERMS(SIGABRT);
|
||||
}
|
||||
|
||||
void *Worker(void *arg) {
|
||||
int rc;
|
||||
sem_t **s = arg;
|
||||
struct timespec ts;
|
||||
ASSERT_SYS(0, 0, clock_gettime(CLOCK_REALTIME, &ts));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue