Travis: restore build on GCC 4.4

This commit is contained in:
Benoit Blanchon
2019-02-28 16:31:08 +01:00
parent 16ddfbc4e0
commit 77f38e4449
3 changed files with 18 additions and 9 deletions

View File

@ -2,6 +2,12 @@ sudo: false
language: cpp language: cpp
matrix: matrix:
include: include:
- compiler: gcc
addons:
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['g++-4.4']
env: SCRIPT=cmake GCC=4.4
- compiler: gcc - compiler: gcc
addons: addons:
apt: apt:

View File

@ -139,7 +139,7 @@
#ifndef ARDUINOJSON_LITTLE_ENDIAN #ifndef ARDUINOJSON_LITTLE_ENDIAN
#if defined(_MSC_VER) || \ #if defined(_MSC_VER) || \
(defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) || \ (defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) || \
(defined(__LITTLE_ENDIAN__)) defined(__LITTLE_ENDIAN__) || defined(__i386) || defined(__x86_64)
#define ARDUINOJSON_LITTLE_ENDIAN 1 #define ARDUINOJSON_LITTLE_ENDIAN 1
#else #else
#define ARDUINOJSON_LITTLE_ENDIAN 0 #define ARDUINOJSON_LITTLE_ENDIAN 0

View File

@ -9,6 +9,7 @@
namespace ARDUINOJSON_NAMESPACE { namespace ARDUINOJSON_NAMESPACE {
#if ARDUINOJSON_LITTLE_ENDIAN
inline void fixEndianess(uint8_t *p, integral_constant<size_t, 8>) { inline void fixEndianess(uint8_t *p, integral_constant<size_t, 8>) {
swap(p[0], p[7]); swap(p[0], p[7]);
swap(p[1], p[6]); swap(p[1], p[6]);
@ -29,10 +30,12 @@ inline void fixEndianess(uint8_t*, integral_constant<size_t, 1>) {}
template <typename T> template <typename T>
inline void fixEndianess(T &value) { inline void fixEndianess(T &value) {
#if ARDUINOJSON_LITTLE_ENDIAN
fixEndianess(reinterpret_cast<uint8_t *>(&value), fixEndianess(reinterpret_cast<uint8_t *>(&value),
integral_constant<size_t, sizeof(T)>()); integral_constant<size_t, sizeof(T)>());
#endif
} }
#else
template <typename T>
inline void fixEndianess(T &) {}
#endif
} // namespace ARDUINOJSON_NAMESPACE } // namespace ARDUINOJSON_NAMESPACE