Fixed conflicts with isnan() and isinf() macros (fixes #752)

This commit is contained in:
Benoit Blanchon
2018-06-11 12:21:50 +02:00
parent 393f352b70
commit c3403ed72d
4 changed files with 21 additions and 4 deletions

View File

@ -105,7 +105,7 @@ matrix:
compiler: clang compiler: clang
env: SCRIPT=cmake SANITIZE=address env: SCRIPT=cmake SANITIZE=address
- env: SCRIPT=arduino VERSION=1.6.7 BOARD=arduino:avr:uno - env: SCRIPT=arduino VERSION=1.6.7 BOARD=arduino:avr:uno
- env: SCRIPT=arduino VERSION=1.8.2 BOARD=arduino:avr:uno - env: SCRIPT=arduino VERSION=1.8.2 BOARD=arduino:samd:mkr1000
- env: SCRIPT=platformio BOARD=uno - env: SCRIPT=platformio BOARD=uno
- env: SCRIPT=platformio BOARD=esp01 - env: SCRIPT=platformio BOARD=esp01
- compiler: clang - compiler: clang

View File

@ -1,6 +1,11 @@
ArduinoJson: change log ArduinoJson: change log
======================= =======================
HEAD
----
* Fixed conflicts with `isnan()` and `isinf()` macros (issue #752)
v6.0.0-beta v6.0.0-beta
----------- -----------

View File

@ -1,4 +1,4 @@
#!/bin/sh -eux #!/bin/bash -eux
/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_1.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :1 -ac -screen 0 1280x1024x16 /sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_1.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :1 -ac -screen 0 1280x1024x16
sleep 3 sleep 3
@ -6,9 +6,13 @@ export DISPLAY=:1.0
mkdir -p /tmp/arduino mkdir -p /tmp/arduino
curl -sS http://downloads.arduino.cc/arduino-$VERSION-linux64.tar.xz | tar xJ -C /tmp/arduino --strip 1 || curl -sS http://downloads.arduino.cc/arduino-$VERSION-linux64.tar.xz | tar xJ -C /tmp/arduino --strip 1 ||
curl -sS http://downloads.arduino.cc/arduino-$VERSION-linux64.tgz | tar xz -C /tmp/arduino --strip 1 curl -sS http://downloads.arduino.cc/arduino-$VERSION-linux64.tgz | tar xz -C /tmp/arduino --strip 1
export PATH=$PATH:/tmp/arduino/ export PATH=$PATH:/tmp/arduino/
if [[ "$BOARD" =~ "arduino:samd:" ]]; then
arduino --install-boards arduino:samd
fi
ln -s $PWD /tmp/arduino/libraries/ArduinoJson ln -s $PWD /tmp/arduino/libraries/ArduinoJson
for EXAMPLE in $PWD/examples/*/*.ino; do for EXAMPLE in $PWD/examples/*/*.ino; do

View File

@ -6,14 +6,22 @@
namespace ArduinoJson { namespace ArduinoJson {
namespace Internals { namespace Internals {
// Some libraries #define isnan() and isinf() so we need to check before
// using this name
#ifndef isnan
template <typename T> template <typename T>
bool isnan(T x) { bool isnan(T x) {
return x != x; return x != x;
} }
#endif
#ifndef isinf
template <typename T> template <typename T>
bool isinf(T x) { bool isinf(T x) {
return x != 0.0 && x * 2 == x; return x != 0.0 && x * 2 == x;
} }
#endif
} // namespace Internals } // namespace Internals
} // namespace ArduinoJson } // namespace ArduinoJson