diff options
author | Malvika Gupta <Malvika.Gupta@arm.com> | 2020-11-11 10:12:48 -0600 |
---|---|---|
committer | Petri Savolainen <petri.savolainen@nokia.com> | 2020-11-13 16:24:48 +0200 |
commit | 08cd8cc3223bd12c2d0693e9d508c5884db15b8e (patch) | |
tree | 0894c870c0cdb374b2a3f590267a1c84db8110ce /platform/linux-generic/include-abi | |
parent | e13682688cdad1c83bc5e1ea09cc1b0f02f9900d (diff) |
abi: atomic: fix placement of ODP_ALIGNED in struct definitions
As per the GCC documentation, the 'aligned' attribute should be added
after the 'struct' keyword. Consequently, the ODP_ALIGNED attribute has
been moved in various structs of the atomic abi files. The 'Enforce
alignment' comment has been removed from these files since the effect of
the ODP_ALIGNED macro is easy to understand.
Also, for these files, the typedef declaration has been combined with the
struct definition which is consistent with most typedef structs in ODP
source code.
Suggested-by: Petri Savolainen <petri.savolainen@nokia.com>
Signed-off-by: Malvika Gupta <Malvika.Gupta@arm.com>
Reviewed-by: Govindarajan Mohandoss <Govindarajan.Mohandoss@arm.com>
Reviewed-by: Jere Leppänen <jere.leppanen@nokia.com>
Reviewed-by: Matias Elo <matias.elo@nokia.com>
Diffstat (limited to 'platform/linux-generic/include-abi')
-rw-r--r-- | platform/linux-generic/include-abi/odp/api/abi/atomic.h | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/platform/linux-generic/include-abi/odp/api/abi/atomic.h b/platform/linux-generic/include-abi/odp/api/abi/atomic.h index ceedb5ed5..955b99370 100644 --- a/platform/linux-generic/include-abi/odp/api/abi/atomic.h +++ b/platform/linux-generic/include-abi/odp/api/abi/atomic.h @@ -24,9 +24,9 @@ extern "C" { * @internal * Atomic 32-bit unsigned integer */ -struct odp_atomic_u32_s { +typedef struct ODP_ALIGNED(sizeof(uint32_t)) odp_atomic_u32_s { uint32_t v; /**< Actual storage for the atomic variable */ -} ODP_ALIGNED(sizeof(uint32_t)); /* Enforce alignment! */ +} odp_atomic_u32_t; #if __GCC_ATOMIC_LLONG_LOCK_FREE >= 2 @@ -34,9 +34,9 @@ struct odp_atomic_u32_s { * @internal * Atomic 64-bit unsigned integer */ -struct odp_atomic_u64_s { +typedef struct ODP_ALIGNED(sizeof(uint64_t)) odp_atomic_u64_s { uint64_t v; /**< Actual storage for the atomic variable */ -} ODP_ALIGNED(sizeof(uint64_t)); /* Enforce alignment! */ +} odp_atomic_u64_t; #else @@ -46,19 +46,15 @@ struct odp_atomic_u64_s { * @internal * Atomic 64-bit unsigned integer */ -struct odp_atomic_u64_s { +typedef struct ODP_ALIGNED(sizeof(uint64_t)) odp_atomic_u64_s { uint64_t v; /**< Actual storage for the atomic variable */ /* Some architectures do not support lock-free operations on 64-bit * data types. We use a spin lock to ensure atomicity. */ char lock; /**< Spin lock (if needed) used to ensure atomic access */ -} ODP_ALIGNED(sizeof(uint64_t)); /* Enforce alignment! */ +} odp_atomic_u64_t; #endif -typedef struct odp_atomic_u64_s odp_atomic_u64_t; - -typedef struct odp_atomic_u32_s odp_atomic_u32_t; - /** @ingroup odp_atomic * @{ */ |