mirror of
https://github.com/bblanchon/ArduinoJson.git
synced 2025-07-16 20:12:16 +02:00
Remove ARDUINOJSON_EMBEDDED_MODE
This commit is contained in:
6
.github/workflows/ci.yml
vendored
6
.github/workflows/ci.yml
vendored
@ -135,11 +135,11 @@ jobs:
|
|||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
- name: GCC 32-bit
|
- name: GCC 32-bit
|
||||||
run: g++ -std=c++11 -m32 -Isrc extras/conf_test/x86-linux.cpp
|
run: g++ -std=c++11 -m32 -Isrc extras/conf_test/x86.cpp
|
||||||
- name: GCC 64-bit
|
- name: GCC 64-bit
|
||||||
run: g++ -std=c++11 -m64 -Isrc extras/conf_test/x64.cpp
|
run: g++ -std=c++11 -m64 -Isrc extras/conf_test/x64.cpp
|
||||||
- name: Clang 32-bit
|
- name: Clang 32-bit
|
||||||
run: clang++ -std=c++11 -m32 -Isrc extras/conf_test/x86-linux.cpp
|
run: clang++ -std=c++11 -m32 -Isrc extras/conf_test/x86.cpp
|
||||||
- name: Clang 64-bit
|
- name: Clang 64-bit
|
||||||
run: clang++ -std=c++11 -m64 -Isrc extras/conf_test/x64.cpp
|
run: clang++ -std=c++11 -m64 -Isrc extras/conf_test/x64.cpp
|
||||||
|
|
||||||
@ -153,7 +153,7 @@ jobs:
|
|||||||
- name: 32-bit
|
- name: 32-bit
|
||||||
run: |
|
run: |
|
||||||
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars32.bat"
|
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars32.bat"
|
||||||
cl /Isrc extras/conf_test/x86-windows.cpp
|
cl /Isrc extras/conf_test/x86.cpp
|
||||||
shell: cmd
|
shell: cmd
|
||||||
- name: 64-bit
|
- name: 64-bit
|
||||||
run: |
|
run: |
|
||||||
|
@ -1,6 +1,12 @@
|
|||||||
ArduinoJson: change log
|
ArduinoJson: change log
|
||||||
=======================
|
=======================
|
||||||
|
|
||||||
|
HEAD
|
||||||
|
----
|
||||||
|
|
||||||
|
* Remove `ARDUINOJSON_EMBEDDED_MODE` and assume we run on an embedded platform.
|
||||||
|
Dependent settings (like `ARDUINOJSON_DEFAULT_NESTING_LIMIT`) must be set individually.
|
||||||
|
|
||||||
v6.18.5 (2021-09-28)
|
v6.18.5 (2021-09-28)
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
@ -7,7 +7,6 @@ cmake_minimum_required(VERSION 3.3)
|
|||||||
if(ESP_PLATFORM)
|
if(ESP_PLATFORM)
|
||||||
# Build ArduinoJson as an ESP-IDF component
|
# Build ArduinoJson as an ESP-IDF component
|
||||||
idf_component_register(INCLUDE_DIRS src)
|
idf_component_register(INCLUDE_DIRS src)
|
||||||
target_compile_definitions(${COMPONENT_LIB} INTERFACE ARDUINOJSON_EMBEDDED_MODE=1)
|
|
||||||
return()
|
return()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -1,15 +0,0 @@
|
|||||||
#include <ArduinoJson.h>
|
|
||||||
|
|
||||||
static_assert(ARDUINOJSON_USE_LONG_LONG == 1, "ARDUINOJSON_USE_LONG_LONG");
|
|
||||||
|
|
||||||
static_assert(ARDUINOJSON_SLOT_OFFSET_SIZE == 4,
|
|
||||||
"ARDUINOJSON_SLOT_OFFSET_SIZE");
|
|
||||||
|
|
||||||
static_assert(ARDUINOJSON_LITTLE_ENDIAN == 1, "ARDUINOJSON_LITTLE_ENDIAN");
|
|
||||||
|
|
||||||
static_assert(ARDUINOJSON_USE_DOUBLE == 1, "ARDUINOJSON_USE_DOUBLE");
|
|
||||||
|
|
||||||
static_assert(sizeof(ARDUINOJSON_NAMESPACE::VariantSlot) == 24,
|
|
||||||
"sizeof(VariantSlot)");
|
|
||||||
|
|
||||||
int main() {}
|
|
@ -2,14 +2,14 @@
|
|||||||
|
|
||||||
static_assert(ARDUINOJSON_USE_LONG_LONG == 1, "ARDUINOJSON_USE_LONG_LONG");
|
static_assert(ARDUINOJSON_USE_LONG_LONG == 1, "ARDUINOJSON_USE_LONG_LONG");
|
||||||
|
|
||||||
static_assert(ARDUINOJSON_SLOT_OFFSET_SIZE == 4,
|
static_assert(ARDUINOJSON_SLOT_OFFSET_SIZE == 2,
|
||||||
"ARDUINOJSON_SLOT_OFFSET_SIZE");
|
"ARDUINOJSON_SLOT_OFFSET_SIZE");
|
||||||
|
|
||||||
static_assert(ARDUINOJSON_LITTLE_ENDIAN == 1, "ARDUINOJSON_LITTLE_ENDIAN");
|
static_assert(ARDUINOJSON_LITTLE_ENDIAN == 1, "ARDUINOJSON_LITTLE_ENDIAN");
|
||||||
|
|
||||||
static_assert(ARDUINOJSON_USE_DOUBLE == 1, "ARDUINOJSON_USE_DOUBLE");
|
static_assert(ARDUINOJSON_USE_DOUBLE == 1, "ARDUINOJSON_USE_DOUBLE");
|
||||||
|
|
||||||
static_assert(sizeof(ARDUINOJSON_NAMESPACE::VariantSlot) == 20,
|
static_assert(sizeof(ARDUINOJSON_NAMESPACE::VariantSlot) == 16,
|
||||||
"sizeof(VariantSlot)");
|
"sizeof(VariantSlot)");
|
||||||
|
|
||||||
int main() {}
|
int main() {}
|
@ -26,23 +26,9 @@
|
|||||||
# define ARDUINOJSON_HAS_INT64 0
|
# define ARDUINOJSON_HAS_INT64 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Small or big machine?
|
// Support std::istream and std::ostream
|
||||||
#ifndef ARDUINOJSON_EMBEDDED_MODE
|
#ifndef ARDUINOJSON_ENABLE_STD_STREAM
|
||||||
# if defined(ARDUINO) /* Arduino*/ \
|
# ifdef __has_include
|
||||||
|| defined(__IAR_SYSTEMS_ICC__) /* IAR Embedded Workbench */ \
|
|
||||||
|| defined(__XC) /* MPLAB XC compiler */ \
|
|
||||||
|| defined(__ARMCC_VERSION) /* Keil ARM Compiler */ \
|
|
||||||
|| defined(__NIOS2__) /* Altera Nios II EDS */ \
|
|
||||||
|| defined(__AVR) /* Atmel AVR8/GNU C Compiler */
|
|
||||||
# define ARDUINOJSON_EMBEDDED_MODE 1
|
|
||||||
# else
|
|
||||||
# define ARDUINOJSON_EMBEDDED_MODE 0
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Auto enable std::stream if the right headers are here and no conflicting
|
|
||||||
// macro is defined
|
|
||||||
#if !defined(ARDUINOJSON_ENABLE_STD_STREAM) && defined(__has_include)
|
|
||||||
# if __has_include(<istream>) && \
|
# if __has_include(<istream>) && \
|
||||||
__has_include(<ostream>) && \
|
__has_include(<ostream>) && \
|
||||||
!defined(min) && \
|
!defined(min) && \
|
||||||
@ -51,51 +37,55 @@
|
|||||||
# else
|
# else
|
||||||
# define ARDUINOJSON_ENABLE_STD_STREAM 0
|
# define ARDUINOJSON_ENABLE_STD_STREAM 0
|
||||||
# endif
|
# endif
|
||||||
|
# else
|
||||||
|
# ifdef ARDUINO
|
||||||
|
# define ARDUINOJSON_ENABLE_STD_STREAM 0
|
||||||
|
# else
|
||||||
|
# define ARDUINOJSON_ENABLE_STD_STREAM 1
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Auto enable std::string if the right header is here and no conflicting
|
// Support std::string
|
||||||
// macro is defined
|
#ifndef ARDUINOJSON_ENABLE_STD_STRING
|
||||||
#if !defined(ARDUINOJSON_ENABLE_STD_STRING) && defined(__has_include)
|
# ifdef __has_include
|
||||||
# if __has_include(<string>) && !defined(min) && !defined(max)
|
# if __has_include(<string>) && !defined(min) && !defined(max)
|
||||||
# define ARDUINOJSON_ENABLE_STD_STRING 1
|
# define ARDUINOJSON_ENABLE_STD_STRING 1
|
||||||
# else
|
# else
|
||||||
# define ARDUINOJSON_ENABLE_STD_STRING 0
|
# define ARDUINOJSON_ENABLE_STD_STRING 0
|
||||||
# endif
|
# endif
|
||||||
|
# else
|
||||||
|
# ifdef ARDUINO
|
||||||
|
# define ARDUINOJSON_ENABLE_STD_STRING 0
|
||||||
|
# else
|
||||||
|
# define ARDUINOJSON_ENABLE_STD_STRING 1
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Support for std::string_view
|
||||||
#ifndef ARDUINOJSON_ENABLE_STRING_VIEW
|
#ifndef ARDUINOJSON_ENABLE_STRING_VIEW
|
||||||
# ifdef __has_include
|
# ifdef __has_include
|
||||||
# if __has_include(<string_view>) && __cplusplus >= 201703L
|
# if __has_include(<string_view>) && __cplusplus >= 201703L
|
||||||
# define ARDUINOJSON_ENABLE_STRING_VIEW 1
|
# define ARDUINOJSON_ENABLE_STRING_VIEW 1
|
||||||
# endif
|
# else
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
#ifndef ARDUINOJSON_ENABLE_STRING_VIEW
|
|
||||||
# define ARDUINOJSON_ENABLE_STRING_VIEW 0
|
# define ARDUINOJSON_ENABLE_STRING_VIEW 0
|
||||||
# endif
|
# endif
|
||||||
|
# else
|
||||||
|
# define ARDUINOJSON_ENABLE_STRING_VIEW 0
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#if ARDUINOJSON_EMBEDDED_MODE
|
// Store floating-point values with float (0) or double (1)
|
||||||
|
|
||||||
// Store floats by default to reduce the memory usage (issue #134)
|
|
||||||
#ifndef ARDUINOJSON_USE_DOUBLE
|
#ifndef ARDUINOJSON_USE_DOUBLE
|
||||||
# define ARDUINOJSON_USE_DOUBLE 0
|
# define ARDUINOJSON_USE_DOUBLE 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Store longs by default, because they usually match the size of a float.
|
// Store integral values with long (0) or long long (1)
|
||||||
#ifndef ARDUINOJSON_USE_LONG_LONG
|
#ifndef ARDUINOJSON_USE_LONG_LONG
|
||||||
# define ARDUINOJSON_USE_LONG_LONG 0
|
# define ARDUINOJSON_USE_LONG_LONG 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Embedded systems usually don't have std::string
|
|
||||||
# ifndef ARDUINOJSON_ENABLE_STD_STRING
|
|
||||||
# define ARDUINOJSON_ENABLE_STD_STRING 0
|
|
||||||
# endif
|
|
||||||
|
|
||||||
// Embedded systems usually don't have std::stream
|
|
||||||
# ifndef ARDUINOJSON_ENABLE_STD_STREAM
|
|
||||||
# define ARDUINOJSON_ENABLE_STD_STREAM 0
|
|
||||||
# endif
|
|
||||||
|
|
||||||
// Limit nesting as the stack is likely to be small
|
// Limit nesting as the stack is likely to be small
|
||||||
#ifndef ARDUINOJSON_DEFAULT_NESTING_LIMIT
|
#ifndef ARDUINOJSON_DEFAULT_NESTING_LIMIT
|
||||||
# define ARDUINOJSON_DEFAULT_NESTING_LIMIT 10
|
# define ARDUINOJSON_DEFAULT_NESTING_LIMIT 10
|
||||||
@ -104,53 +94,19 @@
|
|||||||
// Number of bits to store the pointer to next node
|
// Number of bits to store the pointer to next node
|
||||||
// (saves RAM but limits the number of values in a document)
|
// (saves RAM but limits the number of values in a document)
|
||||||
#ifndef ARDUINOJSON_SLOT_OFFSET_SIZE
|
#ifndef ARDUINOJSON_SLOT_OFFSET_SIZE
|
||||||
# if defined(__SIZEOF_POINTER__) && __SIZEOF_POINTER__ == 2
|
# if defined(__SIZEOF_POINTER__) && __SIZEOF_POINTER__ <= 2
|
||||||
// Address space == 16-bit => max 127 values
|
// Address space == 16-bit => max 127 values
|
||||||
# define ARDUINOJSON_SLOT_OFFSET_SIZE 1
|
# define ARDUINOJSON_SLOT_OFFSET_SIZE 1
|
||||||
|
# elif defined(__SIZEOF_POINTER__) && __SIZEOF_POINTER__ >= 8 || \
|
||||||
|
defined(_WIN64) && _WIN64
|
||||||
|
// Address space == 64-bit => max 2147483647 values
|
||||||
|
# define ARDUINOJSON_SLOT_OFFSET_SIZE 4
|
||||||
# else
|
# else
|
||||||
// Address space > 16-bit => max 32767 values
|
// Address space == 32-bit => max 32767 values
|
||||||
# define ARDUINOJSON_SLOT_OFFSET_SIZE 2
|
# define ARDUINOJSON_SLOT_OFFSET_SIZE 2
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#else // ARDUINOJSON_EMBEDDED_MODE
|
|
||||||
|
|
||||||
// On a computer we have plenty of memory so we can use doubles
|
|
||||||
# ifndef ARDUINOJSON_USE_DOUBLE
|
|
||||||
# define ARDUINOJSON_USE_DOUBLE 1
|
|
||||||
# endif
|
|
||||||
|
|
||||||
// Use long long when available
|
|
||||||
# ifndef ARDUINOJSON_USE_LONG_LONG
|
|
||||||
# if ARDUINOJSON_HAS_LONG_LONG || ARDUINOJSON_HAS_INT64
|
|
||||||
# define ARDUINOJSON_USE_LONG_LONG 1
|
|
||||||
# else
|
|
||||||
# define ARDUINOJSON_USE_LONG_LONG 0
|
|
||||||
# endif
|
|
||||||
# endif
|
|
||||||
|
|
||||||
// On a computer, we can use std::string
|
|
||||||
# ifndef ARDUINOJSON_ENABLE_STD_STRING
|
|
||||||
# define ARDUINOJSON_ENABLE_STD_STRING 1
|
|
||||||
# endif
|
|
||||||
|
|
||||||
// On a computer, we can assume std::stream
|
|
||||||
# ifndef ARDUINOJSON_ENABLE_STD_STREAM
|
|
||||||
# define ARDUINOJSON_ENABLE_STD_STREAM 1
|
|
||||||
# endif
|
|
||||||
|
|
||||||
// On a computer, the stack is large so we can increase nesting limit
|
|
||||||
# ifndef ARDUINOJSON_DEFAULT_NESTING_LIMIT
|
|
||||||
# define ARDUINOJSON_DEFAULT_NESTING_LIMIT 50
|
|
||||||
# endif
|
|
||||||
|
|
||||||
// Number of bits to store the pointer to next node
|
|
||||||
# ifndef ARDUINOJSON_SLOT_OFFSET_SIZE
|
|
||||||
# define ARDUINOJSON_SLOT_OFFSET_SIZE 4
|
|
||||||
# endif
|
|
||||||
|
|
||||||
#endif // ARDUINOJSON_EMBEDDED_MODE
|
|
||||||
|
|
||||||
#ifdef ARDUINO
|
#ifdef ARDUINO
|
||||||
|
|
||||||
# include <Arduino.h>
|
# include <Arduino.h>
|
||||||
|
Reference in New Issue
Block a user