Wrap TIMEVAL_TO_TIMESPEC and TIMESPEC_TO_TIMEVAL macros in

do { ... } while(/*CONSTCOND*/0)

so that they can be used unadorned in if/else blocks, etc.  This means
that you now *have* to put a ; at the end of the "call" to these
macros.
This commit is contained in:
atatat 2004-11-14 03:30:08 +00:00
parent 78480a2d52
commit 612e86b46d
4 changed files with 14 additions and 14 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: netbsd32_time.c,v 1.6 2003/10/21 01:44:45 fvdl Exp $ */
/* $NetBSD: netbsd32_time.c,v 1.7 2004/11/14 03:30:10 atatat Exp $ */
/*
* Copyright (c) 1998, 2001 Matthew R. Green
@ -29,7 +29,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: netbsd32_time.c,v 1.6 2003/10/21 01:44:45 fvdl Exp $");
__KERNEL_RCSID(0, "$NetBSD: netbsd32_time.c,v 1.7 2004/11/14 03:30:10 atatat Exp $");
#if defined(_KERNEL_OPT)
#include "opt_ntp.h"
@ -663,7 +663,7 @@ netbsd32_nanosleep(l, v, retval)
return (error);
netbsd32_to_timespec(&ts32, &rqt);
TIMESPEC_TO_TIMEVAL(&atv,&rqt)
TIMESPEC_TO_TIMEVAL(&atv,&rqt);
if (itimerfix(&atv))
return (EINVAL);

View File

@ -1,4 +1,4 @@
/* $NetBSD: kern_time.c,v 1.84 2004/04/27 05:25:33 simonb Exp $ */
/* $NetBSD: kern_time.c,v 1.85 2004/11/14 03:30:09 atatat Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@ -68,7 +68,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: kern_time.c,v 1.84 2004/04/27 05:25:33 simonb Exp $");
__KERNEL_RCSID(0, "$NetBSD: kern_time.c,v 1.85 2004/11/14 03:30:09 atatat Exp $");
#include "fs_nfs.h"
#include "opt_nfs.h"
@ -280,7 +280,7 @@ sys_nanosleep(struct lwp *l, void *v, register_t *retval)
if (error)
return (error);
TIMESPEC_TO_TIMEVAL(&atv,&rqt)
TIMESPEC_TO_TIMEVAL(&atv,&rqt);
if (itimerfix(&atv))
return (EINVAL);

View File

@ -1,4 +1,4 @@
/* $NetBSD: sys_pipe.c,v 1.59 2004/11/06 02:03:20 wrstuden Exp $ */
/* $NetBSD: sys_pipe.c,v 1.60 2004/11/14 03:30:09 atatat Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
@ -83,7 +83,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: sys_pipe.c,v 1.59 2004/11/06 02:03:20 wrstuden Exp $");
__KERNEL_RCSID(0, "$NetBSD: sys_pipe.c,v 1.60 2004/11/14 03:30:09 atatat Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -1258,7 +1258,7 @@ pipe_stat(fp, ub, td)
ub->st_blksize = pipe->pipe_buffer.size;
ub->st_size = pipe->pipe_buffer.cnt;
ub->st_blocks = (ub->st_size) ? 1 : 0;
TIMEVAL_TO_TIMESPEC(&pipe->pipe_atime, &ub->st_atimespec)
TIMEVAL_TO_TIMESPEC(&pipe->pipe_atime, &ub->st_atimespec);
TIMEVAL_TO_TIMESPEC(&pipe->pipe_mtime, &ub->st_mtimespec);
TIMEVAL_TO_TIMESPEC(&pipe->pipe_ctime, &ub->st_ctimespec);
ub->st_uid = fp->f_cred->cr_uid;

View File

@ -1,4 +1,4 @@
/* $NetBSD: time.h,v 1.42 2004/04/27 01:12:44 kleink Exp $ */
/* $NetBSD: time.h,v 1.43 2004/11/14 03:30:08 atatat Exp $ */
/*
* Copyright (c) 1982, 1986, 1993
@ -59,14 +59,14 @@ struct timespec {
long tv_nsec; /* and nanoseconds */
};
#define TIMEVAL_TO_TIMESPEC(tv, ts) { \
#define TIMEVAL_TO_TIMESPEC(tv, ts) do { \
(ts)->tv_sec = (tv)->tv_sec; \
(ts)->tv_nsec = (tv)->tv_usec * 1000; \
}
#define TIMESPEC_TO_TIMEVAL(tv, ts) { \
} while (/*CONSTCOND*/0)
#define TIMESPEC_TO_TIMEVAL(tv, ts) do { \
(tv)->tv_sec = (ts)->tv_sec; \
(tv)->tv_usec = (ts)->tv_nsec / 1000; \
}
} while (/*CONSTCOND*/0)
/*
* Note: timezone is obsolete. All timezone handling is now in