eal: fix build with conflicting libc variable memory_order
authorEli Britstein <elibr@nvidia.com>
Thu, 15 Oct 2020 15:10:17 +0000 (15:10 +0000)
committerDavid Marchand <david.marchand@redhat.com>
Thu, 15 Oct 2020 16:49:53 +0000 (18:49 +0200)
commit057d9a92f0a9aa07dd820669d4a07b325661929f
tree86a2eb17bd2325c2e286c78592b2d1f5a83d92dc
parente0a1cd7a620dea9d91972b4d08e9364bcc8557db
eal: fix build with conflicting libc variable memory_order

The cited commit introduced functions with 'int memory_order' argument.
The C11 standard section 7.17.1.4 defines 'memory_order' as the
"enumerated type whose enumerators identify memory ordering constraints".

A compilation error occurs:
error: declaration of 'memory_order' shadows a global declaration
    [-Werror=shadow]
     rte_atomic_thread_fence(int memory_order)

This issue was hit when trying to compile OVS with gcc 4.8.5. This
compiler version does not provide stdatomic.h, so enum memory_order is
redefined in OVS code.
In another case, if the compiler does provide stdatomic.h header,
passing -Wsystem-headers in the CFLAGS will also cause that failure.

Fix it by changing the argument name 'memory_order' to 'memorder'.

Fixes: 672a15056380 ("eal: add wrapper for C11 atomic thread fence")

Signed-off-by: Eli Britstein <elibr@nvidia.com>
Reviewed-by: Asaf Penso <asafp@nvidia.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: David Marchand <david.marchand@redhat.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
lib/librte_eal/arm/include/rte_atomic_32.h
lib/librte_eal/arm/include/rte_atomic_64.h
lib/librte_eal/include/generic/rte_atomic.h
lib/librte_eal/ppc/include/rte_atomic.h
lib/librte_eal/x86/include/rte_atomic.h