aboutsummaryrefslogtreecommitdiffstats
path: root/time.c
diff options
context:
space:
mode:
authorshyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-01-02 06:41:50 +0000
committershyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-01-02 06:41:50 +0000
commitaac7975717b668528bd87b7306c45802bf2047cc (patch)
tree02813ee6b1415cbf2ff1c427dfa4479be8399c2e /time.c
parent41a9c60a937f8ff67694637557db4510917e26ab (diff)
downloadruby-aac7975717b668528bd87b7306c45802bf2047cc.tar.gz
bit-fields other than int is a C99ism
To be precise C90 says "A bit-field may have type int, unsigned int, or signed int". It is clear that char or enum are NG. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61554 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'time.c')
-rw-r--r--time.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/time.c b/time.c
index e0a95097bd..fca9d37b89 100644
--- a/time.c
+++ b/time.c
@@ -1596,12 +1596,18 @@ localtimew(wideval_t timew, struct vtm *result)
return result;
}
+#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
+#define bits_t uint8_t
+#else
+#define bits_t unsigned int
+#endif
PACKED_STRUCT_UNALIGNED(struct time_object {
wideval_t timew; /* time_t value * TIME_SCALE. possibly Rational. */
struct vtm vtm;
- uint8_t gmt:3; /* 0:localtime 1:utc 2:fixoff 3:init */
- uint8_t tm_got:1;
+ bits_t gmt:3; /* 0:localtime 1:utc 2:fixoff 3:init */
+ bits_t tm_got:1;
});
+#undef bits_t
#define GetTimeval(obj, tobj) ((tobj) = get_timeval(obj))
#define GetNewTimeval(obj, tobj) ((tobj) = get_new_timeval(obj))