Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys Make time_second and time_uptime volatile, so the compil...



details:   https://anonhg.NetBSD.org/src/rev/187cec5e0fa9
branches:  trunk
changeset: 777516:187cec5e0fa9
user:      martin <martin%NetBSD.org@localhost>
date:      Tue Feb 21 15:41:24 2012 +0000

description:
Make time_second and time_uptime volatile, so the compiler knows they
may change during loops. Fixes the macppc build, which previously
died with:
src/sys/arch/macppc/dev/dbdma.c:62:6: error: assuming signed overflow does not occur when assuming that (X + c) < X is always false

diffstat:

 sys/kern/kern_tc.c |  8 ++++----
 sys/sys/timevar.h  |  6 +++---
 2 files changed, 7 insertions(+), 7 deletions(-)

diffs (48 lines):

diff -r a348c8e616bb -r 187cec5e0fa9 sys/kern/kern_tc.c
--- a/sys/kern/kern_tc.c        Tue Feb 21 15:26:20 2012 +0000
+++ b/sys/kern/kern_tc.c        Tue Feb 21 15:41:24 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_tc.c,v 1.42 2010/04/13 22:46:10 pooka Exp $ */
+/* $NetBSD: kern_tc.c,v 1.43 2012/02/21 15:41:24 martin Exp $ */
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -40,7 +40,7 @@
 
 #include <sys/cdefs.h>
 /* __FBSDID("$FreeBSD: src/sys/kern/kern_tc.c,v 1.166 2005/09/19 22:16:31 andre Exp $"); */
-__KERNEL_RCSID(0, "$NetBSD: kern_tc.c,v 1.42 2010/04/13 22:46:10 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_tc.c,v 1.43 2012/02/21 15:41:24 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ntp.h"
@@ -126,8 +126,8 @@
 struct timecounter *timecounter = &dummy_timecounter;
 static struct timecounter *timecounters = &dummy_timecounter;
 
-time_t time_second = 1;
-time_t time_uptime = 1;
+volatile time_t time_second = 1;
+volatile time_t time_uptime = 1;
 
 static struct bintime timebasebin;
 
diff -r a348c8e616bb -r 187cec5e0fa9 sys/sys/timevar.h
--- a/sys/sys/timevar.h Tue Feb 21 15:26:20 2012 +0000
+++ b/sys/sys/timevar.h Tue Feb 21 15:41:24 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: timevar.h,v 1.30 2011/12/18 22:30:25 christos Exp $    */
+/*     $NetBSD: timevar.h,v 1.31 2012/02/21 15:41:24 martin Exp $      */
 
 /*
  *  Copyright (c) 2005, 2008 The NetBSD Foundation.
@@ -184,7 +184,7 @@
 void   time_init2(void);
 bool   time_wraps(struct timespec *, struct timespec *);
 
-extern time_t time_second;     /* current second in the epoch */
-extern time_t time_uptime;     /* system uptime in seconds */
+extern volatile time_t time_second;    /* current second in the epoch */
+extern volatile time_t time_uptime;    /* system uptime in seconds */
 
 #endif /* !_SYS_TIMEVAR_H_ */



Home | Main Index | Thread Index | Old Index