Source-Changes-HG archive

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

[src/trunk]: src/sys/sys Avoid C99 initializers outside _KERNEL.



details:   https://anonhg.NetBSD.org/src/rev/c2c5e5e3dae8
branches:  trunk
changeset: 338355:c2c5e5e3dae8
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Tue May 19 23:35:11 2015 +0000

description:
Avoid C99 initializers outside _KERNEL.

Various software is built with, e.g., gcc without -std=c99, which
defaults to c89, which chokes on these.

Noted by Kamil Rytarowski.

diffstat:

 sys/sys/time.h |  29 ++++++++++++++++-------------
 1 files changed, 16 insertions(+), 13 deletions(-)

diffs (56 lines):

diff -r f18bbec40929 -r c2c5e5e3dae8 sys/sys/time.h
--- a/sys/sys/time.h    Tue May 19 19:45:57 2015 +0000
+++ b/sys/sys/time.h    Tue May 19 23:35:11 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: time.h,v 1.68 2015/04/29 12:55:23 riastradh Exp $      */
+/*     $NetBSD: time.h,v 1.69 2015/05/19 23:35:11 riastradh Exp $      */
 
 /*
  * Copyright (c) 1982, 1986, 1993
@@ -203,31 +203,34 @@
 static __inline struct bintime
 ms2bintime(uint64_t ms)
 {
+       struct bintime bt;
 
-       return (struct bintime) {
-               .sec = ms / 1000U,
-               .frac = (((ms % 1000U) >> 32)/1000U) >> 32,
-       };
+       bt.sec = ms / 1000U;
+       bt.frac = (((ms % 1000U) >> 32)/1000U) >> 32;
+
+       return bt;
 }
 
 static __inline struct bintime
 us2bintime(uint64_t us)
 {
+       struct bintime bt;
 
-       return (struct bintime) {
-               .sec = us / 1000000U,
-               .frac = (((us % 1000000U) >> 32)/1000000U) >> 32,
-       };
+       bt.sec = us / 1000000U;
+       bt.frac = (((us % 1000000U) >> 32)/1000000U) >> 32;
+
+       return bt;
 }
 
 static __inline struct bintime
 ns2bintime(uint64_t ns)
 {
+       struct bintime bt;
 
-       return (struct bintime) {
-               .sec = ns / 1000000000U,
-               .frac = (((ns % 1000000000U) >> 32)/1000000000U) >> 32,
-       };
+       bt.sec = ns / 1000000000U;
+       bt.frac = (((ns % 1000000000U) >> 32)/1000000000U) >> 32;
+
+       return bt;
 }
 #endif /* !defined(_STANDALONE) */
 



Home | Main Index | Thread Index | Old Index