From 82a2a4eb50c09727749a7302db3fe3e3c2b8374d Mon Sep 17 00:00:00 2001 From: EduPonz Date: Tue, 1 Sep 2020 09:36:27 +0200 Subject: [PATCH] Refs #8991: Set and check endianness with FASTCDR_IS_BIG_ENDIAN_TARGET instead of defining __BIG_ENDIAN__ Signed-off-by: EduPonz --- cmake/common/check_configuration.cmake | 2 +- configure.ac | 4 ++-- include/fastcdr/config.h.in | 4 ++-- src/cpp/Cdr.cpp | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cmake/common/check_configuration.cmake b/cmake/common/check_configuration.cmake index 2da55766..ed4b44db 100644 --- a/cmake/common/check_configuration.cmake +++ b/cmake/common/check_configuration.cmake @@ -76,7 +76,7 @@ macro(check_endianness) # Test endianness include(TestBigEndian) test_big_endian(BIG_ENDIAN) - set(__BIG_ENDIAN__ ${BIG_ENDIAN}) + set(FASTCDR_IS_BIG_ENDIAN_TARGET ${BIG_ENDIAN}) endmacro() macro(check_msvc_arch) diff --git a/configure.ac b/configure.ac index eed196e6..810ae7e7 100644 --- a/configure.ac +++ b/configure.ac @@ -47,8 +47,8 @@ AS_IF([test $HAVE_CXX11 = 1], # Check endianess AC_C_BIGENDIAN( - AC_DEFINE(__BIG_ENDIAN__, 1, [machine is bigendian]), - AC_DEFINE(__BIG_ENDIAN__, 0, [machine is littleendian]), + AC_DEFINE(FASTCDR_IS_BIG_ENDIAN_TARGET, 1, [machine is bigendian]), + AC_DEFINE(FASTCDR_IS_BIG_ENDIAN_TARGET, 0, [machine is littleendian]), AC_MSG_ERROR(unknown endianess), AC_MSG_ERROR(universial endianess not supported) ) diff --git a/include/fastcdr/config.h.in b/include/fastcdr/config.h.in index 2e8e51a1..a6ff1f2c 100644 --- a/include/fastcdr/config.h.in +++ b/include/fastcdr/config.h.in @@ -42,8 +42,8 @@ #endif // Endianness defines -#ifndef __BIG_ENDIAN__ -#define __BIG_ENDIAN__ @__BIG_ENDIAN__@ +#ifndef FASTCDR_IS_BIG_ENDIAN_TARGET +#define FASTCDR_IS_BIG_ENDIAN_TARGET @FASTCDR_IS_BIG_ENDIAN_TARGET@ #endif #if defined(__ARM_ARCH) && __ARM_ARCH <= 7 diff --git a/src/cpp/Cdr.cpp b/src/cpp/Cdr.cpp index e1c94cf9..f0dcfed6 100644 --- a/src/cpp/Cdr.cpp +++ b/src/cpp/Cdr.cpp @@ -18,7 +18,7 @@ using namespace eprosima::fastcdr; using namespace ::exception; -#if __BIG_ENDIAN__ +#if FASTCDR_IS_BIG_ENDIAN_TARGET const Cdr::Endianness Cdr::DEFAULT_ENDIAN = BIG_ENDIANNESS; #else const Cdr::Endianness Cdr::DEFAULT_ENDIAN = LITTLE_ENDIANNESS;