pass lint:
1. add new pthread__abort() and change pthread_assert(0) to it. 2. put constcond in the right place (in the macro). 3. no space after pthread__assert macro.
This commit is contained in:
parent
4e29fa8276
commit
143f5a277a
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: pthread.c,v 1.18 2003/04/28 17:46:30 nathanw Exp $ */
|
||||
/* $NetBSD: pthread.c,v 1.19 2003/05/27 15:24:24 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
|
@ -37,7 +37,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__RCSID("$NetBSD: pthread.c,v 1.18 2003/04/28 17:46:30 nathanw Exp $");
|
||||
__RCSID("$NetBSD: pthread.c,v 1.19 2003/05/27 15:24:24 christos Exp $");
|
||||
|
||||
#include <err.h>
|
||||
#include <errno.h>
|
||||
|
@ -357,8 +357,8 @@ pthread__create_tramp(void *(*start)(void *), void *arg)
|
|||
|
||||
pthread_exit(retval);
|
||||
|
||||
/*NOTREACHED*//*CONSTCOND*/
|
||||
pthread__assert(0);
|
||||
/*NOTREACHED*/
|
||||
pthread__abort();
|
||||
}
|
||||
|
||||
|
||||
|
@ -396,8 +396,7 @@ pthread__idle(void)
|
|||
/* NOTREACHED */
|
||||
self->pt_spinlocks++; /* XXX make sure we get to finish the assert! */
|
||||
SDPRINTF(("(pthread__idle %p) Returned! Error.\n", self));
|
||||
/* CONSTCOND */
|
||||
pthread__assert(0);
|
||||
pthread__abort();
|
||||
}
|
||||
|
||||
|
||||
|
@ -472,8 +471,8 @@ pthread_exit(void *retval)
|
|||
pthread__block(self, &self->pt_join_lock);
|
||||
}
|
||||
|
||||
/*NOTREACHED*//*CONSTCOND*/
|
||||
pthread__assert(0);
|
||||
/*NOTREACHED*/
|
||||
pthread__abort();
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
@ -1069,7 +1068,7 @@ pthread__assertfunc(char *file, int line, char *function, char *expr)
|
|||
function ? function : "",
|
||||
function ? "\"" : "");
|
||||
|
||||
write(STDERR_FILENO, buf, len);
|
||||
write(STDERR_FILENO, buf, (size_t)len);
|
||||
(void)kill(getpid(), SIGABRT);
|
||||
|
||||
_exit(1);
|
||||
|
@ -1097,7 +1096,7 @@ pthread__errorfunc(char *file, int line, char *function, char *msg)
|
|||
function ? "\"" : "",
|
||||
msg);
|
||||
|
||||
write(STDERR_FILENO, buf, len);
|
||||
write(STDERR_FILENO, buf, (size_t)len);
|
||||
if (pthread__errormode == PTHREAD_ERRORMODE_ABORT) {
|
||||
(void)kill(getpid(), SIGABRT);
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: pthread_int.h,v 1.11 2003/04/23 19:35:47 nathanw Exp $ */
|
||||
/* $NetBSD: pthread_int.h,v 1.12 2003/05/27 15:24:24 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
|
@ -339,17 +339,20 @@ void pthread__sigcontext_to_ucontext(const struct pthread__sigcontext *,
|
|||
|
||||
#define pthread__self() (pthread__id(pthread__sp()))
|
||||
|
||||
#define pthread__abort() \
|
||||
pthread__assertfunc(__FILE__, __LINE__, __func__, "unreachable")
|
||||
|
||||
#define pthread__assert(e) do { \
|
||||
if (__predict_false(!(e))) \
|
||||
pthread__assertfunc(__FILE__, __LINE__, __func__, #e); \
|
||||
} while (0)
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define pthread__error(err, msg, e) do { \
|
||||
if (__predict_false(!(e))) { \
|
||||
pthread__errorfunc(__FILE__, __LINE__, __func__, msg); \
|
||||
return (err); \
|
||||
} \
|
||||
} while (0)
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: pthread_run.c,v 1.9 2003/04/04 01:08:25 nathanw Exp $ */
|
||||
/* $NetBSD: pthread_run.c,v 1.10 2003/05/27 15:24:24 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
|
@ -37,7 +37,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__RCSID("$NetBSD: pthread_run.c,v 1.9 2003/04/04 01:08:25 nathanw Exp $");
|
||||
__RCSID("$NetBSD: pthread_run.c,v 1.10 2003/05/27 15:24:24 christos Exp $");
|
||||
|
||||
#include <ucontext.h>
|
||||
|
||||
|
@ -136,8 +136,8 @@ pthread__sched(pthread_t self, pthread_t thread)
|
|||
|
||||
SDPRINTF(("(sched %p) scheduling %p\n", self, thread));
|
||||
thread->pt_state = PT_STATE_RUNNABLE;
|
||||
pthread__assert (thread->pt_type == PT_THREAD_NORMAL);
|
||||
pthread__assert (thread->pt_spinlocks == 0);
|
||||
pthread__assert(thread->pt_type == PT_THREAD_NORMAL);
|
||||
pthread__assert(thread->pt_spinlocks == 0);
|
||||
#ifdef PTHREAD__DEBUG
|
||||
thread->rescheds++;
|
||||
#endif
|
||||
|
@ -156,8 +156,8 @@ pthread__sched_sleepers(pthread_t self, struct pthread_queue_t *threadq)
|
|||
PTQ_FOREACH(thread, threadq, pt_sleep) {
|
||||
SDPRINTF(("(sched_sleepers %p) scheduling %p\n", self, thread));
|
||||
thread->pt_state = PT_STATE_RUNNABLE;
|
||||
pthread__assert (thread->pt_type == PT_THREAD_NORMAL);
|
||||
pthread__assert (thread->pt_spinlocks == 0);
|
||||
pthread__assert(thread->pt_type == PT_THREAD_NORMAL);
|
||||
pthread__assert(thread->pt_spinlocks == 0);
|
||||
#ifdef PTHREAD__DEBUG
|
||||
thread->rescheds++;
|
||||
#endif
|
||||
|
@ -225,7 +225,7 @@ pthread__sched_bulk(pthread_t self, pthread_t qhead)
|
|||
pthread_spinlock(self, &pthread__runqueue_lock);
|
||||
for ( ; qhead && (qhead != self) ; qhead = next) {
|
||||
next = qhead->pt_next;
|
||||
pthread__assert (qhead->pt_spinlocks == 0);
|
||||
pthread__assert(qhead->pt_spinlocks == 0);
|
||||
if (qhead->pt_type == PT_THREAD_NORMAL) {
|
||||
qhead->pt_state = PT_STATE_RUNNABLE;
|
||||
qhead->pt_next = NULL;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: pthread_sa.c,v 1.8 2003/05/26 19:41:03 nathanw Exp $ */
|
||||
/* $NetBSD: pthread_sa.c,v 1.9 2003/05/27 15:24:24 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
|
@ -37,7 +37,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__RCSID("$NetBSD: pthread_sa.c,v 1.8 2003/05/26 19:41:03 nathanw Exp $");
|
||||
__RCSID("$NetBSD: pthread_sa.c,v 1.9 2003/05/27 15:24:24 christos Exp $");
|
||||
|
||||
#include <err.h>
|
||||
#include <errno.h>
|
||||
|
@ -193,8 +193,7 @@ pthread__upcall(int type, struct sa_t *sas[], int ev, int intr, void *arg)
|
|||
case SA_UPCALL_USER:
|
||||
/* We don't send ourselves one of these. */
|
||||
default:
|
||||
/*CONSTCOND*/
|
||||
pthread__assert(0);
|
||||
pthread__abort();
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -207,8 +206,8 @@ pthread__upcall(int type, struct sa_t *sas[], int ev, int intr, void *arg)
|
|||
SDPRINTF(("(up %p) switching to %p (uc: %p pc: %lx)\n",
|
||||
self, next, next->pt_uc, pthread__uc_pc(next->pt_uc)));
|
||||
pthread__upcall_switch(self, next);
|
||||
/*NOTREACHED*//*CONSTCOND*/
|
||||
pthread__assert(0);
|
||||
/*NOTREACHED*/
|
||||
pthread__abort();
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -306,7 +305,7 @@ pthread__find_interrupted(struct sa_t *sas[], int nsas, pthread_t *qhead,
|
|||
|
||||
}
|
||||
}
|
||||
pthread__assert (victim != self);
|
||||
pthread__assert(victim != self);
|
||||
victim->pt_parent = self;
|
||||
victim->pt_next = next;
|
||||
next = victim;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: pthread_sig.c,v 1.13 2003/03/20 01:03:52 nathanw Exp $ */
|
||||
/* $NetBSD: pthread_sig.c,v 1.14 2003/05/27 15:24:25 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
|
@ -37,7 +37,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__RCSID("$NetBSD: pthread_sig.c,v 1.13 2003/03/20 01:03:52 nathanw Exp $");
|
||||
__RCSID("$NetBSD: pthread_sig.c,v 1.14 2003/05/27 15:24:25 christos Exp $");
|
||||
|
||||
/* We're interposing a specific version of the signal interface. */
|
||||
#define __LIBC12_SOURCE__
|
||||
|
@ -892,8 +892,8 @@ pthread__signal_tramp(int sig, int code,
|
|||
* by a signal.
|
||||
*/
|
||||
_setcontext_u(uc);
|
||||
/*NOTREACHED*//*CONSTCOND*/
|
||||
pthread__assert(0);
|
||||
/*NOTREACHED*/
|
||||
pthread__abort();
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in New Issue