X-Git-Url: https://git.liburcu.org/?a=blobdiff_plain;f=include%2Furcu%2Fuatomic%2Fx86.h;h=efc67bb62af9689cdf23e219c7e7ccabaadc23a2;hb=81562423503c71c206a3303cf53e3b11f8ca034b;hp=cdb9aee2da4e1d4359b9927ac5cce842622c7c8f;hpb=839eaea560d6561f1cb947d959757786a54343cc;p=urcu.git diff --git a/include/urcu/uatomic/x86.h b/include/urcu/uatomic/x86.h index cdb9aee..efc67bb 100644 --- a/include/urcu/uatomic/x86.h +++ b/include/urcu/uatomic/x86.h @@ -40,10 +40,16 @@ extern "C" { * containing an array of char of the specified size. This allows passing the * @addr arguments of the following inline functions as "m" and "+m" operands * to the assembly. The @size parameter should be a constant to support - * compilers such as clang which do not support VLA. + * compilers such as clang which do not support VLA. Create typedefs because + * C++ does not allow types be defined in casts. */ -#define __hp(size, x) ((struct { char v[size]; } *)(x)) +typedef struct { char v[1]; } __hp_1; +typedef struct { char v[2]; } __hp_2; +typedef struct { char v[4]; } __hp_4; +typedef struct { char v[8]; } __hp_8; + +#define __hp(size, x) ((__hp_##size *)(x)) #define _uatomic_set(addr, v) ((void) CMM_STORE_SHARED(*(addr), (v)))