From: Ivan Maidanski Date: Tue, 9 Oct 2012 06:30:28 +0000 (+0400) Subject: Reorder AO_double_t union elements for AO_DOUBLE_T_INITIALIZER portability X-Git-Tag: libatomic_ops-7_4_0~69 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7034240cde0414246500581338dbc8cdb252db44;p=libatomic_ops Reorder AO_double_t union elements for AO_DOUBLE_T_INITIALIZER portability * src/atomic_ops/sysdeps/standard_ao_double_t.h (AO_double_t): Make "AO_parts" element to be the first one in the enum so that AO_DOUBLE_T_INITIALIZER could be defined both strictly complying with ANSI C standard (thus preventing "missing braces around initializer" 64-bit compiler warning) and independently of __m128 type definition; add comment. * src/atomic_ops/sysdeps/standard_ao_double_t.h (AO_DOUBLE_T_INITIALIZER): Update to reflect the change in AO_double_t. --- diff --git a/src/atomic_ops/sysdeps/standard_ao_double_t.h b/src/atomic_ops/sysdeps/standard_ao_double_t.h index d73af92..1ed32b8 100644 --- a/src/atomic_ops/sysdeps/standard_ao_double_t.h +++ b/src/atomic_ops/sysdeps/standard_ao_double_t.h @@ -38,14 +38,18 @@ # define AO_HAVE_DOUBLE_PTR_STORAGE typedef union { - double_ptr_storage AO_whole; struct { AO_t AO_v1; AO_t AO_v2; } AO_parts; /* Note that AO_v1 corresponds to the low or the high part of */ /* AO_whole depending on the machine endianness. */ + double_ptr_storage AO_whole; + /* AO_whole is now (starting from v7.3alpha3) the 2nd element */ + /* of this union to make AO_DOUBLE_T_INITIALIZER portable */ + /* (because __m128 definition could vary from a primitive type */ + /* to a structure or array/vector). */ } AO_double_t; #define AO_HAVE_double_t -#define AO_DOUBLE_T_INITIALIZER { 0 } +#define AO_DOUBLE_T_INITIALIZER { { (AO_t)0, (AO_t)0 } } #define AO_val1 AO_parts.AO_v1 #define AO_val2 AO_parts.AO_v2