[threads] Use designated initializer syntax in MAKE_SPECIAL_STATIC_OFFSET
authorAleksey Kliger <aleksey@xamarin.com>
Thu, 17 Aug 2017 22:56:49 +0000 (18:56 -0400)
committerAleksey Kliger (λgeek) <akliger@gmail.com>
Fri, 18 Aug 2017 13:52:09 +0000 (09:52 -0400)
Originally we used a C90-style struct initializer `{ (index), (offset), (type)
}`.  Unfortunately, SpecialStaticOffset is defined with fields in a different
order on big-endian and little-endian machines.  Using a designated
initializer, we don't have to care about the order.

mono/metadata/threads.c

index 120bd1a9458f7e94c26dedf9f03e4dd2b24a9ddf..8eb4fe5f24e474e619a68bb2e17a00cb1f52f043 100644 (file)
@@ -462,8 +462,8 @@ typedef union {
 #define SPECIAL_STATIC_OFFSET_TYPE_THREAD 0
 #define SPECIAL_STATIC_OFFSET_TYPE_CONTEXT 1
 
 #define SPECIAL_STATIC_OFFSET_TYPE_THREAD 0
 #define SPECIAL_STATIC_OFFSET_TYPE_CONTEXT 1
 
-#define MAKE_SPECIAL_STATIC_OFFSET(index, offset, type) \
-       ((SpecialStaticOffset) { .fields = { (index), (offset), (type) } }.raw)
+#define MAKE_SPECIAL_STATIC_OFFSET(idx, off, ty) \
+       ((SpecialStaticOffset) { .fields = { .index = (idx), .offset = (off), .type = (ty) } }.raw)
 #define ACCESS_SPECIAL_STATIC_OFFSET(x,f) \
        (((SpecialStaticOffset *) &(x))->fields.f)
 
 #define ACCESS_SPECIAL_STATIC_OFFSET(x,f) \
        (((SpecialStaticOffset *) &(x))->fields.f)